/* =============================================================
   Kangaroo HR - Admin Dashboard CSS
   Premium Dark Sidebar Layout
   ============================================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    --sidebar-bg: #1c264a;
    --sidebar-hover: #263363;
    --sidebar-active: #3E4B89;
    --sidebar-text: #94a3b8;
    --sidebar-text-active: #ffffff;
    --sidebar-width: 260px;

    --main-bg: #f0f4f8;
    --card-bg: #ffffff;
    --header-bg: #ffffff;

    --primary: #2374ac;
    --primary-light: #3e9ce0;
    --primary-hover: #1b5b88;
    --accent: #FFC822;
    --accent-dark: #dfae1a;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --success: #10b981;
    --warning: #f59e0b;

    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08), 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: 8px;
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Inter', sans-serif;
    background: var(--main-bg);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
}

/* ===== SIDEBAR ===== */
.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0;
    z-index: 1000;
    transition: var(--transition);
    box-shadow: 4px 0 20px rgba(0,0,0,0.15);
}

.sidebar-logo {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-logo img {
    width: 48px; height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary-light);
    flex-shrink: 0;
}

.sidebar-logo-text { flex: 1; overflow: hidden; }
.sidebar-logo-text .brand { color: #fff; font-size: 0.95rem; font-weight: 700; white-space: nowrap; }
.sidebar-logo-text .sub { color: var(--sidebar-text); font-size: 0.72rem; margin-top: 1px; }

.sidebar-badge {
    background: var(--primary-light);
    color: #fff;
    font-size: 0.55rem;
    font-weight: 700;
    padding: 3px 7px;
    border-radius: 20px;
    white-space: nowrap;
}

.sidebar-nav { flex: 1; padding: 16px 12px; overflow-y: auto; }
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }

.nav-label {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #475569;
    padding: 10px 12px 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: var(--transition);
    margin-bottom: 2px;
}

.nav-item:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-text-active);
}

.nav-item.active {
    background: var(--sidebar-active);
    color: var(--sidebar-text-active);
    box-shadow: 0 4px 12px rgba(30,64,175,0.4);
}

.nav-item i {
    width: 20px; font-size: 1rem;
    text-align: center; flex-shrink: 0;
}

.nav-item .badge {
    margin-left: auto;
    background: var(--accent);
    color: var(--text-primary);
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
}

.sidebar-footer {
    padding: 16px 12px;
    border-top: 1px solid rgba(255,255,255,0.06);
}

/* ===== MAIN CONTENT ===== */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ===== TOPBAR ===== */
.topbar {
    background: var(--header-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 0 28px;
    height: 68px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0; z-index: 100;
    box-shadow: var(--shadow-sm);
}

.topbar-left { display: flex; align-items: center; gap: 16px; }
.topbar-title { font-size: 1.2rem; font-weight: 700; color: var(--text-primary); }
.topbar-subtitle { font-size: 0.8rem; color: var(--text-muted); }

.topbar-right { display: flex; align-items: center; gap: 12px; }

.topbar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid var(--border-color);
}
.topbar-user:hover { background: var(--main-bg); }
.topbar-user .avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 700; font-size: 0.85rem;
    flex-shrink: 0;
}
.topbar-user .user-info .name { font-weight: 600; font-size: 0.85rem; }
.topbar-user .user-info .role { color: var(--text-muted); font-size: 0.75rem; }

/* Dropdown Menu Styles */
.topbar-user {
    position: relative;
    padding-right: 28px; /* Room for chevron */
}
.topbar-user::after {
    content: '\f107'; /* FontAwesome chevron-down */
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    right: 12px;
    color: var(--text-muted);
    transition: transform 0.2s ease;
}
.topbar-user.dropdown-open::after {
    transform: rotate(180deg);
}
.user-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--white);
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 25px rgba(0,0,0,0.08);
    border-radius: var(--radius-sm);
    width: 220px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 1000;
    overflow: hidden;
}
.user-dropdown-menu.show {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}
.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    color: var(--text-color);
    text-decoration: none;
    font-size: 0.9rem;
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.15s ease;
    border: none;
    width: 100%;
    background: none;
    text-align: left;
    font-family: inherit;
}
.dropdown-item:last-child {
    border-bottom: none;
}
.dropdown-item:hover {
    background: #f8fafc;
    color: var(--primary-blue);
}
.dropdown-item i {
    width: 16px;
    text-align: center;
    color: var(--text-muted);
}
.dropdown-item:hover i {
    color: var(--primary-blue);
}
.dropdown-item.text-danger:hover {
    background: #fef2f2;
    color: #ef4444;
}
.dropdown-item.text-danger:hover i {
    color: #ef4444;
}

/* ===== PAGE CONTENT ===== */
.page-content { padding: 28px; flex: 1; }

