/**
 * Nexus AI - Merchant SaaS Portal Luxury Glassmorphism Stylesheet
 * Self-contained, responsive, enterprise-grade dark UI
 */

:root {
    --portal-bg: #090d16;
    --portal-bg-gradient: radial-gradient(circle at 50% 0%, #172554 0%, #090d16 60%, #030712 100%);
    --portal-surface: rgba(15, 23, 42, 0.75);
    --portal-surface-card: rgba(30, 41, 59, 0.65);
    --portal-surface-input: rgba(15, 23, 42, 0.85);
    --portal-border: rgba(255, 255, 255, 0.08);
    --portal-border-hover: rgba(56, 189, 248, 0.35);
    --portal-primary: #0284c7;
    --portal-primary-hover: #0369a1;
    --portal-accent: #38bdf8;
    --portal-indigo: #6366f1;
    --portal-text: #f8fafc;
    --portal-text-muted: #94a3b8;
    --portal-text-dim: #64748b;
    --portal-success: #10b981;
    --portal-warning: #f59e0b;
    --portal-danger: #ef4444;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body.admin-body {
    background: var(--portal-bg-gradient);
    color: var(--portal-text);
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    min-height: 100vh;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Wrapper Layout */
.admin-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.admin-sidebar {
    width: 270px;
    background: rgba(11, 15, 25, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-right: 1px solid var(--portal-border);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 24px 16px;
    flex-shrink: 0;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--portal-border);
    margin-bottom: 24px;
}

.brand-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, #0284c7, #2563eb);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 16px -4px rgba(2, 132, 199, 0.4);
    color: #fff;
    flex-shrink: 0;
}

.brand-name {
    font-size: 16px;
    font-weight: 700;
    color: #f8fafc;
    letter-spacing: -0.3px;
    margin: 0;
}

.portal-brand-badge {
    font-size: 10px;
    font-weight: 700;
    background: linear-gradient(135deg, #0284c7, #2563eb);
    color: #fff;
    padding: 2px 7px;
    border-radius: 4px;
    letter-spacing: 0.5px;
    display: inline-block;
    margin-top: 3px;
}

/* Sidebar Navigation Menu */
.sidebar-menu {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 10px;
    color: var(--portal-text-muted);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 600;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.menu-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #f8fafc;
    border-color: rgba(255, 255, 255, 0.08);
}

.menu-item.active {
    background: rgba(2, 132, 199, 0.15);
    color: var(--portal-accent);
    border-color: rgba(56, 189, 248, 0.3);
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.15);
}

.menu-item svg {
    flex-shrink: 0;
}

/* Sidebar User Footer */
.sidebar-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 20px;
    border-top: 1px solid var(--portal-border);
    margin-top: 20px;
    gap: 10px;
}

.admin-user-pill {
    display: flex;
    align-items: center;
    gap: 10px;
    overflow: hidden;
}

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: linear-gradient(135deg, #0284c7, #2563eb);
    color: #fff;
    font-weight: 700;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.user-info {
    overflow: hidden;
    line-height: 1.3;
}

.user-info strong {
    display: block;
    font-size: 13px;
    color: #f8fafc;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-info span {
    display: block;
    font-size: 11px;
    color: var(--portal-text-dim);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-logout {
    color: var(--portal-text-dim);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-logout:hover {
    color: var(--portal-danger);
    background: rgba(239, 68, 68, 0.15);
}

/* Main Content Area */
.admin-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.admin-topbar {
    height: 72px;
    background: rgba(11, 15, 25, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--portal-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
}

.topbar-left {
    display: flex;
    align-items: baseline;
    gap: 12px;
}

.topbar-title {
    font-size: 18px;
    font-weight: 700;
    color: #f8fafc;
    letter-spacing: -0.3px;
}

.topbar-crumb {
    font-size: 12px;
    color: var(--portal-text-dim);
    font-weight: 500;
}

.admin-content {
    flex: 1;
    padding: 32px;
    overflow-y: auto;
}

/* Panels & Cards */
.admin-panel {
    background: var(--portal-surface-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--portal-border);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    margin-bottom: 24px;
}

.panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--portal-border);
    gap: 16px;
}

.panel-title {
    font-size: 16px;
    font-weight: 700;
    color: #f8fafc;
    margin: 0 0 4px 0;
}

.panel-desc {
    font-size: 13px;
    color: var(--portal-text-muted);
    margin: 0;
}

/* KPI Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--portal-surface-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--portal-border);
    border-radius: 14px;
    padding: 20px;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.stat-card:hover {
    border-color: var(--portal-border-hover);
    transform: translateY(-2px);
}

.stat-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--portal-text-dim);
}

.stat-value {
    font-size: 26px;
    font-weight: 800;
    color: #f8fafc;
    margin: 8px 0 4px 0;
    letter-spacing: -0.5px;
}

.stat-sub {
    font-size: 12px;
    color: var(--portal-text-muted);
}

/* Store Grid & Cards */
.store-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    margin-top: 16px;
}

.store-card {
    background: rgba(23, 32, 48, 0.7);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--portal-border);
    border-radius: 14px;
    padding: 22px;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.store-card:hover {
    border-color: rgba(56, 189, 248, 0.4);
    transform: translateY(-3px);
    box-shadow: 0 12px 28px -8px rgba(2, 132, 199, 0.25);
}

.store-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 14px;
}

.store-card-title {
    font-size: 16px;
    font-weight: 700;
    color: #f8fafc;
    margin: 0 0 4px 0;
}

.store-card-domain {
    font-size: 12.5px;
    color: var(--portal-accent);
    font-family: 'JetBrains Mono', monospace;
    font-weight: 500;
}

