/* ========================================================
   Giga Mall Labor Attendance & Monthly Payment Register
   Custom Styling - Modern Navy, White & Slate Design
   ======================================================== */

:root {
    --primary-navy: #1e3a8a;
    --navy-dark: #0f172a;
    --navy-light: #2563eb;
    --navy-subtle: #eff6ff;
    --bg-main: #f1f5f9;
    --text-primary: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    
    /* Attendance Colors */
    --status-p-bg: #dcfce7;
    --status-p-text: #15803d;
    --status-p-border: #86efac;
    
    --status-a-bg: #fee2e2;
    --status-a-text: #b91c1c;
    --status-a-border: #fca5a5;

    --status-none-bg: #f8fafc;
    --status-none-text: #94a3b8;
    --status-none-border: #cbd5e1;

    /* Payment status colors */
    --pay-unpaid: #ef4444;
    --pay-partial: #f59e0b;
    --pay-paid: #10b981;
}

html, body {
    max-width: 100vw;
    overflow-x: hidden;
    position: relative;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Navbar */
.navbar-custom {
    background: linear-gradient(135deg, var(--navy-dark) 0%, var(--primary-navy) 100%);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.15);
}

.navbar-brand {
    font-weight: 700;
    letter-spacing: 0.5px;
}

.nav-link {
    font-weight: 500;
    color: #cbd5e1 !important;
    transition: all 0.2s ease-in-out;
    padding: 0.5rem 0.85rem !important;
    border-radius: 6px;
}

.nav-link:hover, .nav-link.active {
    color: #ffffff !important;
    background-color: rgba(255, 255, 255, 0.12);
}

/* Cards & Surfaces */
.card-custom {
    background: #ffffff;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.card-header-custom {
    background-color: #ffffff;
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 1.25rem;
    font-weight: 600;
}

