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

:root {
    --bg: #0a0a0f;
    --card-bg: #12121a;
    --card-border: #1e1e2e;
    --accent: #6366f1;
    --accent-hover: #818cf8;
    --accent-glow: rgba(99, 102, 241, 0.3);
    --text: #e2e8f0;
    --text-muted: #94a3b8;
    --error: #ef4444;
    --success: #22c55e;
    --admin: #f59e0b;
    --user: #3b82f6;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
}

.hidden {
    display: none !important;
}

.page {
    min-height: 100vh;
}

/* ===== LOGIN PAGE ===== */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    background: 
        radial-gradient(ellipse at top, rgba(99, 102, 241, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse at bottom right, rgba(168, 85, 247, 0.08) 0%, transparent 50%),
        var(--bg);
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.login-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    padding: 3rem;
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
    box-shadow: 
        0 25px 50px -12px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.05);
    animation: slideUp 0.6s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.logo {
    display: flex;
    justify-content: center;
    margin-bottom: 1.5rem;
    animation: pulse 3s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.login-card h1 {
    font-size: 1.75rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 0.5rem;
}

.subtitle {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.input-group {
    margin-bottom: 1.25rem;
}

.input-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
}

.input-group input,
.input-group select {
    width: 100%;
    padding: 0.875rem 1rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    font-size: 1rem;
    color: var(--text);
    transition: all 0.3s ease;
    font-family: inherit;
}

.input-group select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
}

.input-group input:focus,
.input-group select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.input-group input::placeholder {
    color: #475569;
}

.error-msg {
    color: var(--error);
    font-size: 0.875rem;
    margin-bottom: 1rem;
    min-height: 1.25rem;
    text-align: center;
}

.btn-primary {
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, var(--accent), #a855f7);
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s ease;
}

.btn-primary:hover::before {
    left: 100%;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 40px -10px var(--accent-glow);
}

.btn-primary:active {
    transform: translateY(0);
}

.divider {
    display: flex;
    align-items: center;
    margin: 2rem 0;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--card-border);
}

.divider span {
    padding: 0 1rem;
}

.test-accounts {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.test-btn {
    width: 100%;
    padding: 0.875rem 1rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    color: var(--text);
    font-size: 0.875rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.3s ease;
}

.test-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--accent);
}

.role-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.role-badge.admin {
    background: rgba(245, 158, 11, 0.15);
    color: var(--admin);
}

.role-badge.user {
    background: rgba(59, 130, 246, 0.15);
    color: var(--user);
}

/* ===== DASHBOARD ===== */
.dashboard-page {
    background: 
        radial-gradient(ellipse at top left, rgba(99, 102, 241, 0.05) 0%, transparent 40%),
        var(--bg);
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: rgba(18, 18, 26, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--card-border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: 700;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-user > span:first-of-type {
    color: var(--text-muted);
}

.btn-logout {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 10px;
    color: #ef4444;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

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

.dashboard-content {
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.welcome-card {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(168, 85, 247, 0.05));
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 20px;
    padding: 2.5rem;
    text-align: center;
    margin-bottom: 2rem;
}

.welcome-card.admin {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(234, 88, 12, 0.05));
    border-color: rgba(245, 158, 11, 0.2);
}

.welcome-icon {
    font-size: 3.5rem;
    margin-bottom: 1rem;
}

.welcome-card h2 {
    font-size: 1.75rem;
    margin-bottom: 0.75rem;
}

.welcome-card p {
    color: var(--text-muted);
    font-size: 1.125rem;
}

.welcome-card strong {
    color: var(--text);
}

.welcome-sub {
    margin-top: 0.5rem;
    font-size: 0.9rem !important;
}

.info-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.info-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 1.75rem;
    transition: all 0.3s ease;
}

.info-card:hover {
    border-color: var(--accent);
    transform: translateY(-4px);
    box-shadow: 0 12px 40px -12px rgba(99, 102, 241, 0.2);
}

.info-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.info-card h3 {
    font-size: 1.125rem;
    margin-bottom: 0.5rem;
}

.info-card p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Admin Stats */
.admin-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.3s ease;
}

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

.stat-icon {
    font-size: 2.5rem;
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text);
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* Users Table */
.users-table-section {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 1.75rem;
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.table-header h3 {
    font-size: 1.25rem;
}

.btn-add {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: linear-gradient(135deg, var(--success), #16a34a);
    border: none;
    border-radius: 10px;
    color: white;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-add:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px -5px rgba(34, 197, 94, 0.4);
}

.users-table-wrapper {
    overflow-x: auto;
}

.users-table {
    width: 100%;
    border-collapse: collapse;
}

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

.users-table th {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.users-table tbody tr {
    transition: background 0.2s ease;
}

.users-table tbody tr:hover {
    background: rgba(99, 102, 241, 0.05);
}

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

.users-table .actions {
    display: flex;
    gap: 0.5rem;
}

.btn-edit,
.btn-delete-row {
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-edit:hover {
    background: rgba(99, 102, 241, 0.15);
    border-color: var(--accent);
    color: var(--accent);
}

.btn-delete-row:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: var(--error);
    color: var(--error);
}

/* ===== MODAL ===== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 2rem;
    width: 100%;
    max-width: 420px;
    margin: 1rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: modalSlide 0.3s ease-out;
}

@keyframes modalSlide {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.modal-header h3 {
    font-size: 1.25rem;
}

.modal-close {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.05);
    border: none;
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: rgba(239, 68, 68, 0.15);
    color: var(--error);
}

.modal-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.btn-cancel,
.btn-save,
.btn-delete {
    flex: 1;
    padding: 0.875rem 1.5rem;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-cancel {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
    color: var(--text);
}

.btn-cancel:hover {
    background: rgba(255, 255, 255, 0.1);
}

.btn-save {
    background: linear-gradient(135deg, var(--accent), #a855f7);
    border: none;
    color: white;
}

.btn-save:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px -5px var(--accent-glow);
}

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

.btn-delete:hover {
    background: #dc2626;
    transform: translateY(-2px);
}

/* Delete Modal */
.delete-modal {
    text-align: center;
    max-width: 380px;
}

.delete-text {
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.delete-modal .modal-actions {
    justify-content: center;
}

/* Responsive */
@media (max-width: 768px) {
    .login-card {
        padding: 2rem;
        margin: 1rem;
    }
    
    .navbar {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }
    
    .nav-user {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .welcome-card {
        padding: 1.5rem;
    }
    
    .welcome-icon {
        font-size: 2.5rem;
    }
    
    .users-table-section {
        padding: 1rem;
    }
    
    .users-table th,
    .users-table td {
        padding: 0.75rem 0.5rem;
        font-size: 0.8rem;
    }
    
    .table-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .btn-add {
        width: 100%;
        justify-content: center;
    }
}
