/* =========================================================
   FOOD SAVER
   APPLICATION LAYOUT
   Header + Sidebar + Main
   ========================================================= */

:root {
    --header-height: clamp(64px, 5vw, 75px);
    --sidebar-width: clamp(120px, 14vw, 170px);

    --bg: #000;
    --border: #005e88;
    --text: #fff;
    --muted: #aaa;
    --accent: #08a9ed;
}


/* =========================================================
   GLOBAL APP SHELL
   ========================================================= */

html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;

    background: var(--bg);
    color: var(--text);

    overflow: hidden;
}


.app {
    width: 100%;
    height: 100dvh;

    display: grid;

    grid-template-columns:
        var(--sidebar-width)
        minmax(0, 1fr);

    grid-template-rows:
        var(--header-height)
        minmax(0, 1fr);

    background: var(--bg);

    overflow: hidden;
}


/* =========================================================
   HEADER
   ========================================================= */

.header {
    position: relative;

    grid-column: 1 / -1;
    grid-row: 1;

    width: 100%;
    height: 100%;

    display: flex;
    align-items: center;
    justify-content: space-between;

    min-width: 0;

    padding-inline: clamp(10px, 1.5vw, 18px);

    background: #000;
    border-bottom: 1px solid var(--border);

    z-index: 10;

    box-sizing: border-box;
}


/* Logo */

.header-logo {
    display: flex;
    align-items: center;

    min-width: 0;
    height: 100%;
}

.header-logo img {
    display: block;

    width: clamp(130px, 16vw, 225px);
    max-width: 100%;
    max-height: 90%;

    height: auto;

    object-fit: contain;
}


/* Header right */

.header-right {
    display: flex;
    align-items: center;

    gap: clamp(8px, 1.5vw, 20px);

    min-width: 0;
}


/* System status */

.system-status {
    width: clamp(125px, 12vw, 170px);
    height: clamp(44px, 4vw, 58px);

    flex-shrink: 1;

    border: 1px solid #006d98;
    border-radius: 8px;

    text-align: center;

    padding: 7px 8px;

    box-sizing: border-box;
}


/* Date/time */

.datetime {
    min-width: clamp(90px, 10vw, 125px);

    padding-left: clamp(8px, 1.2vw, 18px);

    border-left: 1px solid #333;

    text-align: center;

    color: #ddd;

    flex-shrink: 1;
}

.datetime strong {
    display: block;

    color: #fff;

    font-size: clamp(15px, 1.4vw, 20px);

    margin-top: 3px;
}


/* User */

.user {
    display: flex;
    align-items: center;

    gap: 6px;

    color: #ddd;

    font-size: clamp(11px, 1vw, 13px);

    white-space: nowrap;
}


/* =========================================================
   SIDEBAR
   ========================================================= */

.sidebar {
    position: relative;

    grid-column: 1;
    grid-row: 2;

    width: 100%;
    height: 100%;

    min-width: 0;
    min-height: 0;

    display: flex;
    flex-direction: column;

    background: #000;
    border-right: 1px solid var(--border);

    z-index: 5;

    overflow: hidden;

    box-sizing: border-box;
}


/* Menu */

.menu {
    width: 100%;

    padding: 10px 5px;

    box-sizing: border-box;

    overflow-y: auto;
    overflow-x: hidden;
}


/* Menu item */

.menu-item {
    width: 100%;
    min-width: 0;

    height: clamp(36px, 3vw, 40px);

    display: flex;
    align-items: center;

    gap: clamp(7px, 1vw, 12px);

    padding-inline: clamp(7px, 0.8vw, 10px);

    margin-bottom: 3px;

    border-radius: 5px;

    color: #ddd;

    font-size: clamp(11px, 1vw, 14px);

    cursor: pointer;

    box-sizing: border-box;

    white-space: nowrap;

    overflow: hidden;
}

.menu-item:hover {
    background: #062b3c;
}

.menu-item.active {
    background: var(--accent);
    color: #fff;
}


/* Menu icon */

.menu-icon {
    flex: 0 0 clamp(18px, 1.8vw, 20px);

    width: clamp(18px, 1.8vw, 20px);
    height: clamp(18px, 1.8vw, 22px);

    display: flex;
    align-items: center;
    justify-content: center;

    text-align: center;

    font-size: clamp(14px, 1.2vw, 16px);
}

