/**
 * Auron Admin Dashboard
 * Clean, professional, Stripe-inspired design
 * No clutter, no unnecessary animations
 */

:root {
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;

    --blue-500: #3b82f6;
    --blue-600: #2563eb;
    --green-500: #10b981;
    --green-600: #059669;
    --red-500: #ef4444;
    --red-600: #dc2626;
    --amber-500: #f59e0b;

    --sidebar-width: 240px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--gray-900);
    background: var(--gray-50);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Auth Overlay */
.auth-overlay {
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.auth-modal {
    background: white;
    border-radius: 12px;
    padding: 32px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.auth-header h2 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 8px;
}

.auth-header p {
    color: var(--gray-600);
    margin-bottom: 24px;
}

.auth-modal input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 12px;
    transition: border-color 0.15s;
}

.auth-modal input:focus {
    outline: none;
    border-color: var(--blue-500);
}

.auth-modal button {
    width: 100%;
    padding: 12px 16px;
    background: var(--gray-900);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.15s;
}

.auth-modal button:hover {
    background: var(--gray-800);
}

.auth-error {
    color: var(--red-500);
    font-size: 13px;
    margin-top: 12px;
    display: none;
}

.auth-error.show {
    display: block;
}

/* Dashboard Layout */
.dashboard {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: white;
    border-right: 1px solid var(--gray-200);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

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

.sidebar-header h1 {
    font-size: 20px;
    font-weight: 600;
}

.badge {
    padding: 2px 8px;
    background: var(--gray-100);
    color: var(--gray-600);
    border-radius: 6px;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    color: var(--gray-600);
    text-decoration: none;
    border-radius: 8px;
    margin-bottom: 4px;
    transition: all 0.15s;
}

.nav-item:hover {
    background: var(--gray-50);
    color: var(--gray-900);
}

.nav-item.active {
    background: var(--gray-100);
    color: var(--gray-900);
    font-weight: 500;
}

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

.sidebar-footer {
    padding: 12px;
    border-top: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--gray-900);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
}

.user-info {
    flex: 1;
}

.user-name {
    font-size: 13px;
    font-weight: 500;
}

.user-role {
    font-size: 11px;
    color: var(--gray-500);
}

.btn-logout {
    padding: 8px;
    background: none;
    border: none;
    color: var(--gray-400);
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.15s;
}

.btn-logout:hover {
    background: var(--gray-100);
    color: var(--gray-600);
}

/* Main Content */
.main-content {
    flex: 1;
    overflow-y: auto;
    background: var(--gray-50);
}

.page {
    display: none;
    padding: 32px;
    max-width: 1400px;
    margin: 0 auto;
}

.page.active {
    display: block;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 32px;
}

.page-header h2 {
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 4px;
}

.page-header p {
    color: var(--gray-600);
}

.header-actions {
    display: flex;
    gap: 12px;
}

/* Buttons */
.btn-primary, .btn-secondary {
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.15s;
}

.btn-primary {
    background: var(--gray-900);
    color: white;
}

.btn-primary:hover {
    background: var(--gray-800);
}

.btn-secondary {
    background: white;
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
}

.btn-secondary:hover {
    background: var(--gray-50);
}

/* KPI Cards */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.kpi-card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    padding: 24px;
}

.kpi-card.highlight {
    background: var(--gray-900);
    color: white;
    border-color: var(--gray-900);
}

.kpi-label {
    font-size: 13px;
    color: var(--gray-600);
    margin-bottom: 8px;
}

.kpi-card.highlight .kpi-label {
    color: var(--gray-400);
}

.kpi-value {
    font-size: 32px;
    font-weight: 600;
    line-height: 1;
    margin-bottom: 8px;
}

.kpi-change {
    font-size: 13px;
    color: var(--gray-600);
}

.kpi-change.positive {
    color: var(--green-600);
}

.kpi-change.negative {
    color: var(--red-600);
}

.kpi-sublabel {
    font-size: 13px;
    color: var(--gray-500);
}

.kpi-card.highlight .kpi-sublabel {
    color: var(--gray-400);
}

/* Charts */
.charts-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.chart-card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    padding: 24px;
    height: 400px;
    display: flex;
    flex-direction: column;
}

.chart-card canvas {
    flex: 1;
    min-height: 0;
}

.chart-card.full-width {
    grid-column: 1 / -1;
}

.chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.chart-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.chart-header select {
    padding: 6px 12px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: 13px;
    background: white;
    cursor: pointer;
}

/* Quick Actions */
.actions-section {
    margin-bottom: 32px;
}

.actions-section h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
}

.actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.action-card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    cursor: pointer;
    transition: all 0.15s;
}

