/* ===== RESET & BASE ===== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --primary: #4F46E5;
    --primary-dark: #4338CA;
    --primary-light: #818CF8;
    --success: #10B981;
    --danger: #EF4444;
    --warning: #F59E0B;
    --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;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
    --radius: 12px;
    --radius-sm: 6px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--gray-50);
    color: var(--gray-800);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    text-decoration: none;
    color: inherit;
}

/* ===== TOPBAR ===== */
.topbar {
    background: var(--gray-900);
    color: #fff;
    padding: 12px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-lg);
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-user .avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    color: #fff;
}

.topbar-user .user-name {
    font-weight: 600;
    color: #fff;
}

.topbar-user .user-role {
    font-size: 12px;
    color: var(--gray-400);
    background: var(--gray-700);
    padding: 2px 10px;
    border-radius: 20px;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.topbar-actions .btn {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    transition: var(--transition);
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.topbar-actions .btn-outline {
    background: transparent;
    color: var(--gray-300);
    border: 1px solid var(--gray-600);
}

.topbar-actions .btn-outline:hover {
    background: var(--gray-700);
    color: #fff;
}

.topbar-actions .btn-danger {
    background: var(--danger);
    color: #fff;
}

.topbar-actions .btn-danger:hover {
    background: #DC2626;
}

/* ===== CONTAINER ===== */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 24px 32px 48px;
}

/* ===== PAGE HEADER ===== */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
    flex-wrap: wrap;
    gap: 16px;
}

.page-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--gray-900);
    letter-spacing: -0.5px;
}

.page-header h1 span {
    color: var(--primary);
}

.page-header .subtitle {
    font-size: 14px;
    color: var(--gray-500);
    font-weight: 400;
    display: block;
    margin-top: 2px;
}

/* ===== CARDS ===== */
.card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 24px;
    border: 1px solid var(--gray-200);
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-lg);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--gray-200);
}

.card-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--gray-800);
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-header h2 .badge {
    font-size: 11px;
    background: var(--primary);
    color: #fff;
    padding: 2px 10px;
    border-radius: 20px;
    font-weight: 500;
}

/* ===== FORM ===== */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.form-group label {
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-700);
}

.form-group label .required {
    color: var(--danger);
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 10px 14px;
    border: 1.5px solid var(--gray-300);
    border-radius: var(--radius-sm);
    font-size: 14px;
    transition: var(--transition);
    background: #fff;
    color: var(--gray-800);
    width: 100%;
}

.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(79, 70, 229, 0.15);
}

.form-group input::placeholder {
    color: var(--gray-400);
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.btn {
    padding: 10px 24px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.btn-success {
    background: var(--success);
    color: #fff;
}

.btn-success:hover {
    background: #059669;
    transform: translateY(-1px);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-danger:hover {
    background: #DC2626;
    transform: translateY(-1px);
}

.btn-warning {
    background: var(--warning);
    color: #fff;
}

.btn-warning:hover {
    background: #D97706;
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    color: var(--gray-600);
    border: 1.5px solid var(--gray-300);
}

.btn-outline:hover {
    background: var(--gray-100);
    border-color: var(--gray-400);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 12px;
}

.btn-block {
    width: 100%;
    justify-content: center;
}

/* ===== TABLE ===== */
.table-responsive {
    overflow-x: auto;
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.table thead {
    background: var(--gray-800);
}

.table thead th {
    color: #fff;
    padding: 14px 18px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.table tbody tr {
    border-bottom: 1px solid var(--gray-200);
    transition: var(--transition);
}

.table tbody tr:last-child {
    border-bottom: none;
}

.table tbody tr:hover {
    background: var(--gray-50);
}

.table tbody td {
    padding: 14px 18px;
    vertical-align: middle;
}

.table tbody td .status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.table tbody td .status-active {
    background: #D1FAE5;
    color: #065F46;
}

.table tbody td .status-inactive {
    background: #FEE2E2;
    color: #991B1B;
}

.table tbody td .status-pending {
    background: #FEF3C7;
    color: #92400E;
}

.table .actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.table .actions .btn-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.table .actions .btn-edit {
    background: #EBF5FF;
    color: #1D4ED8;
}

.table .actions .btn-edit:hover {
    background: #BFDBFE;
}

.table .actions .btn-delete {
    background: #FEE2E2;
    color: #DC2626;
}

.table .actions .btn-delete:hover {
    background: #FCA5A5;
}

/* ===== LOGIN ===== */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #EEF2FF 0%, #E0E7FF 100%);
    padding: 20px;
}

.login-card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow-xl);
    padding: 40px 48px;
    width: 100%;
    max-width: 420px;
}

.login-card .logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-card .logo h1 {
    font-size: 28px;
    font-weight: 800;
    color: var(--gray-900);
}

.login-card .logo h1 span {
    color: var(--primary);
}

.login-card .logo p {
    color: var(--gray-500);
    font-size: 14px;
    margin-top: 4px;
}

.login-card .form-group {
    margin-bottom: 16px;
}

.login-card .form-group label {
    font-weight: 500;
}

.login-card .btn-primary {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    margin-top: 8px;
}

.login-card .error-message {
    background: #FEE2E2;
    color: #991B1B;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.login-card .success-message {
    background: #D1FAE5;
    color: #065F46;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ===== MODAL ===== */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal-overlay.open {
    display: flex;
}

.modal-box {
    background: #fff;
    border-radius: var(--radius);
    padding: 32px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-xl);
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-box h3 {
    font-size: 20px;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 8px;
}

.modal-box p {
    color: var(--gray-500);
    font-size: 14px;
    margin-bottom: 20px;
}

.modal-box .form-group {
    margin-bottom: 16px;
}

.modal-box .modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 8px;
}

.modal-box .modal-actions .btn {
    flex: 1;
}

/* ===== REVEAL BUTTON ===== */
.reveal-bar {
    text-align: center;
    margin: 16px 0 24px;
}

.reveal-bar .btn-reveal {
    padding: 10px 28px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    background: var(--primary);
    color: #fff;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.reveal-bar .btn-reveal:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.reveal-bar .btn-reveal.active {
    background: var(--gray-600);
}

.reveal-bar .btn-reveal.active:hover {
    background: var(--gray-700);
}

.reveal-bar .reveal-error {
    color: var(--danger);
    font-size: 13px;
    margin-top: 8px;
}

/* ===== TOAST / ALERT ===== */
.toast {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 2000;
    padding: 16px 24px;
    border-radius: var(--radius-sm);
    color: #fff;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease;
    max-width: 400px;
}

.toast-success {
    background: var(--success);
}

.toast-error {
    background: var(--danger);
}

.toast-warning {
    background: var(--warning);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(40px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .topbar {
        padding: 10px 16px;
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    
    .topbar-user {
        justify-content: center;
    }
    
    .topbar-actions {
        justify-content: center;
    }
    
    .container {
        padding: 16px;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .page-header h1 {
        font-size: 22px;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .login-card {
        padding: 28px 20px;
    }
    
    .table thead th,
    .table tbody td {
        padding: 10px 12px;
        font-size: 13px;
    }
    
    .modal-box {
        padding: 24px 20px;
    }
    
    .modal-box .modal-actions {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .topbar-actions .btn {
        font-size: 12px;
        padding: 6px 12px;
    }
    
    .table .actions {
        flex-direction: column;
    }
    
    .table .actions .btn-icon {
        width: 100%;
    }
}