/* ==========================================================================
   1. VARIABLES & RESET
   ========================================================================== */
:root {
    --sidebar-bg: #e6f1f6;
    --sidebar-bg-dark: #d6e7ef;
    --main-bg: #edf4f7;
    --card-bg: #ffffff;
    --card-border: #d8e4ea;
    --card-shadow: 0 10px 24px rgba(90, 120, 140, 0.10);
    --card-shadow-soft: 0 4px 12px rgba(90, 120, 140, 0.08);

    --sidebar-width: 240px;
    --topbar-height: 55px;

    --brand-blue: #1e40af;
    --brand-hover: #5c98b8;
    --brand-soft: #dff0f7;

    --text-on-dark: #2f4a57;
    --text-main: #36505c;
    --text-soft: #6f8792;
    --text-muted: #8da2ac;

    --input-bg: #f9fcfd;
    --input-border: #cfe0e7;
    --input-focus: rgba(110, 169, 199, 0.18);

    --button-bg: #7db5cb;
    --button-hover: #699fb4;
    --button-text: #ffffff;

    --active-bg: rgba(223, 240, 247, 0.22);
    --active-text: #ffffff;
    
    --footer-bg-dark: #243b45;
    --footer-bg: #cfe3ec;
    --footer-heading: #1e293b;
    --footer-text: #334155;
    --footer-text-muted: #475569;
    --footer-link: #334155;
    --footer-link-hover: #0f172a;
    --footer-border: rgba(0,0,0,0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--main-bg);
    color: var(--text-main);
    overflow-x: hidden;
}

/* ==========================================================================
   2. SIDEBAR (Default: Desktop Always On)
   ========================================================================== */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(
        180deg,
        #eef6fa 0%,
        #e6f1f6 50%,
        #d6e7ef 100%
    );

    color: #2f4a57;
    box-shadow: 4px 0 18px rgba(80, 110, 125, 0.08);
    z-index: 1200;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: transform 0.28s ease;
}

/* INNER WRAPPER */
.sidebar-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 25px 18px;
}

/* MENU TITLE */
.sidebar h2 {
    color: #e4f0f4;
    letter-spacing: 1px;
    font-size: 1.1rem;
    margin: 0;
}

/* NAV AREA (SCROLLABLE PART) */
.sidebar nav {
    margin-top: 18px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 4px;
}

/* HIDE SCROLLBAR (but still scrollable) */
.sidebar nav::-webkit-scrollbar {
    width: 0;
    height: 0;
}

.sidebar nav {
    scrollbar-width: none;
}

.mobile-sidebar-overlay {
    display: none;
}

/* SECTION LABELS */
.nav-label {
    margin-top: 16px;
    margin-bottom: 4px;
    font-size: 0.7rem;
    letter-spacing: 1px;
    color: #d7e7ed;
    opacity: 0.85;
}

/* LINKS */
.nav-link {
    display: block;
    padding: 7px 10px;
    border-radius: 8px;
    color: #36505c;
    text-decoration: none;
    font-size: 0.92rem;
    transition: all 0.15s ease;
}

/* HOVER */
.nav-link:hover {
    background: rgba(110, 169, 199, 0.15);
}

/* ACTIVE LINK */
.nav-link.active {
    background: rgba(110, 169, 199, 0.25);
    color: #2f4a57;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.10);
}

/* PANIC LINK SPECIAL */
.nav-link[style*="ff8a8a"] {
    font-weight: 600;
}

/* MOBILE (optional future-proofing) */
@media (max-height: 700px) {
    .sidebar nav {
        gap: 2px;
    }

    .nav-link {
        padding: 6px 8px;
        font-size: 0.88rem;
    }
}

/* ==========================================================================
   3. TOPBAR
   ========================================================================== */
.topbar {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    height: var(--topbar-height);
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    padding: 0 16px;
    box-shadow: 0 2px 12px rgba(100, 130, 145, 0.08);
    border-bottom: 1px solid #dbe7ec;
    z-index: 1100;
    transition: all 0.3s ease;
}

.topbar-inner {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-width: 0;
}

.toggle-btn {
    display: none;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 0;
    color: var(--brand-blue);
    font-size: 24px;
    cursor: pointer;
    margin-right: 12px;
    padding: 4px 6px;
    line-height: 1;
    z-index: 1200;
}