.store-metrics {
    display: flex;
    gap: 12px;
    margin: 16px 0;
    padding: 14px;
    background: rgba(11, 15, 25, 0.6);
    border: 1px solid var(--portal-border);
    border-radius: 10px;
}

.store-metric {
    flex: 1;
}

.store-metric-label {
    font-size: 10.5px;
    color: var(--portal-text-dim);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.store-metric-val {
    font-size: 15px;
    font-weight: 700;
    color: #f8fafc;
    margin-top: 3px;
}

.store-card-actions {
    display: flex;
    gap: 10px;
    margin-top: 14px;
}

/* Guide Box (Onboarding Wizard) */
.guide-box {
    background: rgba(11, 15, 25, 0.7);
    border: 1px solid rgba(56, 189, 248, 0.2);
    border-radius: 14px;
    padding: 24px;
    margin-bottom: 24px;
}

.guide-step {
    display: flex;
    gap: 18px;
    margin-bottom: 20px;
}

.guide-step:last-child {
    margin-bottom: 0;
}

.guide-num {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0284c7, #2563eb);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
    box-shadow: 0 4px 10px rgba(2, 132, 199, 0.35);
}

.guide-content h4 {
    margin: 0 0 6px 0;
    font-size: 14.5px;
    color: #f8fafc;
    font-weight: 700;
}

.guide-content p {
    margin: 0 0 10px 0;
    font-size: 13px;
    color: var(--portal-text-muted);
    line-height: 1.5;
}

.copy-field {
    display: flex;
    align-items: center;
    background: #06090e;
    border: 1px solid #1e293b;
    border-radius: 8px;
    padding: 8px 14px;
    margin-top: 6px;
    gap: 12px;
}

.copy-field code {
    flex: 1;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: var(--portal-accent);
    word-break: break-all;
}

.btn-copy {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #cbd5e1;
    font-size: 11.5px;
    font-weight: 600;
    padding: 5px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.btn-copy:hover {
    background: rgba(56, 189, 248, 0.2);
    color: var(--portal-accent);
    border-color: rgba(56, 189, 248, 0.4);
}

/* Forms & Inputs */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

.form-group label,
.nexus-label {
    font-size: 13px;
    font-weight: 600;
    color: #f8fafc;
    display: flex;
    align-items: center;
    gap: 6px;
}

.admin-input,
.portal-input {
    width: 100%;
    background: var(--portal-surface-input);
    border: 1px solid #334155;
    border-radius: 8px;
    color: #f8fafc;
    padding: 10px 14px;
    font-size: 13.5px;
    font-family: inherit;
    transition: all 0.2s ease;
    outline: none;
}

.admin-input:focus,
.portal-input:focus {
    border-color: var(--portal-accent);
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.18);
    background: #0f172a;
}

.admin-input::placeholder {
    color: #64748b;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.btn-primary {
    background: linear-gradient(135deg, #0284c7, #2563eb);
    color: #fff;
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #0369a1, #1d4ed8);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(2, 132, 199, 0.4);
}

.btn-table-action {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--portal-border);
    color: #cbd5e1;
    font-size: 12px;
    font-weight: 600;
    padding: 7px 12px;
    border-radius: 6px;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-table-action:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-topbar-action {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #0284c7, #2563eb);
    color: #fff;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.3);
    transition: all 0.2s ease;
}

.btn-topbar-action:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(2, 132, 199, 0.45);
}

.btn-admin-submit {
    width: 100%;
    background: linear-gradient(135deg, #0284c7, #2563eb);
    color: #fff;
    padding: 12px 18px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    border: none;
    cursor: pointer;
    margin-top: 10px;
    box-shadow: 0 6px 16px rgba(2, 132, 199, 0.35);
    transition: all 0.2s ease;
}

.btn-admin-submit:hover {
    opacity: 0.95;
    transform: translateY(-1px);
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.badge-success {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.keycode-tag {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    background: rgba(56, 189, 248, 0.12);
    color: #38bdf8;
    padding: 2px 7px;
    border-radius: 4px;
    border: 1px solid rgba(56, 189, 248, 0.25);
}

/* Auth Screens (Login / Register) */
.login-body {
    background: radial-gradient(circle at 50% 0%, #172554 0%, #090d16 60%, #030712 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    font-family: 'Plus Jakarta Sans', sans-serif;
}

.login-card-container {
    width: 100%;
    max-width: 440px;
}

.login-card {
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 18px;
    padding: 36px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
}

.login-header {
    text-align: center;
    margin-bottom: 28px;
}

.login-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    background: linear-gradient(135deg, #0284c7, #2563eb);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
    box-shadow: 0 8px 20px -4px rgba(2, 132, 199, 0.45);
    color: #fff;
}

.login-header h2 {
    font-size: 21px;
    font-weight: 700;
    color: #f8fafc;
    margin-bottom: 6px;
}

.login-header p {
    font-size: 13px;
    color: var(--portal-text-muted);
}

.login-error-alert {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.35);
    color: #fca5a5;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 20px;
}

.auth-switch {
    text-align: center;
    margin-top: 24px;
    font-size: 13px;
    color: var(--portal-text-muted);
}

.auth-switch a {
    color: var(--portal-accent);
    text-decoration: none;
    font-weight: 600;
}

.auth-switch a:hover {
    text-decoration: underline;
}

/* Responsive */
@media (max-width: 900px) {
    .admin-wrapper {
        flex-direction: column;
    }
    .admin-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--portal-border);
    }
    .admin-topbar {
        padding: 0 20px;
    }
    .admin-content {
        padding: 20px;
    }
    .store-grid {
        grid-template-columns: 1fr;
    }
}
