@import url('https://fonts.googleapis.com/css2?family=Saira:ital,wght@0,100..900;1,100..900&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Saira', sans-serif;
    background-color: #eeb9c2;
    transition: background-color 0.3s ease;
}

button { cursor: pointer; }

a {
    text-decoration: none;
    color: inherit;
}

/* ── NAV BAR ── */
.menu_bar {
    display: flex;
    align-items: center;
    padding: 0 24px;
    background-color: #080705;
    height: 64px;
    position: fixed;
    width: 100%;
    z-index: 100;
    color: #eeb9c2;
    gap: 4px;
}

.logo {
    display: flex;
    align-items: center;
    margin-right: auto;
    padding-left: 12px;
}

.logo_img {
    height: 30px;
    width: auto;
    display: block;
}

.nav_section {
    font-size: 15px;
    padding: 0 14px;
    height: 100%;
    display: flex;
    align-items: center;
    border-bottom: 3px solid transparent;
    transition: color 0.2s, border-color 0.2s;
    white-space: nowrap;
}

.nav_section:hover {
    color: #FFFFFA;
}

.nav_section.active {
    color: #FFFFFA;
    border-bottom-color: #702632;
}

.additional {
    border: 1px solid #702632;
    background-color: transparent;
    color: #eeb9c2;
    border-radius: 6px;
    width: 36px;
    height: 36px;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    margin-left: 8px;
    flex-shrink: 0;
}

.additional:hover {
    background-color: #702632;
    color: #FFFFFA;
}

/* ── NAV DRAWER ── */
#nav_overlay {
    position: fixed;
    inset: 0;
    background: rgba(8, 7, 5, 0.55);
    z-index: 200;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s;
}

#nav_overlay.open {
    opacity: 1;
    pointer-events: all;
}

#nav_drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 268px;
    height: 100vh;
    background: #FFFFFA;
    z-index: 201;
    transform: translateX(100%);
    transition: transform 0.25s ease;
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 24px rgba(8, 7, 5, 0.2);
}

#nav_drawer.open {
    transform: translateX(0);
}

.drawer_header {
    background: #080705;
    padding: 18px 20px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.drawer_user_info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.drawer_username {
    color: #FFFFFA;
    font-size: 16px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.drawer_label {
    color: #eeb9c2;
    font-size: 11px;
    margin-top: 2px;
}

#nav_close {
    background: none;
    border: 1px solid #702632;
    color: #eeb9c2;
    border-radius: 6px;
    width: 30px;
    height: 30px;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
}

#nav_close:hover {
    background: #702632;
    color: #FFFFFA;
}

.drawer_body {
    flex: 1;
    padding: 10px 0;
    overflow-y: auto;
}

.drawer_link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 20px;
    font-size: 15px;
    color: #080705;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-family: 'Saira', sans-serif;
    transition: background 0.15s;
    border-left: 3px solid transparent;
    text-decoration: none;
}

.drawer_link:hover {
    background: #eeb9c2;
    border-left-color: #702632;
    color: #080705;
}

.drawer_divider {
    height: 1px;
    background: #eeb9c2;
    margin: 6px 20px;
}

.drawer_footer {
    padding: 16px 20px;
    border-top: 1px solid #eeb9c2;
}

.drawer_logout_btn {
    width: 100%;
    padding: 10px;
    background: #702632;
    color: #FFFFFA;
    border: none;
    border-radius: 8px;
    font-family: 'Saira', sans-serif;
    font-size: 15px;
    transition: background 0.2s;
}

.drawer_logout_btn:hover {
    background: #080705;
}

/* ── DARK MODE ── */
body.dark { background-color: #1e1517; }

body.dark #nav_drawer {
    background: #2c2022;
    transition: background 0.3s;
}

body.dark .drawer_link {
    color: #f0e8ea;
    transition: background 0.15s, color 0.15s;
}

body.dark .drawer_link:hover {
    background: #4a3035;
    color: #f0e8ea;
}

body.dark .drawer_divider { background: #4a3035; }

body.dark .drawer_footer { border-top-color: #4a3035; }

/* ── MOBILE ── */
@media (max-width: 640px) {
    .menu_bar {
        padding: 0 16px;
    }

    .logo {
        padding-left: 0;
    }

    .logo_img {
        height: 24px;
    }

    .nav_section {
        display: none;
    }
}

/* ── CUSTOM MODAL (styled replacement for alert/confirm) ── */
.si_modal_overlay {
    position: fixed;
    inset: 0;
    background: rgba(8, 7, 5, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    animation: si_fade 0.15s ease;
}

.si_modal {
    background: #FFFFFA;
    color: #080705;
    width: 100%;
    max-width: 380px;
    border-radius: 14px;
    padding: 24px;
    box-shadow: 0 20px 50px rgba(8, 7, 5, 0.3);
    animation: si_pop 0.15s ease;
}

.si_modal_title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 8px;
}

.si_modal_msg {
    font-size: 14px;
    line-height: 1.5;
    color: #4a3035;
    white-space: pre-line;   /* lets messages use \n for line breaks */
}

.si_modal_input {
    width: 100%;
    margin-top: 14px;
    padding: 9px 12px;
    border: 1.5px solid #d0b0b5;
    border-radius: 8px;
    font-family: 'Saira', sans-serif;
    font-size: 14px;
    color: #080705;
    background: #FFFFFA;
    outline: none;
    box-sizing: border-box;
}

.si_modal_input:focus { border-color: #702632; }

.si_modal_actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 22px;
}

.si_modal_btn {
    padding: 9px 18px;
    border-radius: 8px;
    border: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.si_modal_confirm {
    background: #702632;
    color: #FFFFFA;
}

.si_modal_confirm:hover { background: #5a1e28; }

.si_modal_cancel {
    background: #e0cdd0;
    color: #080705;
}

.si_modal_cancel:hover { background: #d4bdc1; }

@keyframes si_fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes si_pop {
    from { transform: translateY(8px) scale(0.98); opacity: 0; }
    to   { transform: none; opacity: 1; }
}

body.dark .si_modal { background: #2c2022; color: #f0e8ea; }
body.dark .si_modal_msg { color: #cbb9bd; }
body.dark .si_modal_cancel { background: #4a3035; color: #f0e8ea; }
body.dark .si_modal_cancel:hover { background: #5a3d43; }
body.dark .si_modal_input { background: #241819; color: #f0e8ea; border-color: #4a3035; }
body.dark .si_modal_input:focus { border-color: #eeb9c2; }

/* ── SYNC ERROR BANNER (a change that didn't save to the server) ──
   Above the modal overlay, so a failed save inside a modal is still visible. */
.si_sync_banner {
    position: fixed;
    left: 50%;
    bottom: 20px;
    transform: translateX(-50%);
    width: max-content;
    max-width: calc(100% - 32px);
    box-sizing: border-box;
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px 10px 18px;
    border: 1px solid #ffc107;
    border-radius: 10px;
    background: #fff3cd;
    color: #856404;
    font-size: 13px;
    line-height: 1.4;
    box-shadow: 0 8px 24px rgba(8, 7, 5, 0.18);
    animation: si_fade 0.15s ease;
}

.si_sync_close {
    flex-shrink: 0;
    background: none;
    border: none;
    color: inherit;
    font-size: 16px;
    cursor: pointer;
}

body.dark .si_sync_banner { background: #2a200a; color: #ffc107; border-color: #5a4000; }
