/* =============================================
   MAIN.CSS - Superwoman Calendar Design System
   Aesthetic: "Soft Power" - Refined minimalism with warm feminine energy
   ============================================= */

/* Google Fonts Import */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,100..1000;1,9..40,100..1000&family=Instrument+Serif:ital@0;1&display=swap');

/* Design System Variables */
:root {
    /* Typography */
    --font-display: 'Instrument Serif', Georgia, serif;
    --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;

    /* Base Colors - Warm Neutrals */
    --white: #FFFCFA;
    --off-white: #FAF8F5;
    --cream: #F5F2ED;
    --sand: #EBE6DE;
    --stone: #D9D3C9;
    --warm-gray: #9A9389;
    --charcoal: #4A4640;
    --ink: #2D2A26;

    /* Cycle Phase Colors - The Heart of Superwoman */
    --phase-menstrual: #E8847C;
    --phase-menstrual-light: #FDF0EF;
    --phase-follicular: #F4A574;
    --phase-follicular-light: #FEF5EE;
    --phase-ovulation: #7CB5A0;
    --phase-ovulation-light: #EEF7F3;
    --phase-luteal: #9B8EC4;
    --phase-luteal-light: #F4F2FA;

    /* Accent Colors */
    --coral: #E8847C;
    --coral-soft: rgba(232, 132, 124, 0.12);
    --sage: #7CB5A0;
    --sage-soft: rgba(124, 181, 160, 0.12);
    --lavender: #9B8EC4;
    --lavender-soft: rgba(155, 142, 196, 0.12);
    --honey: #E8C56C;
    --honey-soft: rgba(232, 197, 108, 0.12);

    /* UI Colors */
    --border: rgba(45, 42, 38, 0.08);
    --border-strong: rgba(45, 42, 38, 0.15);
    --shadow-sm: 0 1px 2px rgba(45, 42, 38, 0.04);
    --shadow-md: 0 4px 12px rgba(45, 42, 38, 0.08);
    --shadow-lg: 0 12px 32px rgba(45, 42, 38, 0.12);
    --shadow-xl: 0 24px 48px rgba(45, 42, 38, 0.16);

    /* Spacing Scale */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;
    --space-12: 48px;
    --space-16: 64px;

    /* Layout */
    --sidebar-width: 250px;
    --right-panel-width: 340px;
    --header-height: 56px;

    /* Transitions */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
    --duration-fast: 150ms;
    --duration-normal: 250ms;
    --duration-slow: 400ms;

    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --radius-full: 9999px;
}

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 400;
    line-height: 1.5;
    color: var(--ink);
    background: var(--off-white);
    overflow: hidden;
    height: 100vh;
}

::selection {
    background: var(--coral-soft);
    color: var(--ink);
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--stone);
    border-radius: var(--radius-full);
    border: 2px solid transparent;
    background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--warm-gray);
    border: 2px solid transparent;
    background-clip: padding-box;
}

/* Main App Container - Three column layout (sidebar, calendar, right panel) */
.app-container {
    display: flex;
    flex-direction: row;
    height: calc(100vh - var(--header-height));
    margin-left: var(--sidebar-width);  /* Account for fixed sidebar */
    margin-top: var(--header-height);   /* Account for fixed nav */
    background: var(--white);
    transition: margin-left var(--duration-slow) var(--ease-out);
}

/* When sidebar is collapsed */
.app-container.sidebar-collapsed {
    margin-left: 0;
}

/* =============================================
   TOP NAVIGATION BAR
   ============================================= */

.top-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header-height);
    padding: 0 var(--space-6);
    background: #FFFFFF;  /* Pure white */
    border-bottom: 1px solid var(--border);
    position: fixed;
    top: 0;
    left: var(--sidebar-width);  /* Start after sidebar */
    right: 0;
    z-index: 99;
    transition: left var(--duration-slow) var(--ease-out);
}

/* When sidebar is collapsed, nav extends full width */
.top-nav.sidebar-collapsed {
    left: 0;
}

/* Nav sidebar icons - Hidden by default, shown when sidebar collapsed */
.nav-sidebar-icons {
    display: none;
    align-items: center;
    gap: 4px;
    margin-right: var(--space-4);
}

