/* ==========================================
   HANIHO NOBLE CORE LAYOUT
   ========================================== */

:root {
    --header-h: 64px;
    --footer-h: 48px;
    --left-w: 280px;
    --right-w: 460px;
    --app-height: 100dvh;
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    overflow-x: hidden;
    max-width: 100vw;
}

body.app-mode {
    overflow: hidden;
}

.app-container {
    display: grid;
    grid-template-columns: var(--left-w) 1fr var(--right-w);
    grid-template-rows: var(--header-h) 1fr 0px;
    height: 100dvh;
    height: -webkit-fill-available;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
    overflow-y: hidden;
    box-sizing: border-box;
}

header {
    grid-column: 1 / -1;
    height: var(--header-h);
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    z-index: 2000;
    position: relative;
    overflow: hidden;
}

#header-map-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
    opacity: 0.45;
    pointer-events: none;
}
header .header-content {
    position: relative;
    z-index: 1;
}

.header-content {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    flex-shrink: 0;
}

.header-logo-svg {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px;
    min-height: 32px;
    object-fit: contain;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
    margin-left: auto;
}

.header-brand-text {
    font-family: 'Syne', sans-serif;
    font-weight: 800;
    font-size: 1.4rem;
    letter-spacing: 1px;
    color: var(--text);
    text-transform: uppercase;
}

.header-nav-link {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text);
    font-weight: 700;
    font-size: 0.85rem;
    margin-right: 8px;
    white-space: nowrap;
}

#userSection {
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
}

.login-btn {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}

#userBtn {
    display: none;
    background: var(--surface2);
    border: 1px solid var(--border);
    padding: 8px 16px;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
    align-items: center;
    gap: 8px;
}

#userDropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    z-index: 3000;
    min-width: 200px;
}

.header-nav-icons {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-right: 16px;
    border-right: 1px solid var(--border);
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover {
    background: var(--surface2);
    color: var(--text);
}

.icon-btn.active {
    color: var(--accent);
    background: var(--accent-soft);
}

/* FOOTER STYLES — hidden on mobile via noble-overrides.css */
footer {
    grid-column: 1 / -1;
    grid-row: 3;
    height: var(--footer-h);
    min-height: var(--footer-h);
    background: var(--bg);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    font-size: 0.75rem;
    color: var(--text-muted);
    z-index: 1000;
    position: relative;
}

.footer-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.footer-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

footer .copyright {
    font-size: 0.7rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.footer-btn {
    padding: 6px 12px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-muted);
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    font-size: 0.7rem;
    transition: all 0.2s;
    white-space: nowrap;
}

.footer-btn:hover {
    background: var(--surface3);
    color: var(--text);
    border-color: var(--text-soft);
}

footer .links {
    display: flex;
    gap: 10px;
}

#panel-left {
    position: relative;
    grid-row: 2;
    background: var(--surface);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

#panel-center {
    grid-row: 2;
    background: var(--bg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    max-width: 100vw;
    box-sizing: border-box;
}

.center-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    background: var(--bg);
    max-width: 100%;
    box-sizing: border-box;
}

#placeMasterMount {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 16px;
    width: 100%;
    box-sizing: border-box;
}

/* Constrain all tab panels to a readable width */
.tab-panel > * {
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

#panel-right {
    grid-row: 2;
    background: var(--surface);
    border-left: 1px solid var(--border);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
    min-height: 0;
}
#rightPanelContext,
#rightPanelChat {
    flex: 1 1 0;
    min-height: 0;
    overflow: hidden;
}

/* Scrollbars */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-soft); }

.hidden { display: none !important; }

@media (max-width: 980px) {
    .app-container { grid-template-columns: 1fr; grid-template-rows: 0px 1fr 0px; }
    #panel-left, #panel-right { display: none; }
}
.sidebar-legal {
    position: sticky;
    bottom: 0;
    background: var(--surface);
    border-top: 1px solid var(--border);
    z-index: 10;
    padding: 12px 16px;
    font-size: 11px;
    color: rgba(255,255,255,0.25);
    text-align: center;
    flex-shrink: 0;
    margin-top: auto;
}
.sidebar-legal a {
    color: rgba(255,255,255,0.35);
    text-decoration: none;
}
.sidebar-legal a:hover {
    color: rgba(255,255,255,0.6);
}

/* ==========================================
   SHARED COMPONENT STYLES (moved from inline)
   ========================================== */

/* Center main content */
#center-main-content {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Auth & Settings Modal — shared form styles */
.auth-input {
    width: 100%;
    margin-bottom: 8px;
    box-sizing: border-box;
}
.auth-textarea {
    min-height: 90px;
    resize: vertical;
}
.auth-btn {
    width: 100%;
}
.auth-btn-flex { flex: 1; }
.auth-btn-row { display: flex; gap: 8px; }
.auth-tab-row, .settings-tab-row {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}
.auth-close-btn, .settings-close-btn {
    margin-left: auto;
}
.auth-helper-text {
    text-align: center;
    margin-top: 12px;
    font-size: 13px;
}
.auth-link {
    color: #8eb4ee;
    text-decoration: none;
}
.auth-instruction {
    font-size: 13px;
    color: var(--text2, #c7cfdd);
    margin-bottom: 12px;
}
.auth-verify-box { margin-top: 10px; }
.auth-status { margin-top: 10px; }

/* Settings-specific */
.settings-label-block { display: block; margin-top: 8px; }
.settings-description { color: var(--text-muted, #a9b4c7); font-size: 0.9rem; margin-bottom: 10px; }
.settings-consent-label {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    color: var(--text2, #c8d1de);
    font-size: 0.85rem;
    margin-bottom: 10px;
}
.settings-small-label { font-size: 0.78rem; color: var(--text-soft, #8ea0bb); margin-bottom: 8px; }
.contacts-list-container {
    max-height: 180px;
    overflow: auto;
    border: 1px solid var(--border, #223047);
    border-radius: 10px;
    padding: 8px;
    background: var(--bg, #090f18);
}

/* Guide Modal */
#pulsGuideModal { z-index: 99999; }
.guide-modal-content {
    max-width: 600px;
    padding: 0;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}
.guide-modal-header {
    padding: 15px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.guide-modal-body {
    max-height: 70vh;
    overflow-y: auto;
    padding: 15px;
}
.puls-news-modal-title { margin: 0; }
.modal-close-btn {
    background: none;
    border: none;
    color: var(--text, white);
    font-size: 24px;
    cursor: pointer;
}

/* Onboarding brand */
.onboarding-brand-unit {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-bottom: 32px;
}
.onboarding-brand-logo {
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-family: 'Syne', sans-serif;
    font-weight: 800;
    font-size: 3rem;
    box-shadow: 0 12px 32px rgba(37, 99, 235, 0.3);
}
.onboarding-brand-title {
    font-family: 'Syne', sans-serif;
    font-weight: 800;
    font-size: 3.5rem;
    letter-spacing: 2px;
    color: #ffffff;
    text-transform: uppercase;
    margin: 0;
    line-height: 1;
}

/* MEHR Panel extra classes */
.mobile-more-title { font-weight: 800; font-size: 1.1rem; }
.mobile-more-close-btn {
    background: none;
    border: none;
    color: var(--text);
    font-size: 1.4rem;
    cursor: pointer;
}
.mobile-more-divider {
    height: 1px;
    background: var(--border, #2a2a3a);
    margin: 8px 16px;
}
.mobile-more-logout { color: var(--red, #e53e3e); }
