﻿:root {
    --vh: 1vh;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background-color: #f7f7f7;
}

.container {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 250px;
    height: 100%;
    padding: 0;
    background-color: #003278;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
    color: silver;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.sidebar-top {
    padding: 20px;
}

.sidebar h2 {
    margin-top: 0;
}

.sidebar label,
.sidebar select,
.sidebar input,
.sidebar button {
    display: block;
    margin-bottom: 15px;
    width: 100%;
    box-sizing: border-box;
}

    .sidebar select:focus {
        border: 2px solid #007bff;
        background-color: #fff;
        z-index: 2;
        position: relative;
        outline: none;
        box-shadow: 0 0 6px rgba(0, 123, 255, 0.4);
    }

.sidebar-bottom-buttons {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-top: auto;
}

    .sidebar-bottom-buttons button {
        width: 100%;
        padding: 14px;
        font-weight: bold;
        border: none;
        border-radius: 0;
        color: white;
        cursor: pointer;
    }

    .sidebar-bottom-buttons button {
        margin-bottom: 0 !important;
    }

#submit-week {
    background-color: #007bff;
}

    #submit-week:hover {
        background-color: #0056b3;
    }

.submitted-week {
    background-color: dimgray;
    pointer-events: none;
    opacity: 0.6;
}

#logout-btn {
    background-color: silver;
}

    #logout-btn:hover {
        background-color: #78706E;
    }

/* Category Actions */
.category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

    .category-header label {
        font-weight: bold;
    }

.category-actions {
    display: flex;
    gap: 10px;
}

    .category-actions button {
        padding: 0;
        font-size: 1.25rem;
        background: transparent;
        border: none;
        color: #A5ACAF;
        cursor: pointer;
        transition: transform 0.1s ease, color 0.2s ease;
    }

        .category-actions button:hover,
        .category-actions button:focus {
            color: #8f949a;
            transform: scale(1.2);
            outline: none;
        }

        .category-actions button:active {
            color: #6d7278;
            transform: scale(1.1);
        }

/* Calendar Container */
.calendar-container {
    display: flex;
    width: 100%;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
    background-image: url("../images/att-stadium-dallas-cowboys-color-robert-hayton.jpg");
    background-repeat: no-repeat;
    background-size: cover;
}

#calendar-desktop {
    width: 80%;
    max-width: 1150px;
    min-height: 90%;
    height: auto;
    border: 1px solid #ccc;
    background: white;
    padding: 0 20px 0px 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    opacity: 0.95;
    position: relative;
    overflow: visible;
    display: flex;
    flex-direction: column;
}

/* Table Layout */
table {
    width: 100%;
    height: 90%;
    table-layout: fixed;
    background-color: #ffffff;
    border-collapse: collapse;
    border-spacing: 0;
}

tr.month-header {
    height: 1rem;
}

tr.month-days {
    height: 5rem;
}

/* Day Cells */
td {
    position: relative;
    text-align: center;
    vertical-align: top;
    width: 14.28%;
    max-width: 100px;
    overflow-y: auto;
    outline: 1px solid #dfe3e8;
    z-index: 1;
    padding: 0;
    border: none;
}

    td.outside-month {
        background-color: #f0f0f0;
        color: #999;
    }

#today {
    outline: solid 2px #007bff;
    z-index: 2;
}

.calendar-day:hover {
    background-color: lightblue;
    cursor: pointer;
}

.calendar-day.selected {
    outline: 3px solid orange;
    z-index: 5;
}

/* Calendar Icons */
.calendar-icon {
    position: absolute;
    z-index: 3;
    font-weight: bold;
    pointer-events: auto;
    cursor: pointer;
}

    .calendar-icon.payday {
        right: 4px;
        top: 2px;
        text-align: right;
        color: #85bb65;
        font-size: 0.85rem;
    }

    .calendar-icon.deadline {
        right: 4px;
        top: 2px;
        color: crimson;
        font-size: 0.75rem;
    }