/* Show when sidebar is collapsed */
.nav-sidebar-icons.visible {
    display: flex;
}

.nav-sidebar-icons .nav-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    color: #6B7280;
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
}

.nav-sidebar-icons .nav-icon:hover {
    background: #EBEBEB;
    color: #1A1A1A;
}

.nav-left {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    margin-right: auto;  /* Push nav-right to the far right, keeping nav-left on the left */
}

/* Month Navigation Group */
.month-nav {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.current-month {
    font-size: 16px;
    font-weight: 600;
    color: var(--ink);
    letter-spacing: 0.5px;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

/* Search Box - Pill-shaped minimal design */
.search-box {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 18px;
    background: #F1F1F1;
    border: none;
    border-radius: 50px;  /* Fully rounded pill shape */
    min-width: 220px;
    width: 250px;
    transition: all var(--duration-fast) var(--ease-out);
}

.search-box:focus-within {
    background: #EAEAEA;
}

.search-box svg {
    width: 18px;
    height: 18px;
    color: #9CA3AF;
    flex-shrink: 0;
}

.search-box input {
    width: 100%;
    border: none;
    background: transparent;
    font-family: var(--font-body);
    font-size: 14px;
    color: #6B7280;
    outline: none;
}

.search-box input::placeholder {
    color: #BABABA;
}

/* Account Avatar */
.account-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, #4ECDC4, #3AAFA9);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: transform var(--duration-fast) var(--ease-out),
                box-shadow var(--duration-fast) var(--ease-out);
}

.account-avatar:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-md);
}

/* User Avatar */
.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--coral) 0%, var(--phase-follicular) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: transform var(--duration-fast) var(--ease-out),
                box-shadow var(--duration-fast) var(--ease-out);
    border: none;
}

.user-avatar:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-md);
}

/* Logo/Brand */
.brand {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.brand-mark {
    width: 26px;
    height: 26px;
    background: linear-gradient(135deg, var(--coral) 0%, var(--lavender) 100%);
    border-radius: var(--radius-sm);
    position: relative;
    overflow: hidden;
}

.brand-mark::after {
    content: '';
    position: absolute;
    inset: 3px;
    background: var(--white);
    border-radius: 3px;
    opacity: 0.9;
}

.brand-name {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 400;
    color: var(--ink);
    letter-spacing: -0.02em;
    font-style: italic;
}

/* View Dropdown */
.view-dropdown {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-2) var(--space-3);
    background: var(--white);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 500;
    color: var(--ink);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
}

.view-dropdown:hover {
    background: var(--cream);
    border-color: var(--stone);
}

.view-dropdown svg {
    width: 16px;
    height: 16px;
    color: var(--warm-gray);
}

/* Today Button */
.today-btn {
    padding: var(--space-2) var(--space-4);
    background: var(--white);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 500;
    color: var(--ink);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
}

.today-btn:hover {
    background: var(--cream);
    border-color: var(--stone);
}

/* Navigation Arrows */
.nav-arrows {
    display: flex;
    align-items: center;
    gap: 2px;
}

.nav-arrow {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    color: var(--charcoal);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
}

.nav-arrow:hover {
    background: var(--cream);
    color: var(--ink);
}

.nav-arrow svg {
    width: 18px;
    height: 18px;
}

/* Date Range Display */
.date-range {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 400;
    color: var(--ink);
    letter-spacing: -0.01em;
    min-width: 180px;
    text-align: center;
}

/* Search Bar */
.search-bar {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    background: var(--cream);
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    transition: all var(--duration-fast) var(--ease-out);
}

.search-bar:focus-within {
    background: var(--white);
    border-color: var(--stone);
    box-shadow: var(--shadow-sm);
}

.search-bar svg {
    width: 16px;
    height: 16px;
    color: var(--warm-gray);
    flex-shrink: 0;
}

.search-bar input {
    width: 160px;
    border: none;
    background: transparent;
    font-family: var(--font-body);
    font-size: 13px;
    color: var(--ink);
    outline: none;
}

.search-bar input::placeholder {
    color: var(--warm-gray);
}

/* Settings Button */
.settings-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    color: var(--charcoal);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
}

