/* --- Modern Design System Variables --- */
:root {
    /* --- Palette: Slate & Royal Blue --- */
    --primary: #2563EB;       /* Royal Blue 600 */
    --primary-hover: #1D4ED8; /* Royal Blue 700 */
    --primary-light: #EFF6FF; /* Blue 50 */
    
    --secondary: #0F172A;     /* Slate 900 */
    --secondary-hover: #1E293B; /* Slate 800 */
    
    --success: #10B981;       /* Emerald 500 */
    --danger: #EF4444;        /* Red 500 */
    --warning: #F59E0B;       /* Amber 500 */
    --info: #3B82F6;          /* Blue 500 */

    /* --- Neutrals --- */
    --bg-body: #F1F5F9;       /* Slate 100 */
    --bg-card: #FFFFFF;
    --bg-subtle: #F8FAFC;     /* Slate 50 */
    
    --text-main: #334155;     /* Slate 700 */
    --text-heading: #1E293B;  /* Slate 800 */
    --text-muted: #64748B;    /* Slate 500 */
    --text-light: #94A3B8;    /* Slate 400 */
    
    --border: #E2E8F0;        /* Slate 200 */
    --border-focus: #2563EB;

    /* --- Effects --- */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -2px rgb(0 0 0 / 0.05);
    
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* --- Global Reset & Typography --- */
body {
    font-family: var(--font-sans) !important;
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--text-heading);
    font-weight: 700;
    letter-spacing: -0.025em;
    margin-bottom: 0.75rem;
}

a {
    color: var(--primary);
    transition: color 0.2s;
    text-decoration: none !important;
}

a:hover {
    color: var(--primary-hover);
}

/* --- Layout --- */
.container-premium {
    max-width: 1280px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

/* --- Components: Buttons --- */
.btn {
    font-weight: 500;
    padding: 0.4rem 1rem;
    font-size: 0.875rem;
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
    border: 1px solid transparent;
    box-shadow: var(--shadow-sm);
    letter-spacing: 0.01em;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ... (rest of btn styles) ... */

/* --- Components: inputs --- */
.form-control, .form-select {
    background-color: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.4rem 0.75rem;
    font-size: 0.875rem;
    color: var(--text-heading);
    transition: all 0.2s;
    box-shadow: var(--shadow-sm);
    min-height: 36px;
    height: 36px !important;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15); /* Primary Ring */
    outline: none;
}

select.form-control, select.form-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23475569' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 12px;
    padding-right: 2.5rem;
    width: 100%; /* Ensure full width of col */
    min-width: 80px; /* Prevent being squeezed too small */
}

label {
    font-weight: 500;
    color: var(--text-main);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    display: block;
}

/* --- Components: Tables --- */
.table-responsive {
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    background: white;
    border: 1px solid var(--border);
    overflow: hidden;
}

.table {
    width: 100%;
    margin-bottom: 0;
    color: var(--text-main);
    border-collapse: separate;
    border-spacing: 0;
}

.table thead th {
    background-color: var(--bg-subtle);
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    border-top: none;
    white-space: nowrap;
}

.table tbody td {
    padding: 1rem 1.5rem;
    vertical-align: middle;
    border-top: 1px solid var(--bg-subtle);
    color: var(--text-heading);
    font-size: 0.925rem;
}

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

.table tbody tr:hover {
    background-color: var(--bg-subtle);
}

/* --- Sidebar --- */
#sidebar {
    background-color: var(--secondary) !important; /* Dark Sidebar */
    color: var(--text-light);
    border-right: none;
    box-shadow: var(--shadow-sm);
    
    /* Full Height Fix */
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    height: 100vh;
    min-height: 100%;
    z-index: 100;
    overflow-y: auto; /* Allow sidebar scrolling */
    padding-bottom: 2rem; /* Space at bottom */
}

/* Scrollbar styling for sidebar */
#sidebar::-webkit-scrollbar {
    width: 6px;
}
#sidebar::-webkit-scrollbar-track {
    background: var(--secondary);
}
#sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

