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

:root {
    /* Subtle, professional light theme */
    --bg-gradient: linear-gradient(135deg, #f0f4f8 0%, #e2e8f0 100%);
    --card-bg: #ffffff;
    --card-border: #e2e8f0;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --accent-color: #2563eb;
    --accent-glow: rgba(37, 99, 235, 0.15);
    --success-color: #059669;
    --success-bg: #d1fae5;
    --error-color: #dc2626;
    --error-bg: #fee2e2;
    --input-bg: #f8fafc;
    --input-border: #cbd5e1;
    --input-focus: #3b82f6;
    --input-focus-glow: rgba(59, 130, 246, 0.15);
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
}

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

/* AUTHENTICATION VIEW DEFAULT */
body {
    background: var(--bg-gradient);
    font-family: var(--font-body);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    position: relative;
}

/* Background animated glow spheres */
body::before, body::after {
    content: '';
    position: absolute;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    filter: blur(100px);
    z-index: -1;
    pointer-events: none;
}

body::before {
    background: #bae6fd;
    opacity: 0.4;
    top: 15%;
    left: 20%;
    animation: float1 15s infinite ease-in-out alternate;
}

body::after {
    background: #e2e8f0;
    opacity: 0.4;
    bottom: 15%;
    right: 20%;
    animation: float2 15s infinite ease-in-out alternate;
}

@keyframes float1 {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(50px, 30px) scale(1.2); }
}

@keyframes float2 {
    0% { transform: translate(0, 0) scale(1.2); }
    100% { transform: translate(-40px, -40px) scale(0.9); }
}

/* Container & Glassmorphism Card (Auth Only) */
.auth-container {
    width: 100%;
    max-width: 440px;
    padding: 20px;
    position: relative;
    z-index: 1;
}

.auth-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 40px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 
                0 2px 4px -1px rgba(0, 0, 0, 0.03);
    animation: fadeIn 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.auth-header h1 {
    font-family: var(--font-heading);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    font-size: 2.2rem;
}

.auth-header p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* Form Styling */
.form-group {
    margin-bottom: 20px;
    position: relative;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.input-wrapper {
    position: relative;
}

.form-input {
    width: 100%;
    padding: 14px 16px;
    font-family: var(--font-body);
    font-size: 0.95rem;
    color: var(--text-primary);
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
}

.input-wrapper .form-input {
    padding-left: 44px;
}

.form-input:focus {
    border-color: var(--input-focus);
    box-shadow: 0 0 0 4px var(--input-focus-glow);
    background: #ffffff;
}

.input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    pointer-events: none;
    transition: color 0.3s ease;
    display: flex;
    align-items: center;
}

.form-input:focus + .input-icon {
    color: var(--input-focus);
}

.toggle-password {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    padding: 0;
    transition: color 0.2s ease;
}

.toggle-password:hover {
    color: var(--accent-color);
}

/* Submit Button */
.btn-submit {
    width: 100%;
    padding: 14px;
    background: var(--accent-color);
    border: none;
    border-radius: 8px;
    color: white;
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    box-shadow: 0 2px 4px var(--accent-glow);
    margin-top: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.btn-submit:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 0.9rem;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid transparent;
}

.alert-success {
    background: var(--success-bg);
    color: var(--success-color);
    border-color: rgba(52, 211, 153, 0.2);
}

.alert-error {
    background: var(--error-bg);
    color: var(--error-color);
    border-color: rgba(248, 113, 113, 0.2);
}

.auth-footer {
    text-align: center;
    margin-top: 25px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.auth-footer a {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
}

/* Legacy Dashboard Card */
.dashboard-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 50px;
    max-width: 600px;
    width: 100%;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    text-align: center;
}


/* ==========================================================================
   PRODUCTION CORE: ENTERPRISE LAYOUT SPECIFICATION OVERRIDES
   ========================================================================== */

/* Overrides the flex centering logic from the login screen */
body.admin-dashboard-layout {
    display: block; 
    background-color: #f1f5f9;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    overflow-x: auto;
}

/* FIXED NAVIGATION SIDEBAR TRACK */
.sidebar-nav {
    width: 260px;
    background-color: #0b1329;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 100;
}

.sidebar-brand {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 700;
    color: #ffffff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand svg {
    color: #3b82f6;
}

