/* ============================================================
   AI Keyboard — Admin Dashboard Styles
   ============================================================ */

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

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #a5b4fc;
    --success: #22c55e;
    --warning: #f59e0b;
    --error: #ef4444;
    --info: #3b82f6;
    --bg: #f8fafc;
    --bg-card: #ffffff;
    --bg-nav: #1e293b;
    --text: #1e293b;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    --border: #e2e8f0;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-lg: 0 4px 24px rgba(0,0,0,0.1);
    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: var(--primary);
    text-decoration: none;
}
a:hover {
    color: var(--primary-dark);
}

/* --- Navigation --- */
.navbar {
    background: var(--bg-nav);
    color: #fff;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.nav-brand a {
    color: #fff;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}
.nav-brand a:hover { color: var(--primary-light); }

.nav-links {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.9rem;
}

.nav-links a {
    color: #cbd5e1;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}
.nav-links a:hover,
.nav-links a.active {
    color: #fff;
    background: rgba(255,255,255,0.1);
}

.nav-user {
    color: #94a3b8;
    padding: 0 8px;
    font-size: 0.85rem;
}

/* --- Container --- */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
}

/* --- Cards --- */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 24px;
    overflow: hidden;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 12px;
}

.card-header h2,
.card-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
}

.card-body {
    padding: 24px;
}

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

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: transform 0.2s, box-shadow 0.2s;
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.stat-icon {
    font-size: 2rem;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    border-radius: var(--radius-sm);
}

.stat-body { flex: 1; }
.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.2;
    color: var(--text);
}
.stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
}
.stat-sub {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-top: 4px;
}

/* --- Tables --- */
.table-responsive {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.table th,
.table td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.table th {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--bg);
}

.table tbody tr:hover {
    background: #f1f5f9;
}

.text-truncate {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* --- Badges --- */
.badge {
    display: inline-block;
    padding: 2px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 100px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-primary { background: var(--primary-light); color: var(--primary-dark); }
.badge-secondary { background: #e2e8f0; color: #475569; }
.badge-success { background: #dcfce7; color: #15803d; }
.badge-error { background: #fce4ec; color: #b91c1c; }
/* Used by refunded payments and expired/on-cooldown states. */
.badge-warning { background: #fef3c7; color: #b45309; }

/* --- Buttons: destructive variant --- */
.btn-danger { background: #dc2626; color: #fff; }
.btn-danger:hover { background: #b91c1c; }

/* --- Forms --- */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-family: inherit;
    background: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}

.form-group input:disabled {
    background: var(--bg);
    color: var(--text-muted);
    cursor: not-allowed;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 600px) {
    .form-row { grid-template-columns: 1fr; }
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    font-family: inherit;
    background: var(--bg-card);
    color: var(--text);
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    white-space: nowrap;
}

.btn:hover {
    background: var(--bg);
    border-color: #cbd5e1;
    color: var(--text);
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    color: #fff;
}

.btn-block {
    display: flex;
    justify-content: center;
    width: 100%;
}

.btn-sm {
    padding: 4px 10px;
    font-size: 0.8rem;
}

/* --- Alerts --- */
.alert {
    padding: 12px 18px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.alert-error {
    background: #fce4ec;
    color: #b91c1c;
    border: 1px solid #f8d7da;
}

.alert-info {
    background: #e0f2fe;
    color: #0369a1;
    border: 1px solid #bae6fd;
}

.alert-success {
    background: #dcfce7;
    color: #15803d;
    border: 1px solid #bbf7d0;
}

/* --- Login Page --- */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 40px 32px;
}

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

.login-header .logo {
    font-size: 3rem;
    margin-bottom: 8px;
}

.login-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
}

.login-header p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 4px;
}

.login-form .form-group {
    margin-bottom: 20px;
}

/* --- Empty State --- */
.empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: 40px 0;
    font-size: 0.95rem;
}

/* --- Actions --- */
.action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.actions {
    display: flex;
    gap: 4px;
}

/* --- Footer --- */
.footer {
    text-align: center;
    padding: 20px;
    color: var(--text-light);
    font-size: 0.8rem;
    border-top: 1px solid var(--border);
    margin-top: 40px;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .navbar { padding: 0 12px; }
    .nav-links { gap: 4px; font-size: 0.8rem; }
    .nav-links a { padding: 4px 8px; }
    .container { padding: 12px; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .card-header { flex-direction: column; align-items: flex-start; }
}
