/* 01_base.css — Typography, buttons, links, nav, and Dash component theming.
   Ported from styles.py inject_base_styles(); Streamlit/BaseWeb selectors
   were discarded and replaced with rules for real Dash components. */

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background-color: var(--bg-page);
    color: var(--text-primary);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    -webkit-font-smoothing: antialiased;
}

/* Typography hierarchy */
h1 { font-weight: 600; letter-spacing: -0.8px; color: var(--text-primary); }
h2, h3 { font-weight: 600; letter-spacing: -0.24px; color: var(--text-primary); }
p { color: var(--text-secondary); }

a { color: var(--brand-green); }

/* Raw-HTML embeds (dcc.Markdown wrapper) should not add paragraph margins */
.raw-html p { margin: 0; }

/* ------------------------------------------------------------------ */
/* Buttons                                                              */
/* ------------------------------------------------------------------ */
.btn-primary {
    background-color: var(--text-primary);
    color: var(--bg-page);
    border: none;
    border-radius: 9999px;
    padding: 8px 24px;
    font-weight: 500;
    font-size: 15px;
    font-family: 'Inter', sans-serif;
    box-shadow: rgba(0, 0, 0, 0.06) 0px 1px 2px;
    transition: opacity 0.2s ease, transform 0.2s ease;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
}
.btn-primary:hover { opacity: 0.9; transform: scale(1.02); }

.btn-secondary {
    background-color: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-medium);
    border-radius: 9999px;
    padding: 8px 24px;
    font-weight: 500;
    font-size: 15px;
    font-family: 'Inter', sans-serif;
    transition: opacity 0.2s ease, transform 0.2s ease;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
}
.btn-secondary:hover { opacity: 0.9; border-color: var(--border-opaque); transform: scale(1.02); }

/* Green form-submit button (auth forms only, per DESIGN.md) */
.btn-form-submit {
    background: var(--brand-green);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    padding: 10px 24px;
    font-family: 'Inter', sans-serif;
    transition: background 0.2s ease;
    cursor: pointer;
    width: 100%;
}
.btn-form-submit:hover { background: var(--brand-green-hover); }

button:focus-visible {
    outline: 2px solid var(--brand-green);
    outline-offset: 2px;
}

