/* ============================================
   Arterect Auth — Dark Glassmorphism Design
   ============================================ */

:root {
    /* Background — matches Next.js admin/console */
    --c-bg: #1f1f22;
    --c-bg-card: rgba(15, 15, 15, 0.8);
    --c-bg-input: rgba(255, 255, 255, 0.05);
    --c-bg-input-hover: rgba(255, 255, 255, 0.07);

    /* Text — matches Next.js admin/console */
    --c-text-primary: #fafafa;
    --c-text-secondary: #a1a1aa;
    --c-text-muted: #71717a;

    /* Borders — matches Next.js admin/console */
    --c-border: #2f2f33;
    --c-border-hover: rgba(255, 255, 255, 0.2);
    --c-border-input: rgba(255, 255, 255, 0.1);
    --c-border-focus: rgba(255, 255, 255, 0.5);
    --c-border-card: rgba(255, 255, 255, 0.08);

    /* Accent */
    --c-accent: #f5f5f5;
    --c-accent-dark: #cccccc;

    /* Status */
    --c-error: #ef4444;
    --c-success: #10b981;
    --c-info: rgba(255, 255, 255, 0.06);

    /* Effects */
    --glass-blur: blur(40px);
    --ring-focus: 0 0 0 3px rgba(255, 255, 255, 0.15);

    /* Radii */
    --r-card: 20px;
    --r-input: 12px;
    --r-btn: 10px;
    --r-badge: 8px;
}

/* ---- Reset ---- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ---- Body ---- */
body {
    font-family: 'IBM Plex Sans JP', sans-serif;
    background-color: var(--c-bg);
    color: var(--c-text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Subtle radial */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse at 50% 0%, rgba(255, 255, 255, 0.025) 0%, transparent 55%);
    pointer-events: none;
    z-index: -1;
}

/* ---- Animation ---- */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ---- Links ---- */
a {
    color: var(--c-text-secondary);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--c-text-primary);
}

.link {
    color: var(--c-text-muted);
    font-size: 0.8125rem;
    transition: color 0.2s ease;
}

.link:hover {
    color: var(--c-text-primary);
}

/* ---- Layout ---- */
.auth-container {
    width: 100%;
    max-width: 400px;
    padding: 2rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    animation: fadeIn 0.4s ease-out;
}

.auth-box {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.card-lg .auth-box,
.auth-box.card-lg {
    max-width: 500px;
}

/* ---- Brand ---- */
.brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    text-align: center;
}

.brand-logo {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.brand-logo img, .brand-logo svg {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: invert(1);
}

.brand-name {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--c-text-primary);
    letter-spacing: -0.02em;
}

.brand-sub {
    font-size: 0.75rem;
    color: var(--c-text-muted);
}

/* ---- Badge ---- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.625rem;
    font-size: 0.625rem;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--c-text-muted);
    border: 1px solid var(--c-border);
    border-radius: 999px;
}

.badge svg {
    width: 10px;
    height: 10px;
}

/* ---- Glass Card ---- */
.card {
    position: relative;
    background: var(--c-bg-card);
    border: 1px solid var(--c-border-card);
    border-radius: var(--r-card);
    padding: 1.75rem;
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
}

/* Gradient top edge */
.card::before {
    content: '';
    position: absolute;
    top: -1px;
    left: 20%;
    right: 20%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
    pointer-events: none;
    z-index: 1;
}

/* ---- Title / Subtitle ---- */
.title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--c-text-primary);
    margin-bottom: 1rem;
}

.subtitle {
    font-size: 0.8125rem;
    color: var(--c-text-secondary);
    line-height: 1.6;
    margin-bottom: 1rem;
}

/* ---- Form Elements ---- */
.form-group {
    margin-bottom: 1rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.625rem;
}

.label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.375rem;
}

.form-label {
    display: block;
    font-size: 0.8125rem;
    color: var(--c-text-secondary);
    font-weight: 500;
    margin-bottom: 0.375rem;
}

.label-row .form-label {
    margin-bottom: 0;
}

.form-input {
    width: 100%;
    background: var(--c-bg-input);
    border: 1px solid var(--c-border-input);
    color: var(--c-text-primary);
    padding: 0.625rem 0.875rem;
    border-radius: var(--r-input);
    font-size: 0.875rem;
    font-family: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    outline: none;
}

.form-input:hover {
    border-color: var(--c-border-hover);
}

.form-input:focus {
    border-color: var(--c-border-focus);
    box-shadow: var(--ring-focus);
}

.form-input::placeholder {
    color: var(--c-text-muted);
}

textarea.form-input {
    min-height: 90px;
    resize: vertical;
    line-height: 1.6;
}

/* Large input for OTP */
.form-input-lg {
    font-size: 1.5rem;
    font-family: 'IBM Plex Mono', monospace;
    text-align: center;
    letter-spacing: 0.5em;
    padding: 0.75rem;
}

.form-hint {
    font-size: 0.6875rem;
    color: var(--c-text-muted);
    margin-top: 0.25rem;
}