.sidebar-menu {
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    color: #94a3b8;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.menu-item:hover, .menu-item.active {
    background-color: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.menu-item.active {
    background-color: #2563eb;
    color: #ffffff;
}

.sidebar-footer {
    padding: 20px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    gap: 12px;
    color: #ffffff;
}

.footer-avatar {
    width: 40px;
    height: 40px;
    background-color: #2563eb;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.footer-user-details {
    display: flex;
    flex-direction: column;
}

.footer-user-details .user-name {
    font-size: 0.9rem;
    font-weight: 600;
}

.footer-user-details .user-role {
    font-size: 0.75rem;
    color: #94a3b8;
}

/* FLUID WORKING COMPARTMENT CONTEXT */
.main-content-wrapper {
    margin-left: 260px;
    padding: 40px;
    width: calc(100% - 260px);
    min-width: 768px; /* Prevents compression on smaller tabs */
}

/* HERO NAVIGATION CONTROLS */
.top-navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.context-breadcrumb {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    font-weight: 600;
    letter-spacing: 0.05em;
}

.context-title {
    font-family: var(--font-heading);
    font-size: 1.75rem;
    font-weight: 700;
    color: #0f172a;
    margin-top: 4px;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 24px;
}

.user-profile-badge {
    text-align: right;
}

.badge-email {
    display: block;
    color: #334155;
    font-weight: 600;
    font-size: 0.9rem;
}

.badge-date {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.btn-action-logout {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background-color: #fee2e2;
    border: 1px solid #fca5a5;
    color: #dc2626;
    padding: 8px 16px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    transition: background 0.2s;
}

.btn-action-logout:hover {
    background-color: #fecaca;
}

/* KPI STATISTICS SYSTEM */
.kpi-metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.metric-card {
    background: #ffffff;
    border: 1px solid var(--card-border);
    padding: 24px;
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.metric-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.metric-value {
    font-family: var(--font-heading);
    font-size: 1.75rem;
    font-weight: 700;
    color: #0f172a;
    margin-top: 4px;
}

.metric-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.blue-glow { background: #eff6ff; color: #3b82f6; }
.amber-glow { background: #fffbeb; color: #d97706; }
.green-glow { background: #f0fdf4; color: #16a34a; }

/* DATA TABLES CONTAINER COMPARTMENT */
.content-table-card {
    background: #ffffff;
    border: 1px solid var(--card-border);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.card-header-panel {
    padding: 24px;
    border-bottom: 1px solid var(--card-border);
}

.panel-heading {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 700;
    color: #0f172a;
}

.panel-subheading {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.table-responsive-container {
    width: 100%;
    overflow-x: auto;
}

/* ENTERPRISE DATAGRID DESIGN */
.enterprise-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    background: #ffffff;
}

.enterprise-table th {
    background-color: #f8fafc;
    padding: 16px 24px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #475569;
    font-weight: 700;
    border-bottom: 1px solid #e2e8f0;
}

.enterprise-table td {
    padding: 18px 24px;
    border-bottom: 1px solid #e2e8f0;
    font-size: 0.92rem;
    color: #334155;
    font-weight: 500;
    vertical-align: middle;
}

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

.enterprise-table tbody tr {
    transition: background-color 0.15s ease;
}

.enterprise-table tbody tr:hover {
    background-color: #f8fafc;
}

/* HIGH DEFINITION VIVID BLUE PROJECT ACTION LINKS */
.project-title-link {
    color: #2563eb;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1.5;
    display: inline-block;
    transition: color 0.1s ease-in-out;
}

.project-title-link:hover {
    color: #1d4ed8;
    text-decoration: underline;
}

/* INSTITUTE FUNDING SPECIFIC TAG */
.funding-tag {
    background-color: #f0fdf4;
    color: #16a34a;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    border: 1px solid #bbf7d0;
    display: inline-block;
    white-space: nowrap;
}

/* STATUS CHIPS */
.badge-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.badge-status.status-pending {
    background-color: #fef3c7;
    color: #d97706;
}
.badge-status.status-pending .status-dot {
    background-color: #d97706;
}

.empty-state-cell {
    text-align: center;
    padding: 48px !important;
    color: var(--text-secondary);
}

/* SCIENTIST & CONTINGENCY TRACKING STYLES */
.badge-user {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 11px;
    background: #f1f5f9;
    color: #1e293b;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.82rem;
    border: 1px solid #cbd5e1;
    white-space: nowrap;
}

.badge-author {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 11px;
    background: #f0f9ff;
    color: #0369a1;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.82rem;
    border: 1px solid #bae6fd;
    white-space: nowrap;
}

.contingency-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.95rem;
    color: #059669;
}

.contingency-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    border: 1px solid #a7f3d0;
    border-radius: 12px;
    padding: 18px 24px;
    margin-bottom: 20px;
    gap: 16px;
    flex-wrap: wrap;
}

.contingency-banner-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.contingency-banner-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: #059669;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 6px -1px rgba(5, 150, 105, 0.25);
}

.contingency-banner-title {
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
    color: #065f46;
}

.contingency-banner-value {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 800;
    color: #047857;
    margin-top: 2px;
}

.progress-bar-container {
    width: 100%;
    max-width: 140px;
    height: 8px;
    background: #e2e8f0;
    border-radius: 999px;
    overflow: hidden;
    margin-top: 4px;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #10b981 0%, #059669 100%);
    border-radius: 999px;
}

.btn-sm-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #334155;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
}

.btn-sm-action:hover {
    background: #f8fafc;
    border-color: #94a3b8;
    color: #0f172a;
}

.btn-sm-primary {
    background: #2563eb;
    color: #ffffff;
    border-color: #1d4ed8;
}

.btn-sm-primary:hover {
    background: #1d4ed8;
    color: #ffffff;
}

/* Modern Assign Button */
.btn-assign-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: #eff6ff;
    color: #2563eb;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
}

.btn-assign-action:hover {
    background: #2563eb;
    color: #ffffff;
    border-color: #2563eb;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
    transform: translateY(-1px);
}

/* DASHBOARD TABS NAVIGATION */
.dashboard-tabs-container {
    margin-bottom: 24px;
    display: flex;
    align-items: center;
}

.dashboard-tabs-nav {
    display: inline-flex;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    padding: 6px;
    border-radius: 14px;
    gap: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}

.dashboard-tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 22px;
    border: 1px solid transparent;
    background: transparent;
    color: #64748b;
    font-family: inherit;
    font-size: 0.92rem;
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
    user-select: none;
}

.dashboard-tab-btn:hover {
    color: #1e293b;
    background: #f8fafc;
}

.dashboard-tab-btn.active#tab-btn-projects {
    background: #2563eb;
    color: #ffffff;
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.25);
    border-color: #1d4ed8;
}