/* ------------------------------------------------------------------ */
/* Public nav bar                                                       */
/* ------------------------------------------------------------------ */
.public-nav {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 9999;
    background: var(--bg-page);
    border-bottom: 1px solid var(--border);
    padding: 10px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.nav-brand { text-decoration: none; display: flex; align-items: center; }
.nav-links { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.nav-link-muted {
    color: var(--text-muted); text-decoration: none;
    font-size: 14px; font-weight: 500; white-space: nowrap;
}
.nav-link-plain {
    color: var(--text-primary); text-decoration: none;
    font-size: 14px; font-weight: 500; white-space: nowrap;
}
.nav-cta {
    background-color: var(--text-primary);
    color: var(--bg-page);
    font-weight: 600;
    padding: 7px 16px;
    border-radius: 9999px;
    text-decoration: none;
    font-size: 14px;
    box-shadow: rgba(0, 0, 0, 0.10) 0px 2px 8px;
    display: inline-block;
    white-space: nowrap;
    transition: opacity 0.2s ease;
}
.nav-cta:hover { opacity: 0.9; }
.nav-spacer { height: 64px; }

.theme-toggle-btn {
    background: transparent;
    border: 1px solid var(--border-medium);
    border-radius: 9999px;
    padding: 5px 12px;
    font-size: 13px;
    font-weight: 500;
    font-family: 'Inter', sans-serif;
    color: var(--text-primary);
    cursor: pointer;
    white-space: nowrap;
}
.theme-toggle-btn:hover { background: var(--bg-hover); }

/* ------------------------------------------------------------------ */
/* dcc.Dropdown (react-select) theming                                  */
/* ------------------------------------------------------------------ */
.locale-select { width: 76px; font-size: 13px; }

.dash-dropdown .Select-control {
    background-color: var(--bg-card);
    border: 1.5px solid var(--border-opaque);
    border-radius: 8px;
    color: var(--text-primary);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.dash-dropdown .Select-control:hover { border-color: var(--text-muted); }
.dash-dropdown .is-focused:not(.is-open) > .Select-control {
    border-color: var(--brand-green);
    box-shadow: 0 0 0 3px rgba(29, 158, 117, 0.15);
}
.dash-dropdown .Select-value-label,
.dash-dropdown .Select-placeholder,
.dash-dropdown .Select-input > input {
    color: var(--text-primary) !important;
}
.dash-dropdown .Select-menu-outer {
    background-color: var(--bg-card);
    border: 1px solid var(--border-opaque);
    color: var(--text-primary);
    z-index: 10001;
}
.dash-dropdown .VirtualizedSelectOption { color: var(--text-primary); }
.dash-dropdown .VirtualizedSelectFocusedOption,
.dash-dropdown .VirtualizedSelectSelectedOption {
    background-color: var(--bg-green-light);
}
.dash-dropdown .Select-arrow { border-color: var(--text-muted) transparent transparent; }
.dash-dropdown .Select--multi .Select-value {
    background-color: var(--bg-green-light);
    color: var(--text-primary);
    border: 1px solid var(--border-medium);
    border-radius: 9999px;
    font-weight: 500;
}
.dash-dropdown .Select--multi .Select-value-icon {
    border-right: 1px solid var(--border-medium);
}
.dash-dropdown .Select--multi .Select-value-icon:hover {
    background-color: var(--bg-hover);
    color: var(--error);
}

/* ------------------------------------------------------------------ */
/* dcc.Input / text inputs                                              */
/* ------------------------------------------------------------------ */
.text-input, input.text-input {
    background-color: var(--bg-card);
    color: var(--text-primary);
    border: 1.5px solid var(--border-opaque);
    border-radius: 8px;
    padding: 10px 14px;
    /* 0.9rem + explicit line-height so typed text is fully visible (not clipped) */
    font-size: 0.9rem;
    line-height: 1.4;
    font-family: 'Inter', sans-serif;
    width: 100%;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.text-input:hover { border-color: var(--text-muted); }
.text-input:focus {
    border-color: var(--brand-green);
    box-shadow: 0 0 0 3px rgba(29, 158, 117, 0.15);
    outline: none;
}
.input-label {
    color: var(--text-secondary);
    font-size: 0.925rem;
    font-weight: 500;
    display: block;
    margin-bottom: 4px;
}

/* ------------------------------------------------------------------ */
/* dcc.DatePickerSingle (react-dates) theming                           */
/* ------------------------------------------------------------------ */
.DateInput { background: transparent; width: 130px; }
.DateInput_input {
    background-color: var(--bg-card);
    color: var(--text-primary);
    border: 1.5px solid var(--border-opaque);
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: 'Inter', sans-serif;
    padding: 8px 12px;
    font-weight: 400;
}
.DateInput_input__focused { border-color: var(--brand-green); }
.SingleDatePickerInput {
    background-color: transparent;
    border: none;
}
.SingleDatePicker_picker,
.DayPicker,
.CalendarMonth,
.CalendarMonthGrid {
    background-color: var(--bg-card);
    color: var(--text-primary);
}
.CalendarMonth_caption { color: var(--text-primary); }
.DayPicker_weekHeader { color: var(--text-muted); }
.CalendarDay__default {
    background: var(--bg-card);
    border-color: var(--border);
    color: var(--text-secondary);
}
.CalendarDay__default:hover { background: var(--bg-green-light); }
.CalendarDay__selected,
.CalendarDay__selected:active,
.CalendarDay__selected:hover {
    background: var(--brand-green);
    border-color: var(--brand-green);
    color: #ffffff;
}
.CalendarDay__blocked_out_of_range {
    color: var(--border-opaque);
    background: var(--bg-card);
}
.DayPickerNavigation_button {
    background-color: var(--bg-card);
    border-color: var(--border-opaque);
}
.DayPickerNavigation_svg__horizontal { fill: var(--text-muted); }
.DayPickerKeyboardShortcuts_show { display: none; }

/* ------------------------------------------------------------------ */
/* dcc.Tabs                                                             */
/* ------------------------------------------------------------------ */
.custom-tabs .tab {
    background-color: transparent;
    border: none !important;
    border-bottom: 2px solid var(--border-opaque) !important;
    color: var(--text-muted);
    font-weight: 400;
    font-family: 'Inter', sans-serif;
    padding: 12px 16px;
}
.custom-tabs .tab--selected {
    border-bottom: 2px solid var(--brand-green) !important;
    color: var(--text-primary);
    font-weight: 600;
}

/* dcc.Loading spinner tint */
.dash-spinner, .dash-default-spinner div { border-color: var(--brand-green) !important; }

/* Alert boxes (info/warning/error/success) */
.alert {
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 0.95rem;
    margin: 8px 0;
    border: 1px solid var(--border-medium);
    background: var(--bg-hover);
    color: var(--text-secondary);
}
.alert-info { border-left: 4px solid var(--trust-blue); }
.alert-warning { border-left: 4px solid #D97706; }
.alert-error { border-left: 4px solid var(--error); }
.alert-success { border-left: 4px solid var(--success); }

/* Section header (green left border, no icon — DESIGN.md rule) */
.section-header {
    color: var(--text-primary);
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.2px;
    margin: 0 0 1rem 0;
    border-left: 4px solid var(--brand-green);
    padding-left: 12px;
}

.divider {
    border: none;
    border-top: 1px solid var(--border-medium);
    margin: 2rem 0;
}

.caption { font-size: 13px; color: var(--text-muted); }

/* ------------------------------------------------------------------ */
/* Theme audit: make every component follow the active theme            */
/* (near-black text in light mode, near-white in dark mode)             */
/* ------------------------------------------------------------------ */
.dash-shell, .public-page { color: var(--text-primary); }
.dash-shell h1, .dash-shell h2, .dash-shell h3, .dash-shell h4,
.public-page h1, .public-page h2, .public-page h3, .public-page h4 {
    color: var(--text-primary);
}
details summary { color: var(--text-secondary); }

/* dcc.Input placeholder */
.text-input::placeholder { color: var(--text-muted); opacity: 1; }

/* dcc.Tabs: neutralize the component's built-in light-only defaults */
.custom-tabs .tab,
.custom-tabs .tab--selected {
    background-color: transparent !important;
    border-top: none !important;
    border-left: none !important;
    border-right: none !important;
}
.custom-tabs + div, .custom-tabs ~ div { color: var(--text-primary); }

/* react-select leftovers */
.dash-dropdown .Select-arrow-zone .Select-arrow {
    border-top-color: var(--text-muted);
}
.dash-dropdown .has-value .Select-value-label { color: var(--text-primary) !important; }
.dash-dropdown .Select.is-disabled > .Select-control {
    background-color: var(--bg-hover);
    color: var(--text-muted);
}

/* react-dates leftovers (containers behind the visible month grid) */
.CalendarMonthGrid,
.CalendarMonthGrid_month__horizontal,
.DayPicker_transitionContainer {
    background-color: var(--bg-card);
}
.CalendarMonth_caption strong { color: var(--text-primary); }
.DateInput_fang { display: none; }

/* Footer copyright link (PROTECTED Big Hub Solutions anchor): must stay a
   clickable, visibly-distinct link on every page. The anchor is a real html.A
   built by footer.py _copyright_paragraph(). Brand-green `!important` locks the
   distinct link color regardless of cascade order (and defends against any
   future inline styling), and `pointer-events: auto` keeps it always clickable. */
.footer-copyright a {
    color: var(--brand-green) !important;
    text-decoration: underline;
    pointer-events: auto;
}
.professional-footer { position: relative; z-index: 1; }