/* Calendar Bars */
.calendar-bar {
    display: block;
    width: 100%;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    background-color: #cce5ff;
    padding: 2px 4px;
    border-radius: 4px;
    font-size: 0.75rem;
    color: white;
    box-sizing: border-box;
    position: relative;
    z-index: 2;
}

    .calendar-bar.selected {
        outline: 2px solid red;
        z-index: 3;
    }

    .calendar-bar:hover::after {
        content: attr(data-fulltext);
        position: absolute;
        top: -1.8rem;
        left: 0;
        white-space: nowrap;
        background: #333;
        color: #fff;
        padding: 4px 8px;
        font-size: 0.75rem;
        border-radius: 4px;
        z-index: 10;
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
        opacity: 1;
        pointer-events: none;
        transition: opacity 0.2s;
    }

    .calendar-bar::after {
        opacity: 0;
    }

.week-highlight-hover {
    background-color: rgba(0, 128, 255, 0.2);
    transition: background-color 0.2s ease;
}

/* HOLIDAY Styling */
.holiday-day {
    background-color: rgba(0, 53, 148, 0.15);
}

    .holiday-day .pto-hours {
        color: green;
    }

/* PTO Styling */
.pto-top {
    position: absolute;
    top: auto;
    bottom: 2px;
    right: 4px;
    font-size: 0.5rem;
    color: #555;
    background-color: #f0f0f0;
    padding: 1px 4px;
    border-radius: 4px;
    z-index: 1;
}

.pto-day {
    background-color: rgba(75, 0, 130, 0.15);
}

.pto-hours {
    position: absolute;
    top: auto;
    bottom: 2px;
    left: 4px;
    font-size: 0.5rem;
    font-weight: bold;
    color: #800080;
    background-color: transparent;
    padding: 1px 4px;
    z-index: 1;
}

/* Calendar Navigation */
.month-navigation {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5rem;
    margin: 0 auto 1rem auto;
    height: 2.5rem;
    max-width: fit-content;
    position: relative;
}

.month-header {
    margin: 0;
    font-size: 1.5rem;
    white-space: nowrap;
    z-index: 1;
    position: relative;
}

.nav-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: transparent;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    width: 2rem;
    height: 2rem;
    z-index: 2;
}

    .nav-arrow.left {
        left: 0;
    }

    .nav-arrow.right {
        right: 0;
    }

/* Week Outline Box */
.week-outline {
    position: absolute;
    z-index: 1;
    pointer-events: none;
    box-sizing: border-box;
    background-size: auto;
}

.pay-period {
    outline: 2px solid #85bb65;
}

.week-outline-container {
    position: relative;
    height: 100%;
}

/* Week Selector Message */
.week-select-message {
    height: 1.5rem;
    text-align: center;
    font-weight: bold;
    color: #4a4a4a;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 1;
}

#submit-week-desktop {
    background-color: #007bff;
}


    #submit-week-desktop:hover {
        background-color: #0056b3;
    }


    #submit-week-desktop.full-width {
        width: 100%;
        font-size: 1rem;
        padding: 0.6rem;
        border: none;
        border-radius: 4px;
        background-color: #007bff;
        color: white;
        font-weight: bold;
        cursor: pointer;
    }


        #submit-week-desktop.full-width:hover {
            background-color: #0056b3;
        }


#logout-btn-desktop {
    background-color: silver;
}


    #logout-btn-desktop:hover {
        background-color: #78706E;
    }

/* ========================== MOBILE OVERRIDES ========================== */
.top-bar,
.mobile-menu,
.entry-section,
.day-popup,
.submit-container,
.mobile-calendar,
.entry-toggle {
    display: none;
}

