/* ============================================================
   Qinect Hub — Layout
   Sidebar (desktop) + Bottom tabs (mobile) + Header
============================================================ */

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

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

body.network-body {
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.6;
    color: var(--color-text);
    background: var(--color-bg);
    min-height: 100vh;
    min-height: 100dvh;
    -webkit-font-smoothing: antialiased;
}

body.public-page,
body.fullbleed-page {
    background: var(--color-dark);
}

a { color: var(--color-purple); text-decoration: none; }
a:hover { color: var(--color-purple-light); }

h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 700; line-height: 1.2; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.4rem; font-weight: 600; }
h3 { font-size: 1.15rem; font-weight: 600; }
h4 { font-size: 1rem; font-weight: 600; }

img { max-width: 100%; height: auto; }

/* --- Sidebar (Desktop) --- */
.sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: var(--sidebar-width);
    background: var(--color-dark);
    display: flex;
    flex-direction: column;
    z-index: 100;
    overflow-y: auto;
}

.sidebar-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

.sidebar-logo img { height: 26px; }

.sidebar-logo-label,
.mobile-logo-label,
.public-logo-label,
.footer-brand-label {
    font-family: var(--font-display);
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.45);
    margin-top: 2px;
}

.sidebar-nav {
    flex: 1;
    padding: 0.75rem 0;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 1.5rem;
    color: rgba(255,255,255,0.6);
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    transition: all var(--transition-fast);
    border-left: 3px solid transparent;
}

.sidebar-link:hover {
    color: #fff;
    background: rgba(255,255,255,0.04);
}

.sidebar-link.active {
    color: var(--color-aqua);
    background: var(--color-dark-light);
    border-left-color: var(--color-aqua);
}

.sidebar-link svg { flex-shrink: 0; opacity: 0.7; }
.sidebar-link.active svg { opacity: 1; }

.sidebar-divider {
    height: 1px;
    background: rgba(255,255,255,0.06);
    margin: 0.5rem 1.5rem;
}

/* Sidebar user panel */
.sidebar-user {
    padding: 1rem 1.25rem;
    border-top: 1px solid rgba(255,255,255,0.06);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--color-dark-mid);
    flex-shrink: 0;
}

.sidebar-user-link {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex: 1;
    text-decoration: none;
    min-width: 0;
}

.sidebar-user-info {
    flex: 1; min-width: 0;
}

.sidebar-user-info strong {
    display: block;
    font-size: 0.82rem;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-info small {
    display: block;
    font-size: 0.72rem;
    color: rgba(255,255,255,0.4);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-logout-form { margin: 0; }

.sidebar-logout-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,0.35);
    cursor: pointer;
    padding: 0.35rem;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    display: flex;
}

.sidebar-logout-btn:hover { color: var(--color-danger); background: rgba(255,255,255,0.05); }

/* --- Mobile Header --- */
.mobile-header {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--header-height);
    background: var(--color-dark);
    padding: 0 1rem;
    align-items: center;
    justify-content: space-between;
    z-index: 100;
}

.mobile-header-logo {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    text-decoration: none;
}

.mobile-header-logo img { height: 22px; }

.mobile-header-actions { display: flex; align-items: center; gap: 0.75rem; }

.mobile-avatar-link { display: flex; }

/* --- Bottom Tabs (Mobile) --- */
.bottom-tabs {
    display: none;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: var(--bottom-tab-height);
    background: var(--color-dark);
    padding-bottom: env(safe-area-inset-bottom, 8px);
    justify-content: space-around;
    align-items: center;
    z-index: 100;
    border-top: 1px solid rgba(255,255,255,0.06);
}

.bottom-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    padding: 0.4rem 0.75rem;
    color: rgba(255,255,255,0.45);
    font-size: 0.65rem;
    font-weight: 500;
    text-decoration: none;
    transition: color var(--transition-fast);
    min-width: 0;
}

.bottom-tab:hover,
.bottom-tab.active { color: var(--color-aqua); }

.bottom-tab svg { width: 22px; height: 22px; }

/* --- Main Content --- */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    min-height: 100dvh;
    padding: 2rem;
    background: var(--color-surface);
}

.main-content.main-fullbleed {
    padding: 0;
    background: var(--color-dark);
}

/* --- Public Layout --- */
.public-header {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--header-height);
    background: var(--color-dark);
    z-index: 100;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.public-header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.public-header-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

.public-header-logo img { height: 26px; }

.public-nav { display: flex; align-items: center; gap: 0.75rem; }

.public-content {
    padding-top: var(--header-height);
    min-height: 100vh;
    min-height: 100dvh;
}

/* --- Public Footer --- */
.public-footer {
    background: var(--color-dark-mid);
    border-top: 1px solid rgba(255,255,255,0.06);
    padding: 2rem 0;
}

.public-footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 1rem;
}

.footer-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    justify-self: start;
}

.footer-brand img { height: 22px; }

.footer-links {
    display: flex;
    gap: 1.5rem;
    justify-self: center;
    flex-wrap: wrap;
    justify-content: center;
}
.footer-links a, .footer-links button { color: rgba(255,255,255,0.5); font-size: 0.85rem; }
.footer-links a:hover, .footer-links button:hover { color: var(--color-aqua); }

.footer-copy { color: rgba(255,255,255,0.3); font-size: 0.8rem; justify-self: end; white-space: nowrap; }

/* --- Avatar --- */
.avatar-img {
    border-radius: 50%;
    object-fit: cover;
}

.avatar-initials {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--gradient-avatar);
    color: #fff;
    font-family: var(--font-display);
    font-weight: 600;
    flex-shrink: 0;
}

/* --- Flash Alerts --- */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.25rem;
    font-size: 0.9rem;
    font-weight: 500;
}

.alert-success { background: var(--color-success-soft); color: #0d6e3a; border: 1px solid #b8efd0; }
.alert-error   { background: var(--color-danger-soft);  color: #a5222e; border: 1px solid #f5c1c6; }
.alert-warning { background: var(--color-warning-soft); color: #7a5311; border: 1px solid #f5dba8; }
.alert-info    { background: var(--color-purple-soft);  color: var(--color-purple); border: 1px solid #c8bff0; }

/* ============================================================
   RESPONSIVE
============================================================ */

@media (max-width: 767px) {
    .sidebar { display: none; }
    .mobile-header { display: flex; }
    .bottom-tabs { display: flex; }

    .main-content {
        margin-left: 0;
        padding: 1rem;
        padding-top: calc(var(--header-height) + 1rem);
        padding-bottom: calc(var(--bottom-tab-height) + 1rem + env(safe-area-inset-bottom, 8px));
        background: var(--color-surface);
    }

    .main-content.main-fullbleed {
        padding: 0;
        padding-top: var(--header-height);
        padding-bottom: calc(var(--bottom-tab-height) + env(safe-area-inset-bottom, 8px));
        background: var(--color-dark);
    }

    .public-footer-inner {
        grid-template-columns: 1fr;
        justify-items: center;
        text-align: center;
        gap: 1.25rem;
    }

    .footer-brand {
        justify-self: center;
    }

    .footer-links {
        flex-direction: column;
        align-items: center;
        gap: 0.75rem;
    }

    .footer-copy {
        justify-self: center;
    }

    h1 { font-size: 1.4rem; }
    h2 { font-size: 1.2rem; }
}

@media (min-width: 768px) {
    .bottom-tabs { display: none !important; }
    .mobile-header { display: none !important; }
    .sidebar { display: flex; }
}