.form-error {
    color: var(--c-error);
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0.625rem 1.25rem;
    border-radius: var(--r-btn);
    font-size: 0.875rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s ease;
    border: none;
    text-decoration: none;
}

.btn-primary {
    background: var(--c-accent);
    color: #0a0a0b;
    font-weight: 600;
}

.btn-primary:hover {
    background: var(--c-accent-dark);
    color: #0a0a0b;
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--c-border);
    color: var(--c-text-secondary);
}

.btn-secondary:hover {
    border-color: var(--c-border-hover);
    color: var(--c-text-primary);
}

.btn-danger {
    background: transparent;
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: var(--c-error);
}

.btn-danger:hover {
    border-color: rgba(239, 68, 68, 0.4);
}

.btn-sm {
    width: auto;
    padding: 0.35rem 0.75rem;
    font-size: 0.75rem;
    border-radius: var(--r-badge);
}

/* ---- Divider ---- */
.divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 1rem 0;
    color: var(--c-text-muted);
    font-size: 0.6875rem;
    letter-spacing: 0.02em;
}

.divider::before, .divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--c-border);
}

.divider::before { margin-right: 0.75rem; }
.divider::after  { margin-left: 0.75rem; }

/* ---- Checkbox ---- */
.checkbox-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 1rem;
    height: 1rem;
    border: 1px solid var(--c-border-input);
    border-radius: 4px;
    background: var(--c-bg-input);
    cursor: pointer;
    position: relative;
    flex-shrink: 0;
    transition: all 0.15s ease;
}

.checkbox:hover {
    border-color: var(--c-border-hover);
}

.checkbox:checked {
    background: var(--c-accent);
    border-color: var(--c-accent);
}

.checkbox:checked::after {
    content: '\2714';
    font-size: 0.625rem;
    color: #0a0a0b;
    font-weight: bold;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.checkbox:focus-visible {
    box-shadow: var(--ring-focus);
}

.checkbox-label {
    font-size: 0.75rem;
    color: var(--c-text-muted);
    cursor: pointer;
}

/* ---- Messages ---- */
.msg {
    padding: 0.625rem 0.875rem;
    border-radius: var(--r-badge);
    margin-bottom: 0.75rem;
    font-size: 0.75rem;
    line-height: 1.5;
}

.msg-error {
    background: rgba(239, 68, 68, 0.06);
    color: var(--c-error);
    border: 1px solid rgba(239, 68, 68, 0.12);
}

.msg-success {
    background: rgba(16, 185, 129, 0.06);
    color: var(--c-success);
    border: 1px solid rgba(16, 185, 129, 0.12);
}

.msg-info {
    background: var(--c-info);
    color: var(--c-text-secondary);
    border: 1px solid var(--c-border);
}

/* ---- Secret/Code Box ---- */
.secret-box {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--c-border);
    border-radius: var(--r-input);
    padding: 0.875rem 1rem;
    margin-bottom: 0.75rem;
}

.secret-label {
    font-size: 0.6875rem;
    color: var(--c-text-muted);
    margin-bottom: 0.25rem;
}

.secret-code {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.875rem;
    color: var(--c-text-primary);
    word-break: break-all;
}

/* ---- QR Code ---- */
.qr-box {
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
}

.qr-wrap {
    background: #ffffff;
    padding: 0.875rem;
    border-radius: var(--r-input);
}

.qr-wrap img {
    display: block;
    width: 160px;
    height: 160px;
}

/* ---- Backup Code Grid ---- */
.backup-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.375rem;
    margin-bottom: 1rem;
}

.backup-code {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--c-border);
    border-radius: 6px;
    padding: 0.5rem;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.8125rem;
    text-align: center;
    color: var(--c-text-primary);
    letter-spacing: 0.08em;
}

/* ---- Profile ---- */
.profile-header {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    margin-bottom: 1.25rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--c-border);
}

.profile-avatar {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.03));
    border: 1px solid var(--c-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--c-text-primary);
    flex-shrink: 0;
}

.profile-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--c-text-primary);
}

.profile-email {
    font-size: 0.75rem;
    color: var(--c-text-muted);
    margin-top: 0.125rem;
}

.profile-section {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--c-border);
}

.profile-section-title {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--c-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.625rem;
}

.profile-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
}

.profile-label {
    font-size: 0.8125rem;
    color: var(--c-text-secondary);
}

.profile-value {
    font-size: 0.8125rem;
    color: var(--c-text-primary);
}

/* ---- Status Badges ---- */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.5rem;
    font-size: 0.625rem;
    font-weight: 500;
    border-radius: 999px;
}

.status-on {
    background: rgba(16, 185, 129, 0.08);
    color: var(--c-success);
    border: 1px solid rgba(16, 185, 129, 0.15);
}

.status-off {
    background: rgba(255, 255, 255, 0.03);
    color: var(--c-text-muted);
    border: 1px solid var(--c-border);
}

/* ---- Navigation List ---- */
.nav-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    color: var(--c-text-secondary);
    font-size: 0.8125rem;
    transition: all 0.15s ease;
    text-decoration: none;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--c-text-primary);
}