.menu-icon img {
    width: 18px;
    height: 18px;

    object-fit: contain;
}


/* BRIN */

.brin-logo {
    margin-top: auto;

    width: 100%;

    padding: 10px 5px 15px;

    box-sizing: border-box;

    text-align: center;

    color: #777;

    font-size: clamp(7px, 0.7vw, 9px);
}

.brin-logo img {
    width: clamp(55px, 6vw, 75px);

    height: auto;

    margin-bottom: 5px;
}


/* =========================================================
   MAIN
   ========================================================= */

.main {
    position: relative;

    grid-column: 2;
    grid-row: 2;

    width: 100%;
    height: 100%;

    min-width: 0;
    min-height: 0;

    background: #000;

    overflow: hidden;

    box-sizing: border-box;
}


/* =========================================================
   PAGE CONTAINER
   ========================================================= */

#page-container {
    width: 100%;
    height: 100%;

    min-width: 0;
    min-height: 0;

    overflow: hidden;

    box-sizing: border-box;
}


/* =========================================================
   SMALL SCREEN
   Only structural changes.
   ========================================================= */

@media (max-width: 700px) {

    .system-status,
    .datetime {
        display: none;
    }

    .header-right {
        gap: 8px;
    }

    .header-logo img {
        width: clamp(120px, 40vw, 170px);
    }

    .sidebar {
        overflow-x: hidden;
    }

    .menu-item {
        padding-inline: 6px;
        gap: 7px;
    }
}

/* =========================================================
   HEADER RIGHT - DESKTOP FIX
   Keep original header proportions
   ========================================================= */

@media (min-width: 901px) {

    .header-right {
        display: flex;
        align-items: center;
        justify-content: flex-end;

        gap: 20px;

        flex-shrink: 0;

        min-width: max-content;
    }


    /* -----------------------------------------
       System Status
       ----------------------------------------- */

    .system-status {
        width: 170px;
        min-width: 170px;

        height: 58px;
        min-height: 58px;

        flex: 0 0 170px;

        box-sizing: border-box;

        padding: 8px 8px 6px;

        display: flex;
        flex-direction: column;

        align-items: center;
        justify-content: center;

        text-align: center;

        overflow: hidden;
    }


    .system-status .status-title {

        width: 100%;

        font-size: 13px;
        font-weight: bold;

        line-height: 1.15;

        white-space: nowrap;

        overflow: hidden;
        text-overflow: ellipsis;
    }


    .system-status .status-subtitle {

        width: 100%;

        margin-top: 5px;

        font-size: 9px;

        line-height: 1.15;

        text-align: center;

        white-space: normal;
    }


    /* -----------------------------------------
       Date / Time
       ----------------------------------------- */

    .datetime {

        min-width: 125px;
        width: 125px;

        flex: 0 0 125px;

        box-sizing: border-box;

        text-align: center;

        white-space: nowrap;
    }


    .datetime strong {

        display: block;

        font-size: 20px;

        line-height: 1.1;

        white-space: nowrap;
    }


    /* -----------------------------------------
       User
       ----------------------------------------- */

    .user {

        min-width: max-content;

        flex: 0 0 auto;

        white-space: nowrap;

        display: flex;

        align-items: center;

        gap: 8px;
    }

}

/* =========================================================
   FOOD SAVER
   FINAL RESPONSIVE HEADER + MOBILE NAVIGATION
   ========================================================= */


/* =========================================================
   HEADER - BASE
   ========================================================= */

.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;

    height: var(--header-height, 75px);

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 0 clamp(10px, 1.5vw, 22px);

    background:
        linear-gradient(
            90deg,
            #000000 0%,
            #001016 55%,
            #001b24 100%
        );

    border-bottom: 1px solid #005e88;

    box-sizing: border-box;

    z-index: 1000;
}


/* =========================================================
   FOOD SAVER LOGO
   ========================================================= */

.header-logo {
    height: 100%;

    display: flex;
    align-items: center;

    min-width: 0;
}

.header-logo img {
    width: clamp(180px, 16vw, 225px);

    height: auto;

    max-height: 65px;

    object-fit: contain;

    display: block;
}