.action-card:hover {
    border-color: var(--gray-300);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.action-card svg {
    color: var(--gray-400);
}

.action-card span {
    font-weight: 500;
}

/* Table */
.table-container {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    overflow: hidden;
    max-height: 600px;
    overflow-y: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.data-table th {
    text-align: left;
    padding: 12px 16px;
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-600);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table td {
    padding: 16px;
    border-bottom: 1px solid var(--gray-200);
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tr:hover {
    background: var(--gray-50);
}

.data-table td.loading {
    text-align: center;
    color: var(--gray-500);
    padding: 32px;
}

/* Search Input */
.search-input {
    padding: 10px 16px;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    font-size: 14px;
    min-width: 300px;
}

.search-input:focus {
    outline: none;
    border-color: var(--blue-500);
}

/* Ledger Feed */
.ledger-feed {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    padding: 24px;
    max-height: 600px;
    overflow-y: auto;
}

.ledger-item {
    padding: 16px 0;
    border-bottom: 1px solid var(--gray-100);
}

.ledger-item:last-child {
    border-bottom: none;
}

.ledger-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.ledger-type {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.ledger-type.DEDUCTION {
    background: var(--red-500);
    color: white;
}

.ledger-type.TOPUP {
    background: var(--green-500);
    color: white;
}

.ledger-type.BONUS {
    background: var(--blue-500);
    color: white;
}

.ledger-amount {
    font-size: 18px;
    font-weight: 600;
}

.ledger-details {
    font-size: 13px;
    color: var(--gray-600);
}

/* Rates Grid */
.rates-grid {
    display: grid;
    gap: 16px;
}

.rate-card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    padding: 20px;
    display: grid;
    grid-template-columns: 1fr auto auto auto;
    gap: 16px;
    align-items: center;
}

.rate-info {
    flex: 1;
}

.rate-name {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 4px;
}

.rate-description {
    font-size: 12px;
    color: var(--gray-600);
}

.rate-input {
    display: flex;
    align-items: center;
    gap: 8px;
}

.rate-input label {
    font-size: 12px;
    color: var(--gray-600);
}

.rate-input input {
    width: 80px;
    padding: 8px 12px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: 14px;
}

.rate-effective {
    font-size: 18px;
    font-weight: 600;
}

/* Analytics Grid */
.analytics-grid {
    display: grid;
    gap: 20px;
}

.analytics-grid .chart-card {
    height: 400px;
}

.analytics-grid .chart-card.full-width {
    height: 500px;
}

/* Loading State */
.loading {
    text-align: center;
    color: var(--gray-500);
    padding: 48px;
}

/* Responsive */
@media (max-width: 1024px) {
    .sidebar {
        width: 200px;
    }

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

@media (max-width: 768px) {
    .sidebar {
        display: none;
    }

    .page {
        padding: 20px;
    }

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

    .search-input {
        min-width: 200px;
    }
}

/* ============================================================================
   Phase 2.3: MFA & Security Styles
   ============================================================================ */

/* Auth reset link */
.auth-reset-link {
    margin-top: 12px;
    text-align: center;
    font-size: 13px;
}

.auth-reset-link a {
    color: var(--primary);
    text-decoration: none;
}

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

/* MFA Setup Modal */
.modal-large {
    max-width: 700px;
}

.mfa-setup-steps {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.mfa-step {
    padding: 20px;
    background: var(--gray-50);
    border-radius: 8px;
    border: 1px solid var(--gray-200);
}

.mfa-step h4 {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-900);
}

.mfa-step p {
    margin: 0 0 16px 0;
    font-size: 14px;
    color: var(--gray-600);
}

.qr-code-container {
    display: flex;
    justify-content: center;
    padding: 20px;
    background: white;
    border-radius: 8px;
    margin: 16px 0;
}

.qr-code-container img {
    max-width: 250px;
    height: auto;
}

.mfa-secret-label {
    margin-top: 16px;
    font-size: 13px;
    color: var(--gray-600);
}

.mfa-secret {
    display: block;
    padding: 12px;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 16px;
    letter-spacing: 2px;
    text-align: center;
    margin-top: 8px;
    user-select: all;
}

.recovery-codes-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin: 16px 0;
    padding: 16px;
    background: white;
    border-radius: 8px;
}

.recovery-code-item {
    font-size: 13px;
    color: var(--gray-700);
}

.recovery-code-item code {
    font-family: 'Courier New', monospace;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 1px;
    color: var(--gray-900);
}

.mfa-token-input {
    width: 100%;
    max-width: 200px;
    padding: 12px;
    font-size: 24px;
    font-family: 'Courier New', monospace;
    text-align: center;
    letter-spacing: 8px;
    border: 2px solid var(--gray-300);
    border-radius: 8px;
    margin-top: 12px;
}

.mfa-token-input:focus {
    border-color: var(--primary);
    outline: none;
}

/* Status Cards */
.status-card {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 20px;
    border-radius: 8px;
    border: 2px solid;
}

.status-card.success {
    background: var(--success-bg);
    border-color: var(--success);
}

.status-card.warning {
    background: #fef3c7;
    border-color: #f59e0b;
}

.status-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: bold;
    flex-shrink: 0;
}

.status-card.success .status-icon {
    background: var(--success);
    color: white;
}

.status-card.warning .status-icon {
    background: #f59e0b;
    color: white;
}

.status-content {
    flex: 1;
}

.status-content h4 {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-900);
}

.status-content p {
    margin: 0 0 16px 0;
    font-size: 14px;
    color: var(--gray-600);
}

/* Info/Success messages in modals */
.info-message {
    padding: 12px;
    border-radius: 6px;
    font-size: 14px;
    margin-top: 12px;
}

.info-message.success-message {
    background: var(--success-bg);
    color: var(--success-dark);
    border: 1px solid var(--success);
}

/* Section cards */
.section-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.section-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--gray-900);
}

/* Empty and loading states */
.empty-state {
    padding: 40px;
    text-align: center;
    color: var(--gray-500);
    font-size: 14px;
}

.loading-text {
    padding: 20px;
    text-align: center;
    color: var(--gray-500);
    font-size: 14px;
}

.error-text {
    padding: 20px;
    text-align: center;
    color: var(--error);
    font-size: 14px;
}

/* Button sizes */
.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-danger {
    background: var(--error);
    color: white;
    border: none;
}

.btn-danger:hover {
    background: var(--error-dark);
}
