/* ===== CSS Variables (Shadcn Light Theme Base) ===== */
:root {
    --background: #ffffff;
    --foreground: #09090b;

    --muted: #f4f4f5;
    --muted-foreground: #71717a;

    --popover: #ffffff;
    --popover-foreground: #09090b;

    --card: #ffffff;
    --card-foreground: #09090b;

    --border: #e4e4e7;
    --input: #e4e4e7;

    --primary: #18181b;
    --primary-foreground: #fafafa;
    --primary-hover: #27272a;

    --secondary: #f4f4f5;
    --secondary-foreground: #18181b;
    --secondary-hover: #e4e4e7;

    --destructive: #ef4444;
    --destructive-foreground: #fafafa;
    --destructive-hover: #dc2626;

    --ring: #18181b;

    --radius: 0.5rem;
    --radius-sm: 0.375rem;

    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

/* Base */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--muted);
    /* Light gray background for contrast */
    color: var(--foreground);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    font-size: 0.875rem;
}

.hidden {
    display: none !important;
}

.page {
    min-height: 100vh;
}

.text-muted {
    color: var(--muted-foreground);
}

.font-medium {
    font-weight: 500;
}

.mx-2 {
    margin-left: 0.5rem;
    margin-right: 0.5rem;
}

.mt-1 {
    margin-top: 0.25rem;
}

.mt-4 {
    margin-top: 1rem;
}

.text-sm {
    font-size: 0.875rem;
}

.text-right {
    text-align: right;
}

.text-mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.8125rem;
}

/* Lucide Icons */
.lucide {
    stroke-width: 2;
    width: 20px;
    height: 20px;
}

.icon-sm {
    width: 14px;
    height: 14px;
}

/* Typography */
h1,
h2,
h3 {
    font-weight: 600;
    letter-spacing: -0.025em;
}

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

input[type="text"],
input[type="password"],
select {
    display: flex;
    width: 100%;
    height: 2.25rem;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--input);
    background: var(--background);
    color: var(--foreground);
    font-size: 0.875rem;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}

input::placeholder {
    color: var(--muted-foreground);
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--ring);
    box-shadow: 0 0 0 1px var(--ring);
}

.help-text {
    font-size: 0.8rem;
    color: var(--muted-foreground);
    margin-top: 0.375rem;
}

.select-wrapper {
    position: relative;
}

.select-wrapper select {
    appearance: none;
    padding-right: 2rem;
    cursor: pointer;
}

.select-arrow {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: var(--muted-foreground);
    width: 16px;
    height: 16px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    height: 2.25rem;
    padding: 0 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s, border-color 0.2s;
    white-space: nowrap;
}

.btn:active {
    transform: translateY(1px);
}

.btn-primary {
    background-color: var(--primary);
    color: var(--primary-foreground);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-outline {
    background-color: var(--background);
    border-color: var(--input);
    color: var(--foreground);
}

.btn-outline:hover {
    background-color: var(--muted);
}

.btn-ghost {
    background-color: transparent;
    color: var(--foreground);
}

.btn-ghost:hover {
    background-color: var(--muted);
}

.btn-danger {
    background-color: transparent;
    color: var(--destructive);
}

.btn-danger:hover {
    background-color: #fee2e2;
}

.btn-block {
    width: 100%;
}

.btn-sm {
    height: 1.75rem;
    padding: 0 0.5rem;
    font-size: 0.75rem;
}

/* Login */
#login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: var(--muted);
}

.login-container {
    width: 100%;
    max-width: 380px;
    background-color: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2.5rem 2rem;
    box-shadow: var(--shadow-sm);
}

.login-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-bottom: 2rem;
}

.brand-logo {
    margin-bottom: 1rem;
    width: 32px;
    height: 32px;
}

.login-title {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.login-subtitle {
    color: var(--muted-foreground);
    font-size: 0.875rem;
}

/* Navbar */
.top-nav {
    border-bottom: 1px solid var(--border);
    background-color: var(--background);
    height: 56px;
}

.nav-container {
    max-width: 1024px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    display: flex;
    align-items: center;
}

.brand-logo-small {
    width: 20px;
    height: 20px;
    margin-right: 0.5rem;
}

/* Dashboard Content */
.dashboard-main {
    max-width: 1024px;
    margin: 0 auto;
    padding: 2.5rem 0;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.page-title {
    font-size: 1.875rem;
    margin-bottom: 0.25rem;
}

/* Table */
.table-container {
    background-color: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

#user-table {
    width: 100%;
    border-collapse: collapse;
}

#user-table th {
    background-color: var(--background);
    color: var(--muted-foreground);
    font-weight: 500;
    text-align: left;
    padding: 0.75rem 1.25rem;
    font-size: 0.875rem;
    border-bottom: 1px solid var(--border);
}

#user-table td {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

#user-table tbody tr:last-child td {
    border-bottom: none;
}

#user-table tbody tr:hover {
    background-color: var(--muted);
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 9999px;
    border: 1px solid transparent;
}

.badge-active {
    background-color: #ecfdf5;
    color: #065f46;
    border-color: #a7f3d0;
}

.badge-banned {
    background-color: #fef2f2;
    color: #991b1b;
    border-color: #fecaca;
}

.action-cell {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background-color: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(2px);
}

.modal-content {
    position: relative;
    width: 100%;
    max-width: 460px;
    background-color: var(--background);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    font-size: 1.125rem;
}

.modal-close {
    position: absolute;
    right: 1rem;
    top: 1rem;
    background: transparent;
    border: none;
    color: var(--muted-foreground);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: var(--radius-sm);
}

.modal-close:hover {
    background-color: var(--muted);
    color: var(--foreground);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1.25rem 1.5rem;
    background-color: var(--muted);
    border-top: 1px solid var(--border);
    border-bottom-left-radius: var(--radius);
    border-bottom-right-radius: var(--radius);
}

/* Detail Modal specific */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

@media (min-width: 640px) {
    .detail-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.detail-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--muted-foreground);
}

.detail-value {
    font-size: 0.875rem;
    word-break: break-all;
}

.token-well {
    background-color: var(--muted);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.75rem;
    margin-top: 0.5rem;
}

/* Toast */
#toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    padding: 0.875rem 1rem;
    background-color: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--foreground);
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: var(--shadow-md);
    min-width: 250px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.toast-success::before {
    content: "";
    display: block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #10b981;
}

.toast-error::before {
    content: "";
    display: block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #ef4444;
}

.toast-fade-out {
    animation: fadeOut 0.3s forwards;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(100%);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: scale(0.95);
    }
}

/* Responsive adjustments */
@media (max-width: 1048px) {

    .dashboard-main,
    .nav-container {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
}