.nav-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    opacity: 0.5;
}

.nav-item:hover .nav-icon {
    opacity: 0.9;
}

/* ---- List Items (Sessions, Connected Apps) ---- */
.list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    border: 1px solid var(--c-border);
    border-radius: var(--r-input);
    margin-bottom: 0.5rem;
    transition: border-color 0.15s ease;
}

.list-item:hover {
    border-color: var(--c-border-hover);
}

.list-item-info {
    flex: 1;
    min-width: 0;
}

.list-item-title {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--c-text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.list-item-meta {
    font-size: 0.6875rem;
    color: var(--c-text-muted);
    margin-top: 0.125rem;
}

.list-item-action {
    flex-shrink: 0;
    margin-left: 0.625rem;
}

/* ---- Footer ---- */
.footer {
    font-size: 0.625rem;
    color: var(--c-text-muted);
    padding: 1rem 0;
    letter-spacing: 0.03em;
    opacity: 0.7;
}

.footer a {
    color: var(--c-text-muted);
}

.footer a:hover {
    color: var(--c-text-secondary);
}

/* ---- Utilities ---- */
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mb-3 { margin-bottom: 0.75rem; }
.text-center { text-align: center; }
.text-sm { font-size: 0.75rem; }

/* ============================================
   Account Management Layout (sidebar + main)
   ============================================ */

/* body override for account pages */
body.account-layout {
    display: block;
}

body.account-layout::before { display: none; }

.acct-layout {
    display: flex;
    min-height: 100vh;
}

.acct-sidebar {
    width: 220px;
    background: rgba(8, 8, 9, 0.98);
    border-right: 1px solid var(--c-border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 10;
}

.acct-sidebar-header {
    padding: 1.25rem 1rem;
    border-bottom: 1px solid var(--c-border);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.acct-sidebar-logo {
    width: 28px;
    height: 28px;
}

.acct-sidebar-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: invert(1);
}

.acct-sidebar-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--c-text-primary);
    letter-spacing: -0.01em;
}

.acct-sidebar-user {
    padding: 1rem;
    border-bottom: 1px solid var(--c-border);
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

.acct-sidebar-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.03));
    border: 1px solid var(--c-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--c-text-primary);
    flex-shrink: 0;
}

.acct-sidebar-name {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--c-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.acct-sidebar-email {
    font-size: 0.625rem;
    color: var(--c-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.acct-sidebar-nav {
    flex: 1;
    padding: 0.75rem;
    overflow-y: auto;
}

.acct-nav-section {
    font-size: 0.5625rem;
    font-weight: 600;
    color: var(--c-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.5rem 0.75rem 0.375rem;
}

.acct-nav-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.75rem;
    border-radius: 6px;
    color: var(--c-text-muted);
    font-size: 0.75rem;
    font-weight: 500;
    text-decoration: none;
    margin-bottom: 1px;
    transition: all 0.15s ease;
}

.acct-nav-item:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--c-text-secondary);
}

.acct-nav-item.active {
    background: rgba(255, 255, 255, 0.06);
    color: var(--c-text-primary);
}

.acct-nav-item svg {
    width: 14px;
    height: 14px;
    opacity: 0.5;
    flex-shrink: 0;
}

.acct-nav-item:hover svg,
.acct-nav-item.active svg {
    opacity: 1;
}

.acct-sidebar-footer {
    padding: 0.75rem;
    border-top: 1px solid var(--c-border);
}

.acct-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    width: 100%;
    padding: 0.4rem;
    border-radius: 6px;
    border: 1px solid var(--c-border);
    color: var(--c-text-muted);
    font-size: 0.6875rem;
    text-decoration: none;
    transition: all 0.15s;
}

.acct-logout svg { width: 12px; height: 12px; }
.acct-logout:hover { border-color: var(--c-border-hover); color: var(--c-text-secondary); }

.acct-main {
    flex: 1;
    margin-left: 220px;
    padding: 1.75rem;
    max-width: 900px;
    animation: fadeIn 0.3s ease-out;
}

.acct-page-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--c-text-primary);
    letter-spacing: -0.02em;
    margin-bottom: 0.25rem;
}

.acct-page-sub {
    font-size: 0.75rem;
    color: var(--c-text-muted);
    margin-bottom: 1.25rem;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .acct-sidebar { display: none; }
    .acct-main { margin-left: 0; padding: 1.25rem 1rem; }
}

/* ---- Responsive ---- */
@media (max-width: 480px) {
    .auth-container {
        padding: 1.25rem 1rem;
    }

    .card {
        padding: 1.25rem;
        border-radius: 16px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .brand-logo {
        width: 36px;
        height: 36px;
    }

    .brand-name {
        font-size: 1.125rem;
    }

    .list-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.625rem;
    }

    .list-item-action {
        margin-left: 0;
        width: 100%;
    }

    .list-item-action .btn {
        width: 100%;
    }

    .backup-grid {
        grid-template-columns: 1fr;
    }
}
