:root {
    --primary-color: #3083DC;
    /* Sky/Logo Blue */
    --primary-dark: #205c9e;
    --secondary-color: #64748b;
    --background-bg: #e8f0fe;
    --sidebar-bg: #0f172a;
    /* Dark Navy */
    /* Slate 900 */
    --text-main: #334155;
    --text-light: #94a3b8;
    --white: #ffffff;
    --glass-bg: rgba(255, 255, 255, 0.95);
    --glass-border: 1px solid rgba(255, 255, 255, 0.2);
    --danger: #ef4444;
    --success: #22c55e;
    --warning: #f59e0b;

    /* Status Colors */
    --status-pending: #f59e0b;
    /* Amber */
    --status-progress: #3b82f6;
    /* Blue */
    --status-rep-pend: #8b5cf6;
    /* Violet */
    --status-qc: #ec4899;
    /* Pink */
    --status-sub: #10b981;
    /* Emerald */
    --status-closed: #64748b;
    /* Slate */
    --status-withdrawn: #ef4444;
    /* Red */

    --font-family: 'Outfit', sans-serif;
    --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    --radius: 8px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background-color: var(--background-bg);
    color: var(--text-main);
    overflow-x: hidden;
    height: 100vh;
}

/* ================= UTILITIES ================= */
.hidden {
    display: none !important;
}

.full-width {
    width: 100%;
}

.mt-2 {
    margin-top: 0.5rem;
}

.mt-4 {
    margin-top: 1rem;
}

/* ================= AUTH ================= */
.auth-container {
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #0f172a 0%, #3083DC 100%);
}

.login-box {
    background: var(--glass-bg);
    padding: 2.5rem;
    border-radius: 16px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1);
    text-align: center;
}

.logo-area h1 {
    font-weight: 700;
    color: var(--sidebar-bg);
    margin-bottom: 0.2rem;
}

.logo-area p {
    color: var(--secondary-color);
    margin-bottom: 2rem;
    font-weight: 300;
}

.input-group {
    position: relative;
    margin-bottom: 1.25rem;
}

.input-group i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--secondary-color);
}

.input-group input {
    width: 100%;
    padding: 0.85rem 1rem 0.85rem 2.8rem;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius);
    outline: none;
    transition: all 0.3s;
    font-family: inherit;
}

.input-group input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.85rem 1.5rem;
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 500;
    width: 100%;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
}