/* =========================================================
   HEADER RIGHT
   ========================================================= */

.header-right {

    display: flex;

    align-items: center;

    justify-content: flex-end;

    gap: clamp(10px, 1.2vw, 20px);

    min-width: 0;

    flex-shrink: 0;
}


/* =========================================================
   SYSTEM STATUS
   ========================================================= */

.system-status {

    width: 145px;
    min-width: 145px;

    height: 46px;
    min-height: 46px;

    flex: 0 0 145px;

    box-sizing: border-box;

    display: flex;

    flex-direction: column;

    align-items: center;

    justify-content: center;

    padding: 5px 8px;

    border: 1px solid #006d98;

    border-radius: 6px;

    background: rgba(0, 20, 27, 0.45);

    text-align: center;

    overflow: hidden;
}


/* System status title */

.system-status .status-title {

    display: flex;

    align-items: center;

    justify-content: center;

    width: 100%;

    color: #00f0ad;

    font-size: 12px;

    font-weight: 700;

    line-height: 1.1;

    white-space: nowrap;
}


/* Green status dot */

.system-status .status-dot {

    display: inline-block;

    width: 9px;
    height: 9px;

    flex: 0 0 9px;

    margin-right: 6px;

    border-radius: 50%;

    background: #00f39d;

    box-shadow:
        0 0 6px rgba(0, 243, 157, 0.45);
}


/* Subtitle */

.system-status .status-subtitle {

    width: 100%;

    margin-top: 4px;

    color: #69a4b9;

    font-size: 8px;

    line-height: 1.1;

    text-align: center;

    white-space: nowrap;

    overflow: hidden;

    text-overflow: ellipsis;
}


/* =========================================================
   HEADER SEPARATOR
   ========================================================= */

.header-right > .datetime {

    position: relative;

    margin-left: 0;

    padding-left: clamp(10px, 1.2vw, 18px);

    border-left: 1px solid #35444a;
}


/* =========================================================
   DATE / TIME
   ========================================================= */

.datetime {

    width: 125px;
    min-width: 125px;

    flex: 0 0 125px;

    box-sizing: border-box;

    display: flex;

    flex-direction: column;

    align-items: center;

    justify-content: center;

    color: #d8e0e3;

    text-align: center;

    font-size: 10px;

    line-height: 1.1;

    white-space: nowrap;
}


/*
   Calendar icon
*/

.datetime::before {

    content: "▣";

    position: absolute;

    left: -2px;

    top: 50%;

    transform: translateY(-50%);

    color: #d8e0e3;

    font-size: 18px;

    line-height: 1;
}


/* Date */

.datetime #date {

    display: block;

    color: #cfd9dd;

    font-size: 10px;

    line-height: 1.1;

    margin-bottom: 3px;

    white-space: nowrap;
}


/* Clock */

.datetime #clock {

    display: block;

    color: #ffffff;

    font-size: 17px;

    font-weight: 700;

    line-height: 1.05;

    white-space: nowrap;
}


/* =========================================================
   USER
   ========================================================= */

.header-right > .user {

    min-width: max-content;

    flex: 0 0 auto;

    display: flex;

    align-items: center;

    gap: 7px;

    color: #dce5e8;

    font-size: 11px;

    white-space: nowrap;
}


/* Separator before user */

.header-right > .user::before {

    content: "";

    width: 1px;

    height: 32px;

    margin-right: 5px;

    background: #35444a;
}


/* User icon */

.user-icon {

    display: flex;

    align-items: center;

    justify-content: center;

    width: 28px;
    height: 28px;

    border-radius: 50%;

    background: #d9e9ff;

    color: #143653;

    font-size: 17px;

}


/* Dropdown */

.user-arrow {

    color: #b9c3c7;

    font-size: 11px;

}


/* =========================================================
   HAMBURGER BUTTON
   ========================================================= */

.menu-toggle {

    display: none;

    width: 42px;
    height: 42px;

    margin: 0;

    padding: 0;

    border: 1px solid #006d98;

    border-radius: 6px;

    background: rgba(0, 25, 32, 0.75);

    color: #ffffff;

    font-size: 24px;

    line-height: 1;

    cursor: pointer;

    align-items: center;

    justify-content: center;

    flex: 0 0 42px;
}