@media (max-width: 768px) {
    #submit-week-mobile {
        background-color: #007bff;
    }

        #submit-week-mobile:hover {
            background-color: #0056b3;
        }

        #submit-week-mobile.full-width {
            width: 100%;
            font-size: 1rem;
            padding: 0.6rem;
            border: none;
            border-radius: 4px;
            background-color: #007bff;
            color: white;
            font-weight: bold;
            cursor: pointer;
        }

            #submit-week-mobile.full-width:hover {
                background-color: #0056b3;
            }

    #logout-btn-mobile {
        background-color: silver;
    }

        #logout-btn-mobile:hover {
            background-color: #78706E;
        }

    /* ========== Layout ========== */
    html, body {
        overflow-x: hidden;
        height: auto;
        overflow-y: auto;
    }

    body {
        height: calc(var(--vh, 1vh) * 100);
        display: flex;
        flex-direction: column;
    }

    .container,
    .week-select-message,
    #prev-month,
    #next-month,
    thead {
        display: none;
    }

    /* ========== Top Bar & Menu ========== */
    .top-bar {
        display: flex;
        justify-content: space-between;
        align-items: center;
        background-color: #003278;
        color: white;
        padding: 1rem;
    }

        .top-bar h1 {
            font-size: 1.25rem;
            margin: 0;
            white-space: nowrap;
        }

    .hamburger {
        background: none;
        border: none;
        color: white;
        font-size: 1.75rem;
        cursor: pointer;
    }

    .mobile-menu {
        display: flex;
        flex-direction: column;
        background-color: #003278;
        padding: 1rem;
        gap: 0.5rem;
        transition: max-height 0.3s ease;
        max-height: 100px;
        overflow: hidden;
    }

        .mobile-menu.hidden {
            display: none;
            max-height: 0;
            padding: 0;
        }

    /* ========== Entry Section ========== */
    .entry-section {
        height: auto;
        padding: 0.75rem 1rem 0;
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
        background: #f0f4f8;
        border-top: 1px solid #ccc;
        overflow-x: hidden;
    }

        .entry-section.hidden {
            display: none;
        }

        .entry-section .form-row {
            display: flex;
            flex-wrap: wrap;
            align-items: center;
        }

            .entry-section .form-row label {
                width: 30%;
                min-width: 80px;
                font-size: 0.85rem;
                font-weight: 500;
                color: #003278;
                margin-bottom: 0;
                white-space: nowrap;
            }

            .entry-section .form-row select,
            .entry-section .form-row input {
                flex: 1;
                width: 100%;
                max-width: 100%;
                font-size: clamp(0.85rem, 2.5vw, 1rem);
                padding: clamp(0.25rem, 2vw, 0.25rem);
                border: 1px solid #aaa;
                border-radius: 4px;
                box-sizing: border-box;
            }

        .entry-section .button-row {
            display: flex;
            justify-content: space-between;
            gap: 1rem;
        }

            .entry-section .button-row button {
                flex: 1;
            }

    .entry-toggle {
        display: flex;
        justify-content: center;
        padding: 0.5rem;
        background-color: #f0f4f8;
    }

    #toggle-entry-btn {
        width: 100%;
        background: none;
        border: none;
        font-size: 1rem;
        font-weight: bold;
        color: #003278;
        cursor: pointer;
        display: flex;
        justify-content: center;
    }

    #entry-caret {
        font-size: 1.2rem;
        transition: transform 0.2s ease;
    }

    /* ========== Role-Based Category Layout ========== */
    .form-row.category-row {
        display: flex;
        flex-wrap: nowrap;
        justify-content: space-between;
        align-items: center;
        gap: 0.5rem;
    }

        .form-row.category-row.admin {
            flex-wrap: wrap !important; /* admin override */
        }

    .category-header-wrapper {
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
    }

    .category-actions {
        display: flex;
        gap: 0.5rem;
    }

    #category-list-mobile {
        flex: 1 1 auto;
        min-width: 0;
        width: 100%;
        min-width: 70%;
    }

    /* ========== Submit Week Button (outside entry-section) ========== */
    .submit-container {
        background-color: #f0f4f8;
        padding: 0rem 1rem 0rem 1rem;
        display: flex;
    }

    #submit-week.full-width {
        width: 100%;
        font-size: 1rem;
        padding: 0.6rem;
        border: none;
        border-radius: 4px;
        background-color: #007bff;
        color: white;
        font-weight: bold;
        cursor: pointer;
    }

        #submit-week.full-width:hover {
            background-color: #0056b3;
        }

    /* ========== Calendar ========== */
    #calendar-mobile {
        flex-grow: 1;
        min-height: 0;
        height: auto;
        width: 100%;
        display: flex;
        flex-direction: column;
    }

    .calendar-container.mobile-calendar {
        flex-grow: 1;
        display: flex;
        flex-direction: column;
        height: 100%;
        min-height: 0;
        padding: 2px;
        overflow-y: visible;
    }

    .calendar-container {
        flex: 1;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        padding: 0;
        box-sizing: border-box;
        width: 100%;
        background-image: none;
        background-color: #f0f4f8;
        position: relative;
        overflow: hidden;
    }

    .week-outline-container {
        height: 100%;
    }

    .month-navigation,
    .month-header {
        font-size: 1rem;
        padding: 0;
        margin: auto;
        text-align: left;
    }

    .month-popup {
        position: absolute;
        top: 3.5rem;
        left: 50%;
        transform: translateX(-50%);
        background: white;
        border: 1px solid #ccc;
        border-radius: 8px;
        box-shadow: 0 2px 10px rgba(0,0,0,0.15);
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 0.5rem;
        padding: 1rem;
        z-index: 10;
        width: 90%;
        max-width: 300px;
    }

        .month-popup.hidden {
            display: none;
        }

    .month-option {
        padding: 0.5rem;
        background: #f0f4f8;
        text-align: center;
        border-radius: 4px;
        cursor: pointer;
        font-weight: bold;
    }

        .month-option:hover {
            background: #d6e9f8;
        }

    .calendar-icon.payday,
    .calendar-icon.deadline {
        font-size: 0.7rem !important;
    }

    .pto-hours,
    .pto-top {
        padding: 0 2px !important;
        font-size: 0.45rem !important;
    }

    /* ========== SWIPE GLOW EFFECT ========== */
    .swipe-glow {
        position: absolute;
        transform: translateY(-50%);
        width: 30px;
        pointer-events: none;
        z-index: 10;
        opacity: 0;
        border-radius: 10px;
        transition: opacity 0.25s ease;
        background: radial-gradient( ellipse at center, rgba(0, 123, 255, 0.4) 0%, rgba(0, 123, 255, 0.2) 60%, rgba(0, 123, 255, 0) 100% );
        filter: blur(8px);
    }

        .swipe-glow.left {
            left: 0;
        }

        .swipe-glow.right {
            right: 0;
        }

        .swipe-glow.show {
            opacity: 1;
            transition: opacity 0.25s ease;
        }

    .day-popup {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, 0.5);
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 100;
    }

        .day-popup.hidden {
            display: none;
        }

    .day-popup-content {
        background: white;
        border-radius: 10px;
        padding: 20px;
        width: 90%;
        max-width: 400px;
        box-shadow: 0 5px 15px rgba(0,0,0,0.3);
        position: relative;
    }

    #close-popup {
        position: absolute;
        right: 10px;
        top: 10px;
        font-size: 1.5rem;
        cursor: pointer;
        color: #999;
    }

    #popup-details {
        margin-top: 1rem;
        font-size: 0.95rem;
    }
}