#sidebar .navbar-brand-text {
    color: white !important;
}
#sidebar .navbar-brand-text i {
    color: var(--primary) !important;
}

#sidebar .nav-link-custom {
    color: #94A3B8; /* Slate 400 */
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
    transition: all 0.2s;
}

#sidebar .nav-link-custom:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: white !important;
}

#sidebar .nav-link-custom.active {
    background-color: var(--primary);
    color: white !important;
    box-shadow: var(--shadow-md);
}

#sidebar .nav-link-custom i {
    width: 24px;
    text-align: center;
    color: inherit;
    opacity: 0.8;
}

#sidebar .user-profile-link {
    color: white !important;
}

#sidebar .user-profile-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

#sidebar .custom-border-light {
    border-top-color: rgba(255, 255, 255, 0.1) !important;
    background-color: transparent !important;
}

.dropdown-menu {
    border: none;
    box-shadow: var(--shadow-lg);
    border-radius: var(--radius-lg);
    padding: 0.5rem;
}

.dropdown-item {
    border-radius: var(--radius-sm);
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    color: var(--text-main);
}

.dropdown-item:hover {
    background-color: var(--bg-subtle);
    color: var(--primary);
}

/* --- Global Loader --- */
#global-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    z-index: 10000;
    display: none; /* Forced hide */
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

#global-loader.visible {
    display: flex !important; /* Forced show */
}

.spinner-ring {
    display: inline-block;
    width: 64px;
    height: 64px;
}
.spinner-ring:after {
    content: " ";
    display: block;
    width: 46px;
    height: 46px;
    margin: 8px;
    border-radius: 50%;
    border: 5px solid var(--primary);
    border-color: var(--primary) transparent var(--primary) transparent;
    animation: spinner-ring 1.2s linear infinite;
}
@keyframes spinner-ring {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loader-text {
    margin-top: 1.5rem;
    font-weight: 600;
    color: var(--primary);
    letter-spacing: 0.1em;
    font-size: 0.9rem;
    text-transform: uppercase;
    text-align: center;
    max-width: 400px;
    height: 1.2em;
    position: relative;
    overflow: hidden;
}

.loader-msg-container {
    display: flex;
    flex-direction: column;
    will-change: transform;
}

/* 5-Message Rotation (7s per msg = 35s cycle) */
.rotate-5 {
    animation: slide-5 35s steps(1, end) infinite;
}

/* 4-Message Rotation (7s per msg = 28s cycle) */
.rotate-4 {
    animation: slide-4 28s steps(1, end) infinite;
}

@keyframes slide-5 {
    0%, 19.9% { transform: translateY(0); }
    20%, 39.9% { transform: translateY(-1.2em); }
    40%, 59.9% { transform: translateY(-2.4em); }
    60%, 79.9% { transform: translateY(-3.6em); }
    80%, 100% { transform: translateY(-4.8em); }
}

@keyframes slide-4 {
    0%, 24.9% { transform: translateY(0); }
    25%, 49.9% { transform: translateY(-1.2em); }
    50%, 74.9% { transform: translateY(-2.4em); }
    75%, 100% { transform: translateY(-3.6em); }
}

.loader-msg {
    height: 1.2em;
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

/* --- Utilities --- */
.avatar-placeholder {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    background: linear-gradient(135deg, var(--primary), #3b82f6);
    color: white;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.15);
    border: 2px solid white;
    flex-shrink: 0;
    line-height: normal;
}

.avatar-placeholder.avatar-sm {
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    font-size: 0.8rem;
    border-width: 1.5px;
    box-shadow: 0 2px 5px rgba(37, 99, 235, 0.1);
}

.badge-pill {
    padding: 0.35em 0.8em;
    border-radius: 9999px;
    font-weight: 600;
    font-size: 0.75rem;
}

.bg-soft-primary { background-color: var(--primary-light); color: var(--primary); }
.bg-soft-success { background-color: #ECFDF5; color: var(--success); }
.bg-soft-danger { background-color: #FEF2F2; color: var(--danger); }

.border-bottom-light { border-bottom: 1px solid rgba(0,0,0,0.05); }
.experience-item:last-child { border-bottom: none; }