/* ---- CSS Reset ---- */
*, *::before, *::after {
    box-sizing: border-box;
}

/* ---- Global Variables ---- */
:root {
    /* Brand Colors */
    --primary-blue: #135b9a;
    --secondary-blue: #1979cc;
    --dark-blue: #082844;
    --light-blue: #bbdbf7;
    --accent-orange: darkorange;
    --accent-yellow: #e9b655;
    
    /* Nav Background Colors */
    --nav-bg-1: #c4e9af;
    --nav-bg-2: #ddf2d1;

    /* Fonts */
    --font-heading: "Special Elite", sans-serif;
    --font-nav: "Margarine", cursive;
    --font-body: 'Lora', serif;
}


/* ---- Body ---- */
body {
    margin: 0;
    background-image: url('../images/brick_background.gif');
    font-family: var(--font-body);
}


/* ---- Page ---- */
#page {
    max-width: 1250px;
    min-width: 350px;
    margin: 0 auto;
}


/* ---- Header ---- */
header {
    position: relative;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center; 
    
    padding: 8px 8px 20px 8px;
    grid-area: header;
    cursor: default;
    letter-spacing: 0.1em;
    z-index: 999;
    margin-bottom: -10px;
}

/* Moved the background and mask here so it doesn't cut off the dropdown */
header::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: -1; /* Pushes the background behind text and icons */

    /* header background */
    --s: 32px;
    --c1: var(--primary-blue);
    --c2: #f1d4af;
    --g: conic-gradient(at 90% 40%,#0000 75%,var(--c1) 0);
    background: var(--primary-blue); /* Base fallback */
    background: var(--g),var(--g) var(--s) var(--s) var(--c2);
    background-size: calc(2*var(--s)) calc(2*var(--s));

    /* header zigzag mask */
    --mask: conic-gradient(from -57.5deg at bottom,#0000,#000 1deg 114deg,#0000 115deg) 50%/31.39px 100%;
    -webkit-mask: var(--mask);
    mask: var(--mask);
}




h1 {
    grid-column: 2;
    font-family: var(--font-heading);
    text-align: center;
    font-size: 3em;
    margin: 0;
    padding: .5em 0 0.2em 0;
    color: var(--accent-yellow);
    text-shadow: -1.5px -1.5px 0 #000, 1.5px -1.5px 0 #000, -1.5px 1.5px 0 #000, 1.5px 1.5px 0 #000, 0px 0px 15px rgba(255,255,255,0.95);
}

/* User Profile Dropdown Menu */
.user-menu {
    grid-column: 3;      /* Puts it in the far right column */
    justify-self: end;   /* Pushes it to the right edge of that column */
    margin-right: 20px;  /* Gives it 20px of breathing room from the edge */
    position: relative;  /* Required so the dropdown box anchors to the icon */
    display: inline-block;
    letter-spacing: normal;
}

.user-icon {
    font-size: 1.8em;
    color: white;
    text-decoration: none;
    padding: 8px 12px;
    cursor: pointer;
    transition: color 0.2s;
}

.user-icon:hover {
    color: var(--accent-yellow);
}

.user-dropdown {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    right: 0; /* Aligns the dropdown to the right edge of the icon */
    top: 130%; /* Pushes it just below the icon */
    background-color: white;
    min-width: 190px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
    border-radius: 8px;
    z-index: 1000;
    border: 1px solid #eaf4fc;
    transition: all 0.2s ease-in-out;
}

/* The invisible bridge so the hover doesn't break when moving the mouse down */
.user-menu::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    height: 15px; 
}

.user-menu:hover .user-dropdown {
    visibility: visible;
    opacity: 1;
    top: 100%;
    right: 0;
    z-index: 1000;
}

.user-dropdown a {
    color: #333;
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    font-family: 'Lora', serif;
    font-size: 0.95em;
    border-bottom: 1px solid #f1f1f1;
    transition: background-color 0.2s;
}

.user-dropdown a:last-child {
    border-bottom: none;
}

.user-dropdown a i {
    margin-right: 10px;
    color: #135b9a;
    width: 16px; /* Keeps icons aligned */
    text-align: center;
}

.user-dropdown a:hover {
    background-color: #f1f8ff; /* Light blue accent */
    border-radius: inherit; /* Keeps the corners rounded on hover */
}