.logo-wrap {
    margin: 0;
    min-width: 0;
    display: flex;
    align-items: center;
}

.logo-link {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    min-width: 0;
}

.logo-link img {
    height: 25px; /* slightly bigger = more presence */
    width: auto;
    display: block;
    filter: drop-shadow(0 4px 10px rgba(59,130,246,0.25)); /* subtle glow */
}

.logo-text {
    color: var(--brand-blue);
    font-size: 1.1rem; /* slightly tighter */
    font-weight: 800; /* stronger = more SaaS */
    letter-spacing: 0.2px; /* fix the squish from -0.3 */
    white-space: nowrap;
}

/* ==========================
   TOPBAR RIGHT (Notifications + User)
   ========================== */

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

.auth-section {
    position: relative;
    flex-shrink: 0;
}

.user-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f7fbfc;
    padding: 5px 10px;
    border-radius: 999px;
    cursor: pointer;
    border: 1px solid #d9e6eb;
    transition: background 0.2s, border-color 0.2s;
    max-width: 180px;
}

.user-pill:hover {
    background: #eef5f8;
    border-color: #c8dbe3;
}

.avatar {
    width: 30px;
    height: 30px;
    background: linear-gradient(135deg, #7db5cb 0%, #6ea9c7 100%);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    flex-shrink: 0;
}

.user-name {
    color: var(--text-main);
    font-weight: 600;
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 90px;
}

.user-caret {
    font-size: 0.68rem;
    color: var(--text-soft);
    flex-shrink: 0;
}

/* ==========================================================================
   3. TOPBAR2
   ========================================================================== */
.topbar-index {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--topbar-height);
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    padding: 0 16px;
    box-shadow: 0 2px 12px rgba(100, 130, 145, 0.08);
    border-bottom: 1px solid #dbe7ec;
    z-index: 1100;
    transition: all 0.3s ease;
}

.topbar-index-inner {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-width: 0;
}