.dashboard-tab-btn.active#tab-btn-projects svg {
    color: #ffffff;
}

.dashboard-tab-btn.active#tab-btn-contingency {
    background: #059669;
    color: #ffffff;
    box-shadow: 0 4px 10px rgba(5, 150, 105, 0.25);
    border-color: #047857;
}

.dashboard-tab-btn.active#tab-btn-contingency svg {
    color: #ffffff;
}

.tab-pill-count {
    background: #f1f5f9;
    color: #475569;
    padding: 2px 9px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 700;
    transition: all 0.2s ease;
}

.dashboard-tab-btn.active .tab-pill-count {
    background: rgba(255, 255, 255, 0.22);
    color: #ffffff;
}

.tab-pill-amount {
    background: #ecfdf5;
    color: #059669;
    border: 1px solid #a7f3d0;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 700;
    transition: all 0.2s ease;
}

.dashboard-tab-btn.active .tab-pill-amount {
    background: rgba(255, 255, 255, 0.22);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.35);
}

.tab-panel-content {
    display: none;
    animation: tabFadeIn 0.2s ease-in-out;
}

.tab-panel-content.active {
    display: block;
}

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

/* DISABLE AUTH GLOW CIRCLES ON DASHBOARD */
body.admin-dashboard-layout::before,
body.admin-dashboard-layout::after {
    display: none !important;
}

/* MODAL DIALOG STYLES */
.modal-overlay {
    display: none !important;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
    z-index: 99999;
    padding: 20px;
    box-sizing: border-box;
}

.modal-overlay.active {
    display: flex !important;
}

.modal-card {
    background: #ffffff;
    border-radius: 16px;
    border: 1px solid var(--card-border);
    width: 100%;
    max-width: 520px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    transform: scale(0.95);
    transition: transform 0.2s ease-in-out;
    overflow: hidden;
}

.modal-overlay.active .modal-card {
    transform: scale(1);
}

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

.modal-title {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-close-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 4px;
    border-radius: 6px;
}

.modal-close-btn:hover {
    background: #f1f5f9;
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--card-border);
    background: #f8fafc;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}