/* Make page use full viewport and easier to scale */
:root {
    --sidebar-width: 160px;
    --sidebar-collapsed-width: 72px;
    --gap: 12px;
    --sidebar-bg: #4989e3;
}

*,
*::before,
*::after { box-sizing: border-box; }

html, body {
    height: 100%;
    width: 100%;
    margin: 0;
    padding: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Add text-size-adjust for broader browser support (mirrors -webkit-text-size-adjust) */
html {
    text-size-adjust: 100%;
    -webkit-text-size-adjust: 100%;
}

/* full-screen app layout */
.app-container {
    display: flex;
    min-height: 100vh;
    height: 100%;
    width: 100%;
    gap: var(--gap);
    background-color: #b3f493;
}

/* Sidebar */
.sidebar {
    background-color: var(--sidebar-bg);
    color: #fff;
    width: var(--sidebar-width);
    flex: 0 0 var(--sidebar-width);
    height: 100vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

.sidebar-header {
    width: 100%;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 12px;
    text-align: center;
    font-weight: 700;
    white-space: nowrap;
}

/* Main content area grows to fill remaining space */
.main-content {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 0; /* allow children to scroll */
}

/* Ensure page body scrolls inside main area */
main {
    overflow: auto;
    padding: 16px;
    min-height: 0; /* allow flex children shrink */
    display: flex;
    flex-direction: column;
}

/* Page-level helper: fill the available main area */
.page-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    gap: 12px;
}

/* Child that should stretch to fill remaining vertical space */
.page-content .stretch {
    flex: 1 1 auto;
    min-height: 0; /* critical to allow internal scrolling */
}

/* Centering/fit helper for single-panel pages (optional) */
.page-content .center-fit {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 12px;
    padding: 12px;
}

/* Responsive tile grid */
.tile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    align-items: start;
}

/* Slightly bigger responsive timer text if present */
.display-6 {
    font-size: clamp(1.6rem, 6vw, 3rem);
    line-height: 1;
}

/* Buttons and inputs scale on small screens */
.btn, .form-control {
    font-size: clamp(.85rem, 1.2vw, 1rem);
}

/* Small-screen adjustments: collapse sidebar to a narrower column */
@media (max-width: 900px) {
    :root { --sidebar-width: var(--sidebar-collapsed-width); }
    .sidebar {
        width: var(--sidebar-width);
        flex: 0 0 var(--sidebar-width);
    }
    .sidebar-header { font-size: .9rem; padding: 0 6px; height: 56px; }
    /* make the nav menu icons-only if you implement them later */
}

/* Very small screens: place sidebar on top */
@media (max-width: 520px) {
    .app-container {
        flex-direction: column;
        height: 100%;
    }
    .sidebar {
        width: 100%;
        height: auto;
        flex: 0 0 auto;
        display: flex;
        flex-direction: row;
        align-items: center;
        padding: 6px;
    }
    .main-content { flex: 1 1 auto; }
    .sidebar-header { flex: 1 1 auto; height: 48px; }
}

/* Alarm overlay should cover full viewport on any device */
.alarm-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

/* ===== Layout ===== */
.app-container {
    display: flex;
    height: 100vh; /* full viewport height */
    background-color: #b3f493; /* page background shows in the gap */
}
.qty-col {
    text-align: center;
}

/* Sidebar */
.sidebar {
    background-color: #4989e3;
    color: #fff;
    width: 160px;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-header {
    width: 100%;
    height: 64px;                 /* adjust height as needed */
    display: flex;
    align-items: center;          /* vertical center */
    justify-content: center;      /* horizontal center */
    padding: 0 12px;              /* keep some horizontal padding */
    box-sizing: border-box;
}

/* Main content area */
.main-content {
    background-color: #b3f493;   /* white content area */
    margin-left: 2rem;        /* <-- horizontal gap from sidebar */
    height: 100vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

/* Ensure page body scrolls if needed */
main {
    overflow-y: auto;
}

/* ===== NavMenu ===== */
.navmenu-container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.nav-link {
    width: 100%;
    justify-content: center;
}

.nav-link:hover {
    background-color: rgba(255,255,255,0.08);
    color: #fff;
}

.nav-link.active {
    background-color: #beccea;
    color: #fff;
}

.nav-item {
    margin-bottom: 0.25rem;
}

.nav-link i {
    font-size: 1rem;
}