.admin-notice-bar {
    position: fixed;
    top: var(--topbar-height);
    left: var(--sidebar-width);
    right: 0;
    z-index: 1090;
    background: linear-gradient(180deg, #e8f6ff 0%, #d8eefc 100%);
    border-bottom: 1px solid #b7dff5;
    box-shadow: 0 6px 18px rgba(78, 144, 184, 0.12);
}

.admin-notice-inner {
    min-height: 52px;
    padding: 10px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.admin-notice-content {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1;
}

.admin-notice-icon {
    width: 32px;
    height: 32px;
    border-radius: 999px;
    background: rgba(74, 144, 226, 0.14);
    color: #1f6fa5;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    flex-shrink: 0;
}

.admin-notice-text {
    min-width: 0;
}

.admin-notice-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #1f4f6b;
    margin-bottom: 2px;
}

.admin-notice-message {
    font-size: 0.88rem;
    color: #355c72;
    line-height: 1.4;
    word-wrap: break-word;
}

.admin-notice-action {
    flex-shrink: 0;
}

.admin-notice-btn {
    background: #4f9dca;
    color: #fff;
    border: 0;
    border-radius: 8px;
    padding: 8px 12px;
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    line-height: 1;
    transition: background 0.15s ease, transform 0.15s ease;
    box-shadow: 0 2px 8px rgba(79, 157, 202, 0.22);
}

.admin-notice-btn:hover {
    background: #418cb7;
}

@media (max-width: 900px) {
    .admin-notice-bar {
        left: 0;
    }

    .admin-notice-inner {
        flex-direction: column;
        align-items: stretch;
    }

    .admin-notice-action {
        width: 100%;
    }

    .admin-notice-btn {
        justify-content: center;
        width: 100%;
    }
}

/* ==========================================================================
   4. MAIN CONTENT AREA
   ========================================================================== */
.main-container {
    width: calc(100% - var(--sidebar-width));
    margin-left: var(--sidebar-width);
    margin-top: calc(var(--topbar-height) + var(--admin-alert-height));
    min-height: calc(100vh - var(--topbar-height) - var(--admin-alert-height));
    padding: 20px;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

/* MENU BAR */
.main-menu {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 14px;
    padding: 12px 20px;
    box-shadow: var(--card-shadow-soft);
    box-sizing: border-box;
    width: 100%;
    margin-bottom: 15px;
}

.bluebutton {
    background: var(--button-bg);
    color: var(--button-text);
    padding: 6px 12px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s ease;
    line-height: 1;
    box-shadow: 0 2px 8px rgba(109, 159, 180, 0.18);
}

.bluebutton:hover {
    background: var(--button-hover);
}

.bluebutton:active {
    transform: translateY(0);
}

.menu-left {
    display: flex;
    gap: 10px;
}

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

.menu-dropdown {
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    color: var(--text-main);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.menu-dropdown:hover {
    border-color: var(--brand-blue);
    background: #f4fafc;
}

.menu-dropdown:focus {
    border-color: var(--brand-blue);
    box-shadow: 0 0 0 3px var(--input-focus);
}

.main-content {
    background-color: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 14px;
    width: 100%;
    padding: 20px;
    box-shadow: var(--card-shadow);
    box-sizing: border-box;
}

/* HEADINGS */
h1 {
    margin: 0;
    color: var(--text-main);
    font-size: 2rem;
    line-height: 1.2;
    text-align: center;
    position: relative;
    padding-bottom: 12px;
}

h1::after {
    content: "";
    display: block;
    width: 90%;
    height: 2px;
    margin: 10px auto 0;
    background: linear-gradient(to right, transparent, var(--brand-blue), transparent);
    border-radius: 2px;
}

h2 {
    margin: 0;
    color: var(--text-main);
    font-size: 2rem;
    line-height: 1.2;
}

.auth-tagline {
    margin: 5px 0 0 0;
    color: var(--text-soft);
    font-size: 1.1rem;
}

/* ==========================================================================
   5. RESPONSIVE DESIGN
   ========================================================================== */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        box-shadow: 8px 0 24px rgba(70, 95, 110, 0.18);
    }

    body.sidebar-open .sidebar {
        transform: translateX(0);
    }

    .mobile-sidebar-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(80, 105, 120, 0.30);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.25s ease;
        z-index: 1150;
    }

    body.sidebar-open .mobile-sidebar-overlay {
        opacity: 1;
        pointer-events: auto;
    }

    .topbar {
        left: 0;
        right: 0;
        padding: 0 12px;
    }

    .toggle-btn {
        display: inline-flex;
    }

    .logo-text {
        display: none;
    }

    .logo-link img {
        height: 24px;
    }

    .user-pill {
        padding: 4px 8px;
        gap: 6px;
        max-width: 130px;
    }

    .avatar {
        width: 28px;
        height: 28px;
        font-size: 0.76rem;
    }

    .user-name {
        font-size: 0.8rem;
        max-width: 60px;
    }

    .user-caret {
        display: none;
    }

    .main-container {
        width: 100%;
        margin-left: 0;
        margin-top: var(--topbar-height);
        padding-left: 15px;
        padding-right: 15px;
    }
}

@media (max-width: 480px) {
    .user-name {
        display: none;
    }

    .user-pill {
        padding: 4px 6px;
    }

    .topbar-inner {
        gap: 8px;
    }
}

/* ==========================================================================
   6. UI COMPONENTS (Footer)
   ========================================================================== */
.site-footer {
    width: 100%;
    background: var(--footer-bg);
    border-top: 1px solid var(--footer-border);
    padding: 25px 0;
    margin-top: auto;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 40px;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 15px;
}

.footer-section h4 {
    color: var(--footer-heading);
    margin-bottom: 8px;
    font-size: 1rem;
}

.footer-section p {
    color: var(--footer-text-muted);
    font-size: 0.85rem;
    margin: 0;
}

.footer-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-links li {
    margin-bottom: 4px;
}

.footer-links a {
    color: var(--footer-link);
    text-decoration: none;
    transition: 0.3s;
    font-size: 0.85rem;
}

.footer-links a:hover {
    color: var(--footer-link-hover);
    padding-left: 5px;
}

/* Utility Class for alignment */
.nav-back {
    display: inline-block;
    width: 100%;
    text-align: left;
    margin-top: 25px;
    color: var(--brand-hover);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s ease;
}

.nav-back:hover {
    color: var(--brand-blue);
}

/* Pagination - Calm Theme */

