/*
File: global.css
Purpose: Shared global styles used by all pages (fonts, base background, and utility classes).
Notes: Peyda is loaded via <link href="assets/fonts/peyda.css"> on dashboard pages, not imported here.
*/
:root {
    --vvh: 100vh;
    --font-sans: 'PeydaFaNumWeb', Tahoma, sans-serif;
    --default-font-family: 'PeydaFaNumWeb', Tahoma, sans-serif;
    --banner-gap: 16px;
    --banner-side-gap: 16px;
    --banner-bg: #0078d7;
    --topic-accent: #0078d7;
}
@supports (height: 100dvh) {
    :root { --vvh: 100dvh; }
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

html,
body,
button,
input,
select,
textarea {
    font-family: 'PeydaFaNumWeb', Tahoma, sans-serif !important;
}

body {
    background: #f0f4f8;
}

#app-notice {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 4000;
    max-width: min(440px, calc(100% - 32px));
    padding: 12px 18px;
    border-radius: 12px;
    background: #1b242e;
    color: #ffffff;
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1.6;
    text-align: center;
    box-shadow: 0 10px 24px rgba(27, 36, 46, 0.18);
    direction: rtl;
}
#app-notice[hidden] {
    display: none !important;
}
#app-notice[data-kind="error"] {
    background: #3f2a2a;
}

/* Leaflet ships Helvetica/Arial on the map pane; keep Peyda there too. */
.leaflet-container,
.leaflet-popup,
.leaflet-popup-content-wrapper,
.leaflet-popup-content,
.leaflet-tooltip,
.leaflet-control,
.leaflet-bar {
    font-family: 'PeydaFaNumWeb', Tahoma, sans-serif !important;
}

.h-screen {
    height: 100vh;
    height: var(--vvh);
}

#top-banner {
    position: absolute;
    top: var(--banner-gap);
    left: var(--banner-side-gap);
    right: var(--banner-side-gap);
    width: calc(100% - 2 * var(--banner-side-gap));
    margin: 0;
    height: 75px;
    flex-shrink: 0;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 25px;
    color: #ffffff;
    z-index: 2000;
    box-shadow: none;
    border-radius: 12px;
}
#top-banner::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: var(--banner-bg);
    z-index: -1;
    box-shadow: 0 4px 15px rgba(0,0,0,0.25);
    transition: background-color 0.6s ease, box-shadow 0.6s ease;
}
.banner-right { display: flex; align-items: center; gap: 20px; position: relative; }
.banner-left { display: flex; align-items: center; }
.institution { display: flex; align-items: center; gap: 12px; }
#logo-img { height: 44px; width: auto; object-fit: contain; cursor: pointer; }
.banner-divider { width: 1px; height: 48px; background: rgba(255,255,255,0.18); margin: 0 14px; }
.project-texts { display: flex; flex-direction: column; line-height: 1.7; position: relative; }
.project-main { font-weight: 800; font-size: 0.95rem; color: #fff; }
.project-sub { font-size: 0.8rem; color: rgba(255,255,255,0.95); }
.top-nav { position: absolute; top: calc(40% + 37.5px); right: -200px; left: auto; display: flex; gap: 12px; z-index: -2; }
.hang-btn { width: 110px; height: 38px; padding: 6px 10px; border-radius: 10px; box-shadow: 0 6px 18px rgba(0,0,0,0.25); transform-origin: top center; }
.hang-btn .btn-label { font-size: 0.85rem; }
.banner-btn {
    height: 38px;
    color: #333333;
    background-color: #ffffff;
    border: 1px solid #d1d5db;
    border-bottom: 5px solid var(--topic-accent, #0078d7);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 800;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    position: relative;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    padding: 0 14px;
}
.banner-btn .btn-label { display: inline-block; font-weight: 800; }
.banner-btn span { position: relative; z-index: 10; }
.banner-btn:hover { transform: translateY(-2px); box-shadow: 0 4px 10px rgba(0,0,0,0.1); background-color: #f3f4f6; }
.banner-btn.is-current,
.hang-btn.is-current {
    background-color: var(--topic-accent, #0078d7);
    color: #ffffff;
    border-color: rgba(0,0,0,0.08);
    border-bottom-color: rgba(0,0,0,0.25);
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.2);
    transform: translateY(4px);
}
.banner-btn.is-current:hover,
.hang-btn.is-current:hover {
    background-color: var(--topic-accent, #0078d7);
    color: #ffffff;
    transform: translateY(4px);
}
.user-box { display: flex; align-items: center; gap: 10px; padding-right: 6px; flex-direction: row-reverse; }
.user-menu { position: relative; flex-shrink: 0; }
.user-circle {
    width: 44px; height: 44px; border-radius: 50%;
    background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.18);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; padding: 0; font: inherit; color: inherit;
    appearance: none; -webkit-appearance: none;
    transition: background 0.2s ease;
}
.user-circle:hover,
.user-circle.is-open { background: rgba(255,255,255,0.24); }
.user-menu-dropdown {
    position: absolute; top: calc(100% + 10px); left: 0;
    min-width: 132px; background: #ffffff; border: 1px solid #e5e7eb;
    border-radius: 12px; box-shadow: 0 10px 28px rgba(0,0,0,0.18);
    padding: 6px; z-index: 2300;
}
.user-menu-dropdown[hidden] { display: none; }
.user-exit-btn {
    display: flex; align-items: center; justify-content: flex-start; gap: 8px;
    width: 100%; padding: 10px 12px; border: none; background: transparent;
    color: #b91c1c; font-family: inherit; font-weight: 800; font-size: 0.9rem;
    border-radius: 8px; cursor: pointer;
}
.user-exit-btn:hover { background: #fef2f2; }
.user-texts { display: flex; flex-direction: column; line-height: 1.5; text-align: left; }
.user-name { font-weight: 800; color: #fff; font-size: 0.95rem; }
.user-role { font-size: 0.75rem; color: rgba(255,255,255,0.95); }

/* Lazy image background utilities */
.lazy-bg { background-size: cover; background-position: center; background-repeat: no-repeat; }
.bg-placeholder { background-color: #f3f4f6; }

/* iPhone / Samsung device preview: keep the desktop design, fit the frame */
@media (max-width: 767px) {
    html, body {
        max-width: 100%;
        overflow-x: hidden;
    }
    input, select, textarea {
        font-size: 16px !important;
    }
    #top-banner {
        height: auto;
        min-height: 64px;
        padding: 8px 10px;
        padding-top: max(8px, env(safe-area-inset-top));
        padding-left: max(10px, env(safe-area-inset-left));
        padding-right: max(10px, env(safe-area-inset-right));
        gap: 8px;
        flex-wrap: wrap;
        width: calc(100% - 16px) !important;
        left: 8px !important;
        right: 8px !important;
    }
    .project-sub,
    .user-role {
        display: none;
    }
    .banner-divider {
        display: none;
    }
    .banner-right {
        gap: 8px;
        min-width: 0;
        flex: 1 1 auto;
    }
    .project-main {
        font-size: 0.8rem;
    }
    .top-nav {
        position: static;
        right: auto;
        top: auto;
        margin-top: 6px;
        gap: 6px;
        z-index: 1;
        flex-wrap: wrap;
    }
    .hang-btn {
        width: auto;
        min-width: 64px;
        height: 32px;
        padding: 4px 8px;
    }
    .hang-btn .btn-label {
        font-size: 0.75rem;
    }
    .user-circle {
        width: 36px;
        height: 36px;
    }
    #logo-img {
        height: 32px !important;
    }
}