/* ---- Nav (Mobile First) ---- */
nav {
    padding: 10px;
    font-size: 1.6em;
    color: var(--accent-orange);
    font-family: var(--font-nav);
    text-shadow: -.75px -.75px 0 #000, .75px -.75px 0 #000, -.75px .75px 0 #000, .75px .75px 0 #000;
    letter-spacing: .05em;
    grid-area: nav;

    /* background design */
    --s: 140px; 
    --_g: #0000 52%,var(--nav-bg-1) 54% 57%,#0000 59%; 
    background: 
        radial-gradient(farthest-side at -33.33% 50%,var(--_g)) 0 calc(var(--s)/2),
        radial-gradient(farthest-side at 50% 133.33%,var(--_g)) calc(var(--s)/2) 0,
        radial-gradient(farthest-side at 133.33% 50%,var(--_g)),
        radial-gradient(farthest-side at 50% -33.33%,var(--_g)),
        var(--nav-bg-2);
    background-size: calc(var(--s)/4.667) var(--s),var(--s) calc(var(--s)/4.667);
}

nav #menu-button {
    margin-right: 10px;
    display: flex;
    justify-content: flex-end;
}

nav #menu-button a:hover {
    cursor: pointer;
}

nav ul {
    list-style-type: none;
    display: flex;
    flex-direction: column;
    gap: 0.5em;
    position: fixed;
    transition: 0.4s;
    height: 100%;
    width: 0;
    top: 0;
    left: 0;
    z-index: 1000;
    margin: 0;
    padding: 0;
    
    /* background design */
    --s: 140px; 
    --_g: #0000 52%,var(--nav-bg-1) 54% 57%,#0000 59%; 
    background: 
        radial-gradient(farthest-side at -33.33% 50%,var(--_g)) 0 calc(var(--s)/2),
        radial-gradient(farthest-side at 50% 133.33%,var(--_g)) calc(var(--s)/2) 0,
        radial-gradient(farthest-side at 133.33% 50%,var(--_g)),
        radial-gradient(farthest-side at 50% -33.33%,var(--_g)),
        var(--nav-bg-2);
    background-size: calc(var(--s)/4.667) var(--s),var(--s) calc(var(--s)/4.667);
    
    /* right side shape mask */
    --mask: 
        linear-gradient(to left,#0000 12px,#000 0),
        radial-gradient(12px,#000 98%,#0000) right/24px 22.2px;
    mask: var(--mask);
    -webkit-mask: var(--mask);
    margin-right: -7px;
}

.expanded-menu {
    width: 250px;
}

nav ul li {
    margin-right: 3em;
    cursor: pointer;
}

nav ul li a {
    color: var(--accent-orange);
    text-decoration: none;
    padding: 5px 20px;
    display: block;
}

nav ul li:hover a {  
    color: #163a99;
}

nav ul #close-menu {
    text-align: right;
    margin-right: -50px;
    font-size: 2em;
    margin-bottom: -0.5em;
}


/* ---- Main ---- */
main {
    background-color: var(--light-blue);
    color: var(--dark-blue);
    grid-area: main;
    --main_padding: 30px;
    padding: var(--main_padding);
    padding-left: calc(var(--main_padding) + 7px);
    padding-bottom: calc(var(--main_padding) + 40px);

    /* background pattern */
    --s: 75px;
    --c1: #d1e7fa;
    --c2: var(--light-blue);
    --_g: var(--c1) 90deg,#0000 90.5deg;
    background:
        conic-gradient(from -45deg,var(--_g)),
        conic-gradient(from 135deg,var(--_g)) calc(var(--s)/2) 0,
        var(--c2);
    background-size: var(--s) var(--s);

    /* zigzag pattern at top of main */
    --mask: radial-gradient(9px at top,#0000 97%,#000) 50% / 16.65px 100%;
    mask: var(--mask);
    -webkit-mask: var(--mask);
    margin-top: -20px;
}


/* ---- Footer ---- */
footer {
    text-align: center;
    padding: .7em 0;
    font-family: var(--font-heading);
    font-size: 2.5em;
    color: white;
    text-shadow: -1.5px -1.5px 0 #000, 1.5px -1.5px 0 #000, -1.5px 1.5px 0 #000, 1.5px 1.5px 0 #000;
    cursor: default;
    grid-area: footer;
    z-index: 100;

    /* background pattern */
    --s: 79px; 
    --c1: #633d2e;
    --c2: #f7af63;
    --l: var(--c1) 20%,#0000 0;
    --g: 35%,var(--c2) 0 45%,var(--c1) 0;
    background:
        linear-gradient(45deg,var(--l) 45%,var(--c1) 0 70%,#0000 0),
        linear-gradient(-45deg,var(--l) var(--g) 70%,#0000 0),
        linear-gradient(45deg,var(--c1) var(--g));
    background-size: var(--s) var(--s);

    /* zigzag pattern on top */
    --mask: conic-gradient(from 122.5deg at top,#0000,#000 1deg 114deg,#0000 115deg) 50%/31.39px 100%;
    -webkit-mask: var(--mask);
    mask: var(--mask);
    margin-top: -10px;
}

footer .copyright {
    font-size: .4em;
    margin-top: .5em;
}


/* ==== MEDIUM VIEWPORT (Tablets) ==== */
@media (min-width: 650px) {
    h1 {
        font-size: 3.6em;
    }
    header {
        padding-bottom: 32px;
    }
}


/* ==== LARGE VIEWPORT (Desktops) ==== */
@media (min-width: 1050px) {
    #page {
        display: grid;
        grid-template-areas: "header header"
                             "nav main"
                             "footer footer";
        grid-template-columns: auto 1fr;
        box-shadow: 0px 0px 10px;
    }

    nav {
        /* right side shape mask for the permanent sidebar */
        --mask: 
            linear-gradient(to left,#0000 12px,#000 0),
            radial-gradient(12px,#000 98%,#0000) right/24px 22.2px;
        mask: var(--mask);
        -webkit-mask: var(--mask);
        margin-right: -7px;
        z-index: 50;
    }
    
    /* Hide the hamburger and close buttons */
    nav #menu-button, 
    nav ul li:first-of-type {
        display: none;
    }

    /* Unpack the fixed mobile menu into the grid sidebar */
    nav ul {
        position: initial;
        height: initial;
        width: initial;
        background: none; /* Lets the nav parent background show through */
        --mask: none;
        -webkit-mask: none;
        mask: none;
        margin-right: 0;
        margin-top: 1em;
        font-size: 1.1em;
        gap: 0.5em;
    }
    
    nav ul li {
        margin-right: 0;
    }
    
    nav ul li a {
        padding: 5px 20px;
    }
    
    main {
        margin-top: -9px;
    }
}


/* =========================================
   SLIDE-IN PANEL
   ========================================= */

/* The dark background overlay */
.panel-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    display: none; /* Hidden by default */
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* The panel itself */
.side-panel {
    position: fixed;
    top: 0;
    right: -600px; /* Hidden off the right side of the screen */
    width: 600px;
    max-width: 100%; /* Ensures it doesn't overflow on small phones */
    height: 100vh;
    background: #ffffff;
    z-index: 1000;
    box-shadow: -5px 0 15px rgba(0,0,0,0.1);
    transition: right 0.3s ease; /* The sliding animation */
    display: flex;
    flex-direction: column;
}

/* The class we add with JavaScript to slide it in */
.side-panel.open {
    right: 0; 
}

.panel-header {
    padding: 15px 20px;
    background: var(--light-blue);
    border-bottom: 2px solid var(--primary-blue);
    display: flex;
    justify-content: flex-end; /* Pushes button to the right */
}

.close-panel-btn {
    background: none;
    border: none;
    font-size: 1.1em;
    color: var(--primary-blue);
    font-family: var(--font-heading);
    cursor: pointer;
}

.close-panel-btn:hover {
    color: var(--dark-blue);
}

/* The scrollable content area inside the panel */
.panel-content {
    padding: 30px;
    overflow-y: auto; /* Allows scrolling if description is long */
    flex-grow: 1;
}

/* Slide-Out Panel Integrated Stats */
.panel-vitals-row {
    display: flex;
    flex-wrap: wrap;
    gap: 25px; /* Spaces out Energy, Duration, and CARES */
    margin: 30px 0 10px 0;
    padding-top: 20px;
    border-top: 1px solid #e0e6ed; /* Subtle separator from the Description */
    font-family: var(--font-body);
    font-size: 0.95em;
    color: var(--dark-blue);
}

.vital-item {
    display: flex;
    align-items: center;
    gap: 8px; /* Space between the icon, label, and value */
}

.vital-item strong {
    font-weight: 600;
    color: #4a5568; 
}

/* Ensure the dots flex nicely in a row */
.cares-dots-container {
    display: flex;
    gap: 4px;
    align-items: center;
}

/* Force the CARES letters into perfect circles */
.cares-dots-container .dot {
    display: inline-flex; /* This is the magic property that allows width/height on a span */
    justify-content: center;
    align-items: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    color: white;
    font-size: 0.7em;
    font-weight: bold;
    font-family: sans-serif;
}

/* Fallback colors: Ensures they are colored even if the card CSS doesn't reach the panel */
.cares-dots-container .cares-c { background-color: #e74c3c; } /* Red */
.cares-dots-container .cares-a { background-color: #e67e22; } /* Orange */
.cares-dots-container .cares-r { background-color: #2ecc71; } /* Green */
.cares-dots-container .cares-e { background-color: #3498db; } /* Blue */
.cares-dots-container .cares-s { background-color: #9b59b6; } /* Purple */

/* Stack them vertically on very small mobile screens */
@media (max-width: 500px) {
    .panel-vitals-row {
        flex-direction: column;
        gap: 12px;
    }
}


/* =========================================
   PANEL FOOTER & ACTION BUTTONS
   ========================================= */
.panel-footer {
    padding: 15px 20px;
    background: #f8f9fa;
    border-top: 1px solid #ddd;
    display: flex;
    flex-direction: column; /* Stack the date row and the button row */
    gap: 12px;
    margin-top: auto; 
}

.date-picker-row {
    display: flex;
    justify-content: flex-end; /* Push date picker to the right */
    align-items: center;
    gap: 10px;
    font-family: var(--font-body);
    font-size: 0.9em;
    color: var(--dark-blue);
}

.date-picker-row input[type="date"] {
    padding: 5px 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-family: var(--font-body);
    color: var(--dark-blue);
    cursor: pointer;
}

.footer-buttons {
    display: flex;
    gap: 15px;
    width: 100%;
}

.action-btn {
    flex: 1; /* Makes both buttons take up exactly 50% of the space */
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-family: var(--font-body);
    font-weight: bold;
    font-size: 1.1em;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.queue-btn {
    background-color: var(--light-blue);
    color: var(--dark-blue);
    border: 2px solid var(--primary-blue);
}

.queue-btn:hover {
    background-color: var(--primary-blue);
    color: white;
}

.log-btn {
    background-color: #28a745; /* "Success" green */
    color: white;
}

.log-btn:hover {
    background-color: #218838;
}


/* =========================================
   VARIATIONS MINI-CARDS (Slide-out Panel)
   ========================================= */
   .variations-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}

.variation-card {
    border-radius: 8px;
    padding: 15px;
    border-left: 6px solid #ccc; /* Default left border */
    background-color: #f9f9f9;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    font-family: var(--font-body);
}

/* Color Coding by Variation Type */
.variation-card.type-academic {
    border-left-color: #3498db; /* Blue */
    background-color: #ebf5fb;
}
.variation-card.type-seasonal {
    border-left-color: #e67e22; /* Orange */
    background-color: #fdf2e9;
}
.variation-card.type-virtual {
    border-left-color: #9b59b6; /* Purple */
    background-color: #f5eef8;
}
.variation-card.type-general {
    border-left-color: #2ecc71; /* Green */
    background-color: #eafaf1;
}

/* Card Internal Layout */
.var-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.var-badge {
    background: rgba(255, 255, 255, 0.8);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75em;
    font-weight: bold;
    color: var(--dark-blue);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 1px solid rgba(0,0,0,0.05);
}

.var-grades {
    font-size: 0.85em;
    color: #555;
    font-weight: bold;
}

.var-academic-meta {
    font-size: 0.9em;
    color: var(--primary-blue);
    margin-bottom: 8px;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 6px;
}

.var-objective {
    font-size: 0.95em;
    margin-bottom: 10px;
    color: #222;
}

.var-description {
    font-size: 0.95em;
    color: #444;
    line-height: 1.5;
}

/* Fixes spacing if TinyMCE wrapped everything in <p> tags */
.var-description p { margin-top: 0; margin-bottom: 10px; }
.var-description p:last-child { margin-bottom: 0; }