.pagination {
    margin-top: 18px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Base button */
.page-btn {
    padding: 6px 12px;
    background: #ffffff;
    border: 1px solid #d8e4ea;
    border-radius: 8px;
    text-decoration: none;
    color: #36505c;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.15s ease;
    box-shadow: 0 2px 6px rgba(90, 120, 140, 0.06);
}

/* Hover */
.page-btn:hover {
    background: #edf6fa;
    border-color: #7db5cb;
    color: #5c98b8;
    transform: translateY(-1px);
}

/* Active */
.page-btn.active {
    background: #7db5cb;
    color: #ffffff;
    border-color: #699fb4;
    box-shadow: 0 4px 12px rgba(109, 159, 180, 0.18);
}

/* Optional: disabled (if you use it later) */
.page-btn.disabled {
    opacity: 0.5;
    pointer-events: none;
    box-shadow: none;
}

.password-tips {
    margin-top: 18px;
}

/* 🔥 HARD RESET CHECKBOXES */
input[type="checkbox"] {
    appearance: auto !important;
    -webkit-appearance: checkbox !important;
    -moz-appearance: checkbox !important;

    width: 16px !important;
    height: 16px !important;

    padding: 0 !important;
    margin: 0 !important;

    background: none !important;
    border: none !important;
    box-shadow: none !important;

    cursor: pointer;
}

/* ==========================================================================
   7. MOBILE POLISH / GLOBAL RESPONSIVE SAFETY NET
   ========================================================================== */
img,
svg,
canvas,
video,
iframe {
    max-width: 100%;
}

.main-content,
.card,
.community-post-card,
.community-compose-card,
.community-report-card {
    min-width: 0;
}

.main-content table,
.card table {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.main-content table tbody,
.main-content table thead,
.main-content table tr,
.card table tbody,
.card table thead,
.card table tr {
    width: 100%;
}

@media (max-width: 900px) {
    .main-menu {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding: 14px;
    }

    .menu-left,
    .menu-right {
        width: 100%;
        flex-wrap: wrap;
    }

    .main-content {
        padding: 16px;
    }

    h1 {
        font-size: 1.7rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    .footer-content {
        padding: 0 20px;
    }
}

@media (max-width: 768px) {
    body.sidebar-open {
        overflow: hidden;
    }

    .main-container {
        padding: 12px;
    }

    .bluebutton,
    .menu-dropdown,
    .menu-left > a,
    .menu-right > a,
    .menu-right > select,
    .menu-right > button {
        width: 100%;
        justify-content: center;
    }

    .topbar-right {
        gap: 6px;
    }

    .site-footer {
        padding: 20px 0;
    }
}

@media (max-width: 560px) {
    .main-content {
        padding: 14px;
        border-radius: 12px;
    }

    .main-menu {
        border-radius: 12px;
    }

    h1 {
        font-size: 1.45rem;
        padding-bottom: 10px;
    }

    .auth-tagline {
        font-size: 0.98rem;
    }
}


/* ==========================================================================
   LANDING / NO SIDEBAR LAYOUT OVERRIDES
   ========================================================================== */
body.no-sidebar .sidebar,
body.landing-no-sidebar .sidebar {
    display: none !important;
}

body.no-sidebar .topbar,
body.landing-no-sidebar .topbar {
    left: 0;
}

body.no-sidebar .toggle-btn,
body.landing-no-sidebar .toggle-btn {
    display: none !important;
}

body.no-sidebar .main-container,
body.landing-no-sidebar .main-container {
    width: 100%;
    margin-left: 0;
}

body.landing-no-sidebar .main {
    padding-top: calc(var(--topbar-height) + 12px);
}

body.landing-no-sidebar .hero-section {
    padding-top: 56px;
}

body.landing-no-sidebar .section-container {
    max-width: 1200px;
}

@media (max-width: 768px) {
    body.no-sidebar .topbar,
    body.landing-no-sidebar .topbar {
        left: 0;
    }

    body.no-sidebar .main-container,
    body.landing-no-sidebar .main-container {
        width: 100%;
        margin-left: 0;
        padding-left: 15px;
        padding-right: 15px;
    }

    body.landing-no-sidebar .main {
        padding-top: calc(var(--topbar-height) + 8px);
    }

    body.landing-no-sidebar .hero-section {
        padding-top: 42px;
        padding-bottom: 70px;
    }
}
