/* ===================================
   Shared styles for all themes
   Load this BEFORE any theme-*.css file
   =================================== */

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

/* Base Typography */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    display: flex;
    flex-direction: column;
}

/* App shell fills remaining space */
#app-shell {
    flex: 1;
    display: flex;
    flex-direction: column;
}

#content-area,
.content-area {
    flex: 1;
}

/* Links */
a {
    color: var(--theme-text-accent, inherit);
    text-decoration: none;
    transition: color 0.15s ease;
}

a:hover {
    color: var(--theme-text-heading, inherit);
}

/* Headings */
h1, h2, h3, h4, h5, h6 {
    color: var(--theme-text-heading, inherit);
    font-weight: 700;
    line-height: 1.3;
}

/* Form Elements */
input, textarea, select, button {
    font-family: inherit;
    font-size: inherit;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--theme-border-accent-solid, currentColor);
}

/* DS Form Controls - theme-aware */
.ds-form-control, .ds-form-select {
    background: var(--theme-input-bg, var(--theme-bg-secondary));
    color: var(--theme-input-text, var(--theme-text-primary));
    border: 1px solid var(--theme-input-border, var(--theme-border-medium));
    border-radius: 4px;
    padding: 6px 10px;
    font-size: 14px;
}
.ds-form-control::placeholder {
    color: var(--theme-input-placeholder, var(--theme-text-muted));
}
.ds-form-control:focus, .ds-form-select:focus {
    border-color: var(--theme-input-border-focus, var(--theme-border-accent-solid));
}
.ds-form-select {
    cursor: pointer;
}
.ds-form-select option {
    background: var(--theme-input-bg, var(--theme-bg-secondary));
    color: var(--theme-input-text, var(--theme-text-primary));
}

/* DS Buttons */
.ds-btn {
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    border: 1px solid transparent;
}
.ds-btn-primary {
    background: var(--theme-btn-primary-bg, var(--theme-accent-gradient-start));
    color: var(--theme-btn-primary-text, #fff);
    border-color: var(--theme-btn-primary-border, var(--theme-border-accent-solid));
}
.ds-btn-secondary {
    background: transparent;
    color: var(--theme-text-muted);
    border-color: var(--theme-border-medium);
}
.ds-btn-secondary:hover {
    color: var(--theme-text-primary);
    background: var(--theme-bg-hover, rgba(255,255,255,0.05));
}

/* DS Text Utilities */
.ds-text-muted { color: var(--theme-text-muted); }
.ds-text-heading { color: var(--theme-text-heading); }
.ds-text-accent { color: var(--theme-text-accent); }

/* DS Alerts */
.ds-alert { padding: 8px 12px; border-radius: 4px; font-size: 13px; }
.ds-alert-error { background: rgba(239,68,68,0.15); color: #f87171; border: 1px solid rgba(239,68,68,0.3); }
.ds-alert-success { background: rgba(16,185,129,0.15); color: #34d399; border: 1px solid rgba(16,185,129,0.3); }

/* Accordion Component */
.accordion-content {
    display: none;
}

.accordion.active .accordion-content {
    display: block;
}

.accordion.active .accordion-arrow {
    transform: rotate(180deg);
}

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

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

::-webkit-scrollbar-track {
    background: var(--theme-bg-secondary, #1a1a1a);
}

::-webkit-scrollbar-thumb {
    background: var(--theme-border-medium, rgba(255,255,255,0.12));
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--theme-border-accent, rgba(255,255,255,0.2));
}

/* Selection */
::selection {
    background: var(--theme-text-accent, #3b82f6);
    color: var(--theme-bg-primary, #ffffff);
}

/* Focus Visible */
:focus-visible {
    outline: 2px solid var(--theme-text-accent, #3b82f6);
    outline-offset: 2px;
}

/* Smooth transitions for theme switching */
body,
body * {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* Disable transitions on page load */
.no-transitions,
.no-transitions * {
    transition: none !important;
}

/* ===================================
   NAV HEADER COMPONENT
   Clean, minimal top navigation
   =================================== */

.nav-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 56px;
    padding: 0 20px 0 70px; /* Left padding for hamburger menu */
    background: var(--theme-bg-secondary, #1e1e1e);
    border-bottom: 1px solid var(--theme-border-light, rgba(255,255,255,0.06));
}

@media (min-width: 769px) {
    .nav-header {
        padding-left: 20px; /* No extra padding on desktop */
    }
}

.nav-header-left {
    display: flex;
    align-items: center;
}

.nav-header-right {
    display: flex;
    align-items: center;
    gap: 4px;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--theme-text-heading, #fff);
    font-weight: 700;
    font-size: 17px;
    text-decoration: none;
    letter-spacing: -0.3px;
}

.nav-brand:hover {
    text-decoration: none;
    color: var(--theme-text-heading, #fff);
}

.nav-brand-icon {
    width: 22px;
    height: 22px;
    color: var(--theme-text-accent, #f1c574);
}

.nav-brand-text {
    color: inherit;
}

.nav-icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--theme-text-muted, #999);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.nav-icon-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--theme-text-heading, #fff);
}

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

.nav-user-dropdown {
    position: relative;
}

.nav-user-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--theme-text-muted, #999);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.nav-user-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--theme-text-heading, #fff);
}

.nav-user-btn svg {
    width: 20px;
    height: 20px;
}

.nav-user-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--theme-text-nav, #ccc);
}

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

.nav-chevron {
    width: 14px;
    height: 14px;
    opacity: 0.5;
}

.nav-dropdown-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    min-width: 180px;
    background: var(--theme-bg-secondary, #1e1e1e);
    border: 1px solid var(--theme-border-medium, rgba(255,255,255,0.1));
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(0,0,0,0.3);
    z-index: 1000;
    overflow: hidden;
}

.nav-dropdown-menu.hidden {
    display: none;
}

.nav-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    color: var(--theme-text-nav, #ccc);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: background 0.12s ease;
}

.nav-dropdown-item:hover {
    background: rgba(255, 255, 255, 0.06);
    text-decoration: none;
    color: var(--theme-text-heading, #fff);
}

.nav-dropdown-item svg {
    width: 16px;
    height: 16px;
    opacity: 0.6;
}

.nav-dropdown-logout {
    color: #f87171;
    border-top: 1px solid var(--theme-border-light, rgba(255,255,255,0.06));
}

.nav-dropdown-logout:hover {
    background: rgba(248, 113, 113, 0.1);
    color: #f87171;
}