.btn-danger {
    background-color: var(--danger);
    color: white;
    border: none;
    padding: 0.85rem 1.5rem;
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-danger:hover {
    background-color: #991b1b;
}

.error-msg {
    color: var(--danger);
    font-size: 0.875rem;
    margin-top: 1rem;
    min-height: 1.25rem;
}

/* ================= APP LAYOUT ================= */
.app-container {
    display: flex;
    height: 100vh;
}

/* SIDEBAR */
.sidebar {
    width: 260px;
    background: linear-gradient(135deg, #0f172a 0%, #3083DC 100%);
    color: var(--white);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.badg-role {
    font-size: 0.75rem;
    background: rgba(255, 255, 255, 0.1);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sidebar-nav {
    flex: 1;
    padding: 1.5rem 0;
    overflow-y: auto;
}

.sidebar-nav ul {
    list-style: none;
}

.small-form {
    padding: 2.5rem !important;
    margin: 2rem auto;
    max-width: 600px;
}

#case-fio {
    background-color: transparent;
    color: var(--text-main);
}

#case-fio option[value=""] {
    background-color: var(--primary-color);
    color: white;
    padding: 0.5rem;
}

.nav-item {
    padding: 0.85rem 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    color: #94a3b8;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    color: var(--white);
    background: rgba(255, 255, 255, 0.05);
}

.nav-item.active {
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary-color);
    border-left-color: var(--primary-color);
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.user-info {
    font-size: 0.8rem;
    color: #94a3b8;
    margin-bottom: 0.5rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#logout-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #cbd5e1;
    width: 100%;
    padding: 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    transition: 0.2s;
}

#logout-btn:hover {
    border-color: var(--danger);
    color: var(--danger);
}

/* MAIN CONTENT */
.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    background: var(--background-bg);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.section-header h2 {
    font-size: 1.8rem;
    font-weight: 600;
    color: #0f172a;
}


/* VIEW SWITCHING LOGIC */
.view-section {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

.view-section.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* DASHBOARD CARDS */
.status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.status-card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    border-left: 4px solid #ccc;
    transition: transform 0.2s;
}

.status-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.status-card h3 {
    font-size: 0.8rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.status-card .count {
    font-size: 2rem;
    font-weight: 700;
    color: #0f172a;
}

/* Card Accent Colors */
.c-pending {
    border-left-color: var(--status-pending);
}

.c-progress {
    border-left-color: var(--status-progress);
}

.c-rep-pending {
    border-left-color: var(--status-rep-pend);
}

.c-qc {
    border-left-color: var(--status-qc);
}

.c-submitted {
    border-left-color: var(--status-sub);
}

.c-closed {
    border-left-color: var(--status-closed);
}

.c-withdrawn {
    border-left-color: var(--status-withdrawn);
}

/* TABLES & PANELS */
.glass-panel {
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
}

.table-controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.search-input {
    flex: 1;
    min-width: 200px;
    padding: 0.6rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    outline: none;
}

select {
    padding: 0.6rem 2rem 0.6rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    outline: none;
    background-color: white;
    cursor: pointer;
}

.btn-icon {
    padding: 0.6rem;
    border: 1px solid #e2e8f0;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    color: #64748b;
}

.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    white-space: nowrap;
}

th,
td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
    max-width: 12rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

th {
    background-color: #f8fafc;
    font-weight: 600;
    color: #475569;
    font-size: 0.85rem;
    text-transform: uppercase;
}

/* Table Condensed View */
.table-condensed th,
.table-condensed td {
    padding: 0.4rem 0.6rem !important;
    font-size: 0.85rem !important;
}

.table-condensed tr:hover {
    background-color: #f8fafc;
}

/* FORMS */
.form-wrapper {
    max-width: 800px;
}

.form-row {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.form-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.form-group label,
.col label {
    font-size: 0.9rem;
    font-weight: 500;
    color: #334155;
}

.form-group input,
.form-group select,
.col input,
.col select,
.col textarea {
    padding: 0.75rem;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    outline: none;
    transition: 0.2s;
    width: 100%;
}

.form-group input:focus,
.form-group select:focus {
    border-color: var(--primary-color);
}

.ref-preview {
    background: #f1f5f9;
    padding: 0.75rem;
    border-radius: 6px;
    font-family: monospace;
    font-weight: 600;
    color: var(--primary-dark);
    letter-spacing: 1px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2rem;
}

.btn-secondary {
    background: transparent;
    border: 1px solid #cbd5e1;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius);
    cursor: pointer;
    color: #64748b;
}

/* MODALS */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    width: 90%;
    max-width: 700px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: var(--shadow-lg);
}

.close-modal {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    font-size: 1.5rem;
    cursor: pointer;
    color: #64748b;
}

.row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.col {
    flex: 1;
}

/* RESPONSIVE */
@media (max-width: 768px) {

    .sidebar {
        width: 100%;
        height: auto;
    }

    /* Show Toggle Button */
    #mobile-menu-toggle {
        display: block !important;
    }

    .sidebar-nav {
        display: none;
        animation: fadeIn 0.3s ease;
    }

    .sidebar-nav.open {
        display: block;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        padding-top: 1rem;
    }

    /* Mobile Menu interaction */
    .form-row,
    .row {
        flex-direction: column;
        gap: 1rem;
    }

    /* Stack Details */
    .detail-grid {
        grid-template-columns: 1fr !important;
    }

    /* Adjust 3-col grid */
    .case-detail-grid-3 {
        grid-template-columns: 1fr !important;
    }
}


/* Reduced Font Size for Cases Table */
#cases-table th,
#cases-table td,
#tat-cases-table th,
#tat-cases-table td {
    padding: 0.6rem;
    font-size: 0.8rem;
}

#cases-table .btn-icon {
    padding: 0.4rem;
    font-size: 0.8rem;
}

/* Detail View Grids */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 1rem;
}

.detail-grid p {
    font-size: 0.95rem;
    color: #334155;
    margin-bottom: 0.5rem;
}

.detail-grid strong {
    color: #64748b;
    font-weight: 500;
}

.form-group textarea {
    padding: 0.75rem;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    outline: none;
    transition: 0.2s;
    width: 100%;
}

.form-group textarea:focus {
    border-color: var(--primary-color);
}

.btn-sm {
    padding: 0.5rem 1rem !important;
    font-size: 0.85rem !important;
    width: auto !important;
}

.logo-login {
    width: 100px;
    margin-bottom: 1rem;
}

.logo-sidebar {
    width: 32px;
    height: auto;
}

.mt-large {
    margin-top: 2rem;
}

#refresh-dashboard:hover i {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.small-form h3 {
    margin-bottom: 2.5rem;
}

.form-group {
    margin-bottom: 2rem !important;
}