/* ==== Desktop Calendar Legend ==== */
.calendar-legend {
    font-size: 0.75rem;
    color: #333;
    justify-content: space-evenly;
    margin-top: 0.5rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.legend-item,
.legend-icon {
    width: 16px;
    height: 16px;
    display: inline-block;
    margin-right: 4px;
    vertical-align: middle;
}

.calendar-legend .legend-icon {
    color: #85bb65;
}

/* ==== Mobile Legend Popup ==== */
.legend-toggle {
    font-size: 0.75rem;
    margin: 0.5rem auto;
    padding: 0.25rem 0.5rem;
    display: block;
    border: none;
    background: #e0e0e0;
    color: #333;
    border-radius: 4px;
    cursor: pointer;
}

.legend-popup {
    position: fixed;
    top: 0;
    left: 0;
    background: rgba(0,0,0,0.5);
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 200;
}

    .legend-popup.hidden {
        display: none;
    }


/* ==== Legend ==== */
.legend-content {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    width: 85%;
    max-width: 300px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    font-size: 0.9rem;
}

.legend-close {
    position: absolute;
    top: 12px;
    right: 18px;
    font-size: 1.25rem;
    color: #999;
    cursor: pointer;
}

.legend-row {
    display: flex;
    align-items: center;
    min-width: 80px;
    gap: 8px;
    margin-bottom: 0.5rem;
}

.legend-box {
    width: 16px;
    height: 16px;
}
