/* ============================================
   FILLENZA PORTAL - MAIN STYLESHEET
   Modular CSS Architecture
   ============================================ */

/* --- Import Core Styles --- */
@import url('core/layout.css');
@import url('core/components.css');
@import url('core/modals.css');
@import url('core/animations.css');

/* --- Import Theme Styles --- */
@import url('themes/light.css');
@import url('themes/dark.css');

/* --- Import Page-Specific Styles --- */
@import url('account-manage.css');

/* ============================================
   BASE & RESET
   ============================================ */

html,
body {
    height: 100%;
}

body {
    color: var(--text-color);
    font-family: 'Inter', -apple-system, sans-serif;
    margin: 0;
    line-height: 1.5;
    transition: background-color 0.3s ease, color 0.3s ease;
}

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

* {
    box-sizing: border-box;
}

/* ============================================
   BRANDING
   ============================================ */

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

.brand-logo {
    height: 32px;
    width: auto;
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--secondary-color);
}

/* Header Logo adjustments */
.top-header .logo-area {
    margin-left: 0.5rem;
}

@media (max-width: 1024px) {
    .top-header .logo-area {
        margin-left: 1.5rem;
    }
}

/* ============================================
   TYPOGRAPHY
   ============================================ */

.fillenza-card h1 {
    color: var(--primary-color);
    font-weight: 700;
}

/* ============================================
   LAYOUT - SIDEBAR & MAIN CONTENT
   ============================================ */

.layout-wrapper {
    display: flex;
    min-height: 100vh;
}

/* --- Sidebar --- */
.sidebar {
    width: var(--sidebar-width);
    background-color: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 50;
    transition: width 0.3s ease, transform 0.3s ease;
    overflow-y: auto;
    overflow-x: hidden;
    color: var(--text-color);
}

.sidebar::after {
    display: none;
}

.sidebar-content {
    padding: 1.5rem;
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* --- Main Content --- */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-width: 0;
    transition: margin-left 0.3s ease;
}

/* --- Top Header --- */
.top-header {
    height: var(--header-height);
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-bottom: none;
    box-shadow: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 40;
}

/* --- Menu Toggle Button --- */
.menu-toggle-btn {
    display: none;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-color);
    padding: 0.5rem;
    border-radius: 8px;
}

.menu-toggle-btn:hover {
    background: var(--gray-100);
}

/* ============================================
   NAVIGATION
   ============================================ */

.nav-stack {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-color);
    border-radius: 8px;
    transition: all 0.2s ease;
    font-weight: 500;
    text-decoration: none;
    position: relative;
    border: 1px solid transparent;
}

.nav-item.active {
    font-weight: 700;
    border-left: 4px solid var(--primary-color);
    border-radius: 4px 8px 8px 4px;
}

.nav-icon {
    opacity: 0.7;
    transition: opacity 0.2s;
}

.nav-section-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-color);
    opacity: 0.6;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    padding-left: 1rem;
}

/* ============================================
   THEME SWITCHER
   ============================================ */

.theme-toggle-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}

.theme-toggle-btn:hover {
    background: var(--gray-100);
    color: var(--primary-color);
}

.theme-icon {
    display: none;
    pointer-events: none;
}

/* Explicit Visibility Logic based on html[data-theme] attribute */
html[data-theme="dark"] .icon-sun {
    display: block;
}

html[data-theme="light"] .icon-moon {
    display: block;
}

html:not([data-theme="dark"]) .icon-moon {
    display: block;
}

html:not([data-theme="dark"]) .icon-sun {
    display: none;
}

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

/* Medium Screens (Tablet): Collapsed Sidebar */
@media (max-width: 1024px) {
    .sidebar {
        width: var(--sidebar-collapsed-width);
        transform: translateX(0);
    }

    .sidebar .logo-text,
    .sidebar .nav-item span {
        display: none;
    }

    .sidebar .nav-section-title {
        font-size: 0 !important;
        height: 2px;
        background: linear-gradient(90deg, transparent, var(--text-color), transparent);
        margin: 1.5rem auto 0.5rem auto !important;
        padding: 0 !important;
        width: 40px;
        opacity: 0.4;
        border-radius: 2px;
    }

    .sidebar.floating-open .nav-section-title {
        font-size: 0.75rem !important;
        height: auto;
        background: transparent;
        width: auto;
        opacity: 1;
        margin-top: 1.5rem !important;
        padding-left: 1rem !important;
    }

    .sidebar .nav-item {
        justify-content: center;
        padding: 1rem 0;
    }

    .sidebar .nav-item svg {
        width: 28px !important;
        height: 28px !important;
    }

    .main-content {
        margin-left: var(--sidebar-collapsed-width);
    }

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

    .sidebar.floating-open {
        width: var(--sidebar-width);
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.15);
        background-color: rgba(var(--glass-base-rgb), 0.95);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
    }

    .sidebar.floating-open .logo-text,
    .sidebar.floating-open .nav-item span {
        display: inline-block;
    }

    .sidebar.floating-open .nav-item {
        justify-content: flex-start;
        padding: 0.75rem 1rem;
    }

    .sidebar.floating-open .nav-item svg {
        width: 24px !important;
        height: 24px !important;
    }
}

/* Small Screens (Mobile): Hidden Sidebar */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-width);
    }

    .main-content {
        margin-left: 0;
    }

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

    .sidebar.floating-open {
        transform: translateX(0);
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.2);
        background-color: rgba(var(--glass-base-rgb), 0.95);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
    }

    .sidebar.floating-open .logo-text,
    .sidebar.floating-open .nav-item span {
        display: inline-block;
    }

    .sidebar.floating-open .nav-item {
        justify-content: flex-start;
    }
}

/* ============================================
   CUSTOM SCROLLBAR
   ============================================ */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}