tbody tr:hover {
    background-color: rgba(59, 130, 246, 0.1) !important;
}

::selection {
    background-color: rgba(59, 130, 246, 0.2);
    color: inherit;
}

/* Status Badges */
.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 500;
    display: inline-block;
}

.status-badge.active {
    background-color: #dcfce7;
    color: #166534;
    /* Green */
}

.status-badge.resigned {
    background-color: #fee2e2;
    color: #991b1b;
    /* Red */
}

.status-badge.notice-period {
    background-color: #ffedd5;
    color: #9a3412;
    /* Orange for Notice Period */
}

.status-badge.temporary {
    background-color: #e0f2fe;
    color: #075985;
    /* Blue for Temporary */
}

/* CASE DETAILS 3-COLUMN GRID */
.case-detail-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    padding: 1rem;
}

@media (max-width: 1024px) {
    .case-detail-grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }
}


/* ================= NEW FEATURES (DEMO) ================= */

/* WhatsApp Button */
.btn-whatsapp {
    background-color: #25D366;
    color: white;
    border: none;
    padding: 0.85rem 1.5rem;
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-whatsapp:hover {
    background-color: #128C7E;
}

/* Timeline */
/* Timeline (Horizontal) */
.timeline-box {
    position: relative;
    display: flex;
    justify-content: space-between;
    padding-top: 20px;
    margin-top: 1rem;
    border-left: none;
    padding-left: 0;
    margin-left: 0;
}

.timeline-item {
    position: relative;
    flex: 1;
    text-align: center;
    margin-bottom: 0;
}

/* Connecting Line */
.timeline-item:not(:first-child)::before {
    content: '';
    position: absolute;
    top: 6px;
    /* Center of dot */
    right: 50%;
    width: 100%;
    height: 2px;
    background-color: #e2e8f0;
    z-index: 0;
}

.timeline-dot {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: white;
    border: 2px solid var(--primary-color);
    z-index: 1;
}

.timeline-dot.completed {
    background: var(--primary-color);
}

.timeline-content {
    margin-top: 20px;
}

/* REPORT FORM PAPER LAYOUT */
.report-paper {
    background: white;
    width: 210mm;
    min-height: 297mm;
    margin: 20px auto;
    padding: 20mm;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    color: black;
    font-family: 'Times New Roman', Times, serif;
    /* Classic Report Font */
}

.report-paper h2,
.report-paper h3,
.report-paper h4 {
    text-align: center;
    text-transform: uppercase;
    margin-bottom: 15px;
    color: black;
}

.report-paper table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 15px;
    font-size: 14px;
}

.report-paper th,
.report-paper td {
    border: 1px solid black;
    padding: 6px;
    vertical-align: top;
}

.report-paper th {
    background-color: #f0f0f0;
    font-weight: bold;
    text-align: left;
}

.report-paper input,
.report-paper textarea,
.report-paper select {
    width: 100%;
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
    outline: none;
    padding: 2px 5px;
}

.report-paper input:focus,
.report-paper textarea:focus {
    background: #eefbff;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.report-paper td {
    vertical-align: middle;
}

.report-paper textarea {
    min-height: 24px;
    line-height: 1.5;
}

/* Specific alignments for labels */
.report-paper td:first-child {
    vertical-align: top;
    padding-top: 8px;
}

.header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* Compact Table for DL Details */
.compact-table td {
    padding: 3px !important;
    font-size: 13px;
}

.compact-table input {
    font-size: 13px;
}

.compact-table td:nth-child(odd) {
    /* Labels */
    background: #f9f9f9;
    font-weight: 500;
    white-space: nowrap;
    width: 1%;
    /* Shrink to fit text */
}

.compact-table td:nth-child(even) {
    /* Inputs */
    width: auto;
    /* Take remaining space */
}

.report-paper input:focus,
.report-paper textarea:focus {
    background: #eef;
}

.report-section-title {
    background: #ddd;
    font-weight: bold;
    padding: 5px;
    border: 1px solid black;
    margin-top: 20px;
    margin-bottom: 5px;
}

@media print {
    body * {
        visibility: hidden;
    }

    #report-form-view,
    #report-form-view * {
        visibility: visible;
    }

    #report-form-view {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        margin: 0;
        padding: 0;
    }

    .no-print {
        display: none !important;
    }
}

.timeline-content h4 {
    font-size: 0.8rem;
    color: var(--text-main);
    margin-bottom: 0.1rem;
    font-weight: 600;
}

.timeline-content span {
    font-size: 0.75rem;
    color: var(--text-light);
    display: block;
}