.settings-btn:hover {
    background: var(--cream);
    color: var(--ink);
}

.settings-btn svg {
    width: 18px;
    height: 18px;
}

/* =============================================
   THREE-COLUMN LAYOUT
   Note: .calendar-main styles are in calendar.css
   ============================================= */

/* Overlay for closing panel */
.panel-overlay {
    position: fixed;
    inset: 0;
    background: rgba(45, 42, 38, 0.1);
    opacity: 0;
    visibility: hidden;
    transition: all var(--duration-normal) var(--ease-out);
    z-index: 150;
}

.main-layout.panel-open .panel-overlay {
    opacity: 1;
    visibility: visible;
}

/* Utility Classes */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus Styles */
:focus-visible {
    outline: 2px solid var(--coral);
    outline-offset: 2px;
}

button:focus:not(:focus-visible) {
    outline: none;
}

/* Icon Button Base */
.icon-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    color: var(--charcoal);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
}

.icon-btn:hover {
    background: var(--cream);
    color: var(--ink);
}

.icon-btn svg {
    width: 18px;
    height: 18px;
}

/* =============================================
   MOBILE SIDEBAR TOGGLE BUTTON
   ============================================= */

.sidebar-toggle {
    display: none;
    width: 36px;
    height: 36px;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    color: var(--charcoal);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
}

.sidebar-toggle:hover {
    background: var(--cream);
    color: var(--ink);
}

.sidebar-toggle svg {
    width: 20px;
    height: 20px;
}

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

/* Desktop: Sidebar visible */
@media (min-width: 1201px) {
    /* Sidebar overlay hidden on desktop */
    .sidebar-overlay {
        display: none;
    }
}

/* Tablet: 768px - 1200px */
@media (max-width: 1200px) {
    /* Nav takes full width on tablet when sidebar collapsed */
    .top-nav {
        left: 0;
    }

    /* Hide sidebar by default on tablet */
    .sidebar {
        transform: translateX(-100%);
        box-shadow: none;
    }

    .sidebar:not(.collapsed) {
        transform: translateX(0);
        box-shadow: var(--shadow-xl);
    }

    /* App container takes full width on tablet */
    .app-container {
        margin-left: 0;
    }

    /* Sidebar overlay for tablet */
    .sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(45, 42, 38, 0.3);
        opacity: 0;
        visibility: hidden;
        transition: all var(--duration-normal) var(--ease-out);
        z-index: 99;
    }

    .sidebar-overlay.active {
        opacity: 1;
        visibility: visible;
    }

    /* Right panel overlays content on tablet */
    .right-panel {
        box-shadow: var(--shadow-xl);
    }

    /* Adjust nav for tablet */
    .search-box {
        display: none;
    }

    .current-month {
        font-size: 14px;
    }
}

/* Prevent body scroll when sidebar is open */
body.sidebar-open {
    overflow: hidden;
}

/* Mobile: < 768px */
@media (max-width: 768px) {
    :root {
        --header-height: 52px;
        --right-panel-width: 100%;
    }

    /* Stack navigation */
    .top-nav {
        padding: 0 var(--space-3);
    }

    .nav-left {
        gap: var(--space-2);
    }

    /* Hide brand name on mobile */
    .brand-name {
        display: none;
    }

    /* Simplify nav center */
    .nav-center {
        position: relative;
        left: auto;
        transform: none;
        gap: var(--space-1);
    }

    .date-range {
        font-size: 13px;
        min-width: auto;
    }

    .today-btn {
        padding: var(--space-1) var(--space-2);
        font-size: 12px;
    }

    .nav-arrow {
        width: 28px;
        height: 28px;
    }

    /* Hide view dropdown on mobile */
    .view-dropdown {
        display: none;
    }

    /* Hide settings, show only avatar */
    .settings-btn {
        display: none;
    }

    /* Right panel is full screen overlay on mobile */
    .right-panel {
        width: 100%;
        top: 0;
        z-index: 300;
    }

    .right-panel.open {
        box-shadow: none;
    }

    /* Add close button visibility on mobile panel */
    .panel-header {
        padding: var(--space-3) var(--space-4);
    }

    /* App container adjustments */
    .app-container {
        flex-direction: column;
    }
}