/* ===== STATS CARDS ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 4px; height: 100%;
    background: var(--stat-color, var(--primary));
}
.stat-card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.stat-icon {
    width: 52px; height: 52px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.4rem;
    background: var(--stat-bg, rgba(30,64,175,0.1));
    color: var(--stat-color, var(--primary));
    flex-shrink: 0;
}

.stat-info .value { font-size: 2rem; font-weight: 800; line-height: 1; }
.stat-info .label { font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; font-weight: 500; }

/* ===== CARDS ===== */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

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

.card-title { font-size: 1rem; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.card-title i { color: var(--primary); }

.card-body { padding: 24px; }

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    white-space: nowrap;
    font-family: 'Inter', sans-serif;
    outline: none;
}
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-primary {
    background: var(--primary);
    color: #fff;
}
.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    box-shadow: 0 4px 12px rgba(30,64,175,0.35);
    transform: translateY(-1px);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}
.btn-danger:hover:not(:disabled) {
    background: var(--danger-hover);
    box-shadow: 0 4px 12px rgba(239,68,68,0.35);
}

.btn-secondary {
    background: var(--main-bg);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}
.btn-secondary:hover:not(:disabled) {
    background: #e2e8f0;
    color: var(--text-primary);
}

.btn-success {
    background: var(--success);
    color: #fff;
}
.btn-sm { padding: 7px 12px; font-size: 0.80rem; }

/* ===== FORM ELEMENTS ===== */
.form-group { margin-bottom: 20px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; }

label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}
label span.required { color: var(--danger); margin-left: 3px; }

input[type=text], input[type=email], input[type=number],
input[type=password], select, textarea {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-family: 'Inter', sans-serif;
    color: var(--text-primary);
    background: #fff;
    transition: var(--transition);
    outline: none;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}

input::placeholder, textarea::placeholder { color: var(--text-muted); }
textarea { resize: vertical; min-height: 120px; }

.file-upload-area {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius);
    padding: 32px 20px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: var(--main-bg);
    position: relative;
}
.file-upload-area:hover, .file-upload-area.dragover {
    border-color: var(--primary-light);
    background: rgba(59,130,246,0.04);
}
.file-upload-area input[type=file] {
    position: absolute; inset: 0; opacity: 0; cursor: pointer;
    width: 100%; height: 100%;
}
.file-upload-area .upload-icon {
    font-size: 2.5rem; color: var(--text-muted); margin-bottom: 12px;
}
.file-upload-area .upload-text { color: var(--text-secondary); font-size: 0.9rem; }
.file-upload-area .upload-text span { color: var(--primary); font-weight: 600; }
.file-upload-area .upload-hint { font-size: 0.78rem; color: var(--text-muted); margin-top: 6px; }

.image-preview {
    margin-top: 12px;
    display: none;
}
.image-preview img {
    max-width: 200px;
    max-height: 150px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    border: 2px solid var(--border-color);
}
.image-preview.show { display: block; }

/* ===== TABLE ===== */
.table-wrapper { overflow-x: auto; }

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

thead th {
    background: #f8fafc;
    padding: 12px 16px;
    text-align: left;
    font-weight: 700;
    font-size: 0.78rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border-color);
}

tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
}
tbody tr:hover { background: #f8fafc; }
tbody tr:last-child { border-bottom: none; }

tbody td { padding: 14px 16px; vertical-align: middle; }

.job-img {
    width: 48px; height: 48px;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid var(--border-color);
}
.job-img-placeholder {
    width: 48px; height: 48px;
    border-radius: 8px;
    background: var(--main-bg);
    border: 1px solid var(--border-color);
    display: flex; align-items: center; justify-content: center;
    color: var(--text-muted);
    font-size: 1.2rem;
}

.job-title-cell .title { font-weight: 600; color: var(--text-primary); }
.job-title-cell .location { font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; }

/* ===== BADGES ===== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}
.badge-active { background: rgba(16,185,129,0.12); color: #059669; }
.badge-inactive { background: rgba(148,163,184,0.15); color: #64748b; }
.badge-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ===== ACTION BUTTONS ===== */
.action-group { display: flex; gap: 6px; align-items: center; }

/* ===== SEARCH & FILTER BAR ===== */
.table-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.search-box {
    position: relative;
    flex: 1;
    min-width: 220px;
}
.search-box i {
    position: absolute; left: 12px; top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}
.search-box input {
    padding-left: 38px;
}

/* ===== TOGGLE SWITCH ===== */
.toggle-switch {
    position: relative;
    width: 44px; height: 24px;
    flex-shrink: 0;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
    position: absolute; inset: 0;
    background: #cbd5e1;
    border-radius: 24px;
    cursor: pointer;
    transition: var(--transition);
}
.toggle-slider::before {
    content: '';
    position: absolute;
    width: 18px; height: 18px;
    left: 3px; top: 50%;
    transform: translateY(-50%);
    background: #fff;
    border-radius: 50%;
    transition: var(--transition);
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle-switch input:checked + .toggle-slider { background: var(--success); }
.toggle-switch input:checked + .toggle-slider::before { transform: translate(20px, -50%); }

/* ===== LOGIN PAGE ===== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f1628 0%, #1e3a5f 50%, #0f1628 100%);
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    width: 600px; height: 600px;
    background: radial-gradient(circle, rgba(59,130,246,0.15) 0%, transparent 70%);
    top: -200px; right: -200px;
    pointer-events: none;
}
.login-page::after {
    content: '';
    position: absolute;
    width: 400px; height: 400px;
    background: radial-gradient(circle, rgba(245,158,11,0.08) 0%, transparent 70%);
    bottom: -100px; left: -100px;
    pointer-events: none;
}

.login-card {
    background: rgba(255,255,255,0.04);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 20px;
    padding: 48px 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 25px 60px rgba(0,0,0,0.4);
    position: relative;
    z-index: 1;
}

.login-logo {
    display: flex; align-items: center; gap: 14px;
    margin-bottom: 32px;
}
.login-logo img {
    width: 56px; height: 56px;
    border-radius: 50%;
    border: 2px solid var(--primary-light);
}
.login-logo-text .brand { color: #fff; font-size: 1.1rem; font-weight: 800; }
.login-logo-text .sub { color: rgba(255,255,255,0.5); font-size: 0.75rem; margin-top: 2px; }

.login-card h1 {
    color: #fff;
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 6px;
}
.login-card p { color: rgba(255,255,255,0.5); font-size: 0.875rem; margin-bottom: 28px; }

.login-card label { color: rgba(255,255,255,0.7); }
.login-card input {
    background: rgba(255,255,255,0.07);
    border-color: rgba(255,255,255,0.12);
    color: #fff;
}
.login-card input:focus {
    border-color: var(--primary-light);
    background: rgba(255,255,255,0.1);
}
.login-card input::placeholder { color: rgba(255,255,255,0.3); }

.login-card .btn-primary { width: 100%; justify-content: center; padding: 13px; font-size: 0.95rem; }

.login-error {
    background: rgba(239,68,68,0.15);
    border: 1px solid rgba(239,68,68,0.3);
    color: #fca5a5;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    margin-bottom: 20px;
    display: none;
}
.login-error.show { display: block; }

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}
.empty-state i { font-size: 4rem; color: var(--text-muted); margin-bottom: 16px; opacity: 0.4; }
.empty-state h3 { font-size: 1.1rem; color: var(--text-secondary); margin-bottom: 8px; }
.empty-state p { font-size: 0.875rem; color: var(--text-muted); margin-bottom: 24px; }

/* ===== TOAST NOTIFICATIONS ===== */
.toast-container {
    position: fixed;
    top: 20px; right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: var(--text-primary);
    color: #fff;
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-xl);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.875rem;
    font-weight: 500;
    max-width: 340px;
    animation: toastIn 0.3s ease forwards;
    border-left: 4px solid var(--success);
}
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
.toast.fadeout { animation: toastOut 0.3s ease forwards; }

@keyframes toastIn {
    from { opacity: 0; transform: translateX(100%); }
    to { opacity: 1; transform: translateX(0); }
}
@keyframes toastOut {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(100%); }
}

/* ===== LOADING ===== */
.spinner {
    width: 40px; height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
    position: fixed; inset: 0;
    background: rgba(255,255,255,0.85);
    z-index: 9998;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 16px;
    font-size: 0.9rem; color: var(--text-secondary);
    backdrop-filter: blur(4px);
}

/* ===== MODAL ===== */
.modal-backdrop {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    z-index: 2000;
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
    opacity: 0; visibility: hidden;
    transition: var(--transition);
}
.modal-backdrop.show { opacity: 1; visibility: visible; }

.modal {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-xl);
    padding: 36px;
    max-width: 440px;
    width: 100%;
    transform: scale(0.9);
    transition: var(--transition);
}
.modal-backdrop.show .modal { transform: scale(1); }

.modal-icon { font-size: 3rem; text-align: center; margin-bottom: 16px; }
.modal h3 { font-size: 1.2rem; font-weight: 700; text-align: center; margin-bottom: 10px; }
.modal p { text-align: center; color: var(--text-secondary); font-size: 0.9rem; margin-bottom: 28px; }
.modal-actions { display: flex; gap: 12px; justify-content: center; }

/* ===== QUILL EDITOR OVERRIDES ===== */
.ql-toolbar { border-radius: var(--radius-sm) var(--radius-sm) 0 0 !important; border-color: var(--border-color) !important; }
.ql-container { border-radius: 0 0 var(--radius-sm) var(--radius-sm) !important; border-color: var(--border-color) !important; font-size: 0.9rem !important; font-family: 'Inter', sans-serif !important; }
.ql-editor { min-height: 180px; }
.ql-editor.ql-blank::before { color: var(--text-muted); font-style: normal; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .sidebar { width: 70px; }
    .sidebar-logo-text, .nav-item span, .nav-item .badge, .nav-label, .sidebar-footer { display: none; }
    .sidebar-logo { justify-content: center; padding: 16px; }
    .nav-item { justify-content: center; padding: 12px; }
    .nav-item i { width: auto; }
    .main-content { margin-left: 70px; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .page-content { padding: 16px; }
}