.menu-toggle:hover {

    background: #063343;
}


/* =========================================================
   DESKTOP
   ========================================================= */

@media (min-width: 901px) {

    .menu-toggle {
        display: none;
    }

    .sidebar {
        transform: none;
    }

}


/* =========================================================
   TABLET + MOBILE
   ========================================================= */

@media (max-width: 900px) {

    /* -----------------------------------------
       APP SHELL
       ----------------------------------------- */

    .app {

        grid-template-columns: minmax(0, 1fr);

    }


    /* -----------------------------------------
       HEADER
       ----------------------------------------- */

    .header {

        height: var(--header-height, 68px);

        padding:
            0
            clamp(8px, 2vw, 16px);

    }


    .header-logo {

        min-width: 0;

        flex: 1 1 auto;

    }


    .header-logo img {

        width: clamp(155px, 28vw, 205px);

        max-height: 56px;

    }


    /* -----------------------------------------
       HAMBURGER
       ----------------------------------------- */

    .menu-toggle {

        display: flex;

        order: -1;

        margin-right: 8px;

    }


    /* -----------------------------------------
       HEADER RIGHT
       ----------------------------------------- */

    .header-right {

        gap: 8px;

        flex: 0 0 auto;

    }


    /* Status + date hidden on tablet/mobile */

    .header-right .system-status,
    .header-right .datetime {

        display: none;

    }


    .header-right .user {

        font-size: 11px;

    }


    .header-right .user::before {

        display: none;

    }


    .user-icon {

        width: 28px;
        height: 28px;

        font-size: 16px;

    }


    .user-arrow {

        display: none;

    }


    /* -----------------------------------------
       SIDEBAR
       ----------------------------------------- */

    .sidebar {

        position: fixed;

        top: var(--header-height, 68px);

        left: 0;

        bottom: 0;

        width: min(280px, 82vw);

        height: auto;

        transform: translateX(-100%);

        transition:
            transform 0.25s ease;

        z-index: 1200;

        box-shadow:
            8px 0 25px rgba(0, 0, 0, 0.45);

    }


    .app.sidebar-open .sidebar {

        transform: translateX(0);

    }


    /* -----------------------------------------
       SIDEBAR OVERLAY
       ----------------------------------------- */

    .sidebar-overlay {

        position: fixed;

        top: var(--header-height, 68px);

        left: 0;

        right: 0;

        bottom: 0;

        background: rgba(0, 0, 0, 0.55);

        opacity: 0;

        visibility: hidden;

        pointer-events: none;

        transition:
            opacity 0.25s ease,
            visibility 0.25s ease;

        z-index: 1100;

    }


    .app.sidebar-open .sidebar-overlay {

        opacity: 1;

        visibility: visible;

        pointer-events: auto;

    }


    /* -----------------------------------------
       MAIN
       ----------------------------------------- */

    .main {

        grid-column: 1;

        min-width: 0;

        min-height: 0;

        overflow-x: hidden;

        overflow-y: auto;

    }


    #page-container {

        width: 100%;

        height: auto;

        min-height: 100%;

        overflow: visible;

    }

}


/* =========================================================
   MOBILE PHONE
   ========================================================= */

@media (max-width: 600px) {

    .header {

        height: 64px;

    }


    .header-logo img {

        width: 155px;

        max-height: 50px;

    }


    .menu-toggle {

        width: 38px;
        height: 38px;

        flex-basis: 38px;

        font-size: 22px;

        margin-right: 5px;

    }


    .header-right .user {

        font-size: 0;

    }


    .header-right .user-icon {

        width: 30px;
        height: 30px;

        font-size: 17px;

    }


    /* Dashboard must scroll */

    .main {

        overflow-x: hidden;

        overflow-y: auto;

        -webkit-overflow-scrolling: touch;

    }


    #page-container {

        height: auto;

        min-height: 100%;

        overflow: visible;

    }

}


/* =========================================================
   VERY SMALL PHONE
   ========================================================= */

@media (max-width: 380px) {

    .header-logo img {

        width: 140px;

    }

    .menu-toggle {

        width: 36px;
        height: 36px;

        flex-basis: 36px;

    }

}