/* Stat Cards */
.stat-card {
    border-left: 4px solid var(--primary-navy);
    transition: transform 0.2s, box-shadow 0.2s;
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.08);
}
.stat-card.stat-green { border-left-color: #10b981; }
.stat-card.stat-red { border-left-color: #ef4444; }
.stat-card.stat-amber { border-left-color: #f59e0b; }
.stat-card.stat-indigo { border-left-color: #6366f1; }

/* Status Badges */
.badge-p {
    background-color: var(--status-p-bg);
    color: var(--status-p-text);
    border: 1px solid var(--status-p-border);
    font-weight: 700;
}

.badge-2p {
    background-color: #ede9fe;
    color: #6d28d9;
    border: 1px solid #c4b5fd;
    font-weight: 800;
}

.badge-05p {
    background-color: #e0f2fe;
    color: #0369a1;
    border: 1px solid #7dd3fc;
    font-weight: 700;
}

.badge-a {
    background-color: var(--status-a-bg);
    color: var(--status-a-text);
    border: 1px solid var(--status-a-border);
    font-weight: 700;
}

.badge-none {
    background-color: var(--status-none-bg);
    color: var(--status-none-text);
    border: 1px dashed var(--status-none-border);
    font-weight: 500;
}

.badge-paid {
    background-color: #dcfce7;
    color: #166534;
    border: 1px solid #86efac;
    font-weight: 600;
}

.badge-partial {
    background-color: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
    font-weight: 600;
}

.badge-unpaid {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
    font-weight: 600;
}

/* ========================================================
   Monthly Register Grid Styling (Large 31-day table)
   ======================================================== */
.register-container {
    position: relative;
    overflow-x: auto;
    width: 100%;
    max-width: 100%;
    background: #ffffff;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    -webkit-overflow-scrolling: touch;
}

.register-table {
    margin-bottom: 0;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.85rem;
    width: 100%;
}

.register-table th, .register-table td {
    border: 1px solid #e2e8f0;
    vertical-align: middle;
    text-align: center;
    padding: 4px;
}

.register-table thead th {
    background-color: #1e293b;
    color: #ffffff;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 5;
}

.register-table thead th.day-header {
    min-width: 54px;
    padding: 4px 2px;
}

.register-table thead th.weekend {
    background-color: #334155;
    color: #f87171;
}

/* Sticky Identity Columns for Tablet & Desktop */
.sticky-col-token {
    position: sticky;
    left: 0;
    background-color: #ffffff;
    z-index: 3;
    min-width: 75px;
    text-align: center;
    font-weight: 600;
}
.register-table thead th.sticky-col-token {
    z-index: 7;
    background-color: #1e293b;
}

.sticky-col-diary {
    position: sticky;
    left: 75px;
    background-color: #ffffff;
    z-index: 3;
    min-width: 80px;
    text-align: center;
    font-weight: 500;
}
.register-table thead th.sticky-col-diary {
    z-index: 7;
    background-color: #1e293b;
}

.sticky-col-name {
    position: sticky;
    left: 155px;
    background-color: #ffffff;
    z-index: 3;
    min-width: 160px;
    text-align: left !important;
    padding-left: 8px !important;
    font-weight: 600;
    box-shadow: 2px 0 5px rgba(0,0,0,0.06);
}
.register-table thead th.sticky-col-name {
    z-index: 7;
    background-color: #1e293b;
    box-shadow: 2px 0 5px rgba(0,0,0,0.06);
}

/* Register Row Hover */
.register-table tbody tr:hover td {
    background-color: #f8fafc;
}
.register-table tbody tr:hover .sticky-col-token,
.register-table tbody tr:hover .sticky-col-diary,
.register-table tbody tr:hover .sticky-col-name {
    background-color: #f1f5f9;
}

/* Day Cell Interactive Component */
.day-cell {
    min-width: 54px;
    padding: 3px !important;
}

.att-select {
    width: 100%;
    padding: 2px 1px;
    font-size: 0.8rem;
    font-weight: 700;
    text-align: center;
    border-radius: 4px;
    border: 1px solid #cbd5e1;
    cursor: pointer;
    outline: none;
}
.att-select.val-P {
    background-color: var(--status-p-bg);
    color: var(--status-p-text);
    border-color: var(--status-p-border);
}
.att-select.val-2P {
    background-color: #ede9fe;
    color: #6d28d9;
    border-color: #8b5cf6;
    font-weight: 800;
}
.att-select.val-05P {
    background-color: #e0f2fe;
    color: #0369a1;
    border-color: #38bdf8;
    font-weight: 700;
}
.att-select.val-A {
    background-color: var(--status-a-bg);
    color: var(--status-a-text);
    border-color: var(--status-a-border);
}
.att-select.val-none {
    background-color: #f8fafc;
    color: #94a3b8;
}

.ot-input {
    width: 100%;
    font-size: 0.72rem;
    padding: 1px 2px;
    text-align: center;
    border: 1px solid #e2e8f0;
    border-radius: 3px;
    margin-top: 2px;
}
.ot-input:focus {
    border-color: var(--primary-navy);
    background-color: #eff6ff;
}

/* Summary Columns at Right of Register */
.col-summary {
    min-width: 70px;
    font-weight: 600;
}
.col-summary-grand {
    min-width: 110px;
    font-weight: 700;
    background-color: #f8fafc;
    color: var(--primary-navy);
}

/* Printable Stylesheet */
@media print {
    body {
        background-color: #ffffff;
        color: #000000;
    }
    .no-print, .navbar, .btn, footer, .alert, .mobile-scroll-hint {
        display: none !important;
    }
    .card-custom {
        border: none !important;
        box-shadow: none !important;
    }
    .register-table th, .register-table td {
        border: 1px solid #000000 !important;
        color: #000000 !important;
    }
    .sticky-col-token, .sticky-col-diary, .sticky-col-name {
        position: static !important;
        box-shadow: none !important;
    }
    .badge {
        border: 1px solid #000000 !important;
        color: #000000 !important;
        background: transparent !important;
    }
}

/* ========================================================
   Mobile Responsiveness Optimization (Smartphones & Tablets)
   ======================================================== */
.mobile-scroll-hint {
    display: none;
    font-size: 0.75rem;
    color: var(--text-muted);
    background-color: #f1f5f9;
    padding: 6px 12px;
    border-radius: 6px;
    margin-bottom: 8px;
    border: 1px dashed var(--border-color);
}

@media (max-width: 991.98px) {
    .mobile-scroll-hint {
        display: flex;
        align-items: center;
        justify-content: space-between;
    }
}

@media (max-width: 767.98px) {
    body {
        font-size: 0.88rem;
    }

    .container-fluid {
        padding-left: 8px !important;
        padding-right: 8px !important;
    }

    /* Navbar Mobile Tweaks */
    .navbar-brand .fs-5 {
        font-size: 1.05rem !important;
    }
    .navbar-collapse {
        background: rgba(15, 23, 42, 0.98);
        padding: 12px;
        border-radius: 8px;
        margin-top: 8px;
    }

    /* 
       ON MOBILE PHONES (< 768px):
       Unfreeze Token & Diary so they scroll naturally with the table.
       Keep ONLY Labor Name pinned to the left edge!
       This frees up 70% of the screen width for day cells (1, 2, 3...)!
    */
    .sticky-col-token,
    .sticky-col-diary,
    .register-table thead th.sticky-col-token,
    .register-table thead th.sticky-col-diary {
        position: static !important;
        box-shadow: none !important;
        min-width: 60px !important;
        font-size: 0.75rem !important;
    }

    .sticky-col-name {
        position: sticky !important;
        left: 0 !important;
        z-index: 4 !important;
        min-width: 110px !important;
        max-width: 125px !important;
        font-size: 0.78rem !important;
        padding-left: 6px !important;
        box-shadow: 3px 0 6px rgba(0,0,0,0.12) !important;
        background-color: #ffffff !important;
    }
    .register-table thead th.sticky-col-name {
        position: sticky !important;
        left: 0 !important;
        z-index: 8 !important;
        background-color: #1e293b !important;
        box-shadow: 3px 0 6px rgba(0,0,0,0.12) !important;
    }

    /* Day Cells on Mobile */
    .day-cell {
        min-width: 52px !important;
        padding: 3px 2px !important;
    }

    .att-select {
        font-size: 0.8rem !important;
        padding: 4px 1px !important;
        height: 30px !important;
        min-width: 44px !important;
    }

    .ot-input {
        font-size: 0.75rem !important;
        padding: 3px 2px !important;
        height: 25px !important;
        min-width: 44px !important;
    }

    /* Summary columns compact */
    .col-summary {
        min-width: 62px;
        font-size: 0.75rem;
    }
    .col-summary-grand {
        min-width: 90px;
        font-size: 0.8rem;
    }

    /* Stat Cards padding on Mobile */
    .stat-card {
        padding: 12px !important;
    }
    .stat-card h2, .stat-card h3 {
        font-size: 1.35rem !important;
    }
}


