/* =========================================================
   Blackstone Design System — Global Stylesheet
   ========================================================= */

/* --- Google Fonts fallback (loaded via app.html) ---------- */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;600;700;800&family=Open+Sans:wght@400;500;600&family=Playfair+Display:ital,wght@0,400;0,600;1,400&display=swap');

:root {
    /* ── Brand Palette ───────────────────────────────────── */
    --blackstone-black:  #160900;   /* Blackstone Black     */
    --blackstone-gold:   #F7CB07;   /* Blackstone Gold      */
    --clean-white:       #FFFFFF;   /* Clean White          */
    --neutral-gray:      #D9D9D9;   /* Neutral Gray         */

    /* ── Derived Surface Colors ──────────────────────────── */
    --color-bg-0:   #0d0600;        /* Deepest black        */
    --color-bg-1:   #160900;        /* Blackstone Black     */
    --color-bg-2:   #221200;        /* Lifted surface       */
    --color-bg-3:   #2e1a00;        /* Card / panel         */

    /* ── Theme Accents ───────────────────────────────────── */
    --color-theme-1:     #F7CB07;   /* Gold — primary accent  */
    --color-theme-2:     #ffd740;   /* Gold lighter — hover   */
    --color-theme-dark:  #c9a400;   /* Gold darker — pressed  */

    /* ── Typography Colors ───────────────────────────────── */
    --color-text:         #FFFFFF;
    --color-text-muted:   #b8a898;
    --color-text-dark:    #160900;  /* text ON gold elements  */

    /* ── Header Colors ───────────────────────────────────── */
    --header-text-color:    #F7CB07;
    --subheader-text-color: #ffd740;

    /* ── Font Families ───────────────────────────────────── */
    --font-heading:  'Montserrat', 'Segoe UI', sans-serif;
    --font-body:     'Open Sans', 'Helvetica Neue', Arial, sans-serif;
    --font-display:  'Playfair Display', Georgia, serif;
    --font-mono:     ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;

    /* ── Button Colors ───────────────────────────────────── */
    --button-bg:              #F7CB07;
    --button-bg-hover:        #ffd740;
    --button-bg-pressed:      #c9a400;
    --button-bg-disabled:     #3a2a10;
    --button-text-color-common: #160900;

    /* Secondary button */
    --button-secondary-bg:          #160900;
    --button-secondary-bg-hover:    #221200;
    --button-secondary-text:        #FFFFFF;
    --button-secondary-border:      rgba(247, 203, 7, 0.3);

    /* ── Input Colors ────────────────────────────────────── */
    --input-bg:           #221200;
    --input-border:       rgba(247, 203, 7, 0.2);
    --input-border-focus: #F7CB07;
    --input-text:         #FFFFFF;
    --input-placeholder:  #b8a898;

    /* ── Radio / Checkbox ────────────────────────────────── */
    --radio-button-active:   #F7CB07;
    --radio-button-inactive: #4a3a20;

    /* ── Semantic Colors ─────────────────────────────────── */
    --color-success: #2ecc71;
    --color-warning: #F7CB07;
    --color-error:   #e74c3c;
    --color-info:    #3498db;

    /* ── Shadows ─────────────────────────────────────────── */
    --shadow-sm:  0 2px 4px rgba(0, 0, 0, 0.5);
    --shadow-md:  0 4px 12px rgba(0, 0, 0, 0.6);
    --shadow-lg:  0 8px 24px rgba(247, 203, 7, 0.15);
    --shadow-gold: 0 0 20px rgba(247, 203, 7, 0.25);

    /* ── Light Theme (Main Content) ──────────────────────── */
    --color-bg-main:         #FFFFFF;
    --color-bg-app:          #F5F5F7;
    --color-text-main:       #160900;
    --color-text-main-muted: #666666;
    --border-main:           #E5E5E5;

    /* ── Layout ──────────────────────────────────────────── */
    --column-width:        42rem;
    --column-margin-top:   4rem;
    --border-radius:       8px;
    --border-radius-sm:    4px;
    --border-radius-lg:    12px;
    --border-radius-xl:    16px;

    /* ── Transitions ─────────────────────────────────────── */
    --transition-fast:   0.15s ease;
    --transition-base:   0.25s ease;
    --transition-slow:   0.4s ease;

    font-family: var(--font-body);
    color: var(--color-text);
}

/* ─── Reset / Base ──────────────────────────────────────── */
*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    margin: 0;
    background-color: var(--color-bg-app);
    font-family: var(--font-body);
    color: var(--color-text-main);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ─── Typography ─────────────────────────────────────────── */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-heading);
    color: var(--header-text-color);
    line-height: 1.2;
}

h1 {
    font-size: 2.4rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 1rem;
    text-align: center;
    color: var(--header-text-color);
}

h2 {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: var(--subheader-text-color);
}

h3 {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: inherit;
}

p {
    font-family: var(--font-body);
    font-weight: 400;
    line-height: 1.7;
    color: inherit;
}

/* Quote / highlight text using Playfair Display */
.quote,
blockquote,
.highlight-text {
    font-family: var(--font-display);
    font-style: italic;
    color: var(--blackstone-gold);
}

a {
    color: var(--color-theme-1);
    text-decoration: none;
    transition: color var(--transition-base);
}

a:hover {
    color: var(--color-theme-2);
    text-decoration: underline;
}

pre,
code {
    font-family: var(--font-mono);
}

pre {
    font-size: 0.95rem;
    background-color: var(--color-bg-3);
    border: 1px solid rgba(247, 203, 7, 0.15);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    padding: 1em;
    overflow-x: auto;
    color: var(--color-text);
}

/* ─── Layout Utilities ───────────────────────────────────── */
.text-column {
    display: flex;
    max-width: 60rem;
    flex: 0.6;
    flex-direction: column;
    justify-content: center;
    margin: 0 auto;
}

/* ─── Callout / Hint Bar ─────────────────────────────────── */
/* From the spec: dark bg + gold 4px left border */
.callout-bar,
.hint-bar {
    background-color: var(--color-bg-2);
    border-left: 4px solid var(--blackstone-gold);
    border-radius: 0 var(--border-radius-sm) var(--border-radius-sm) 0;
    padding: 0.75rem 1rem;
    font-family: var(--font-body);
    color: var(--color-text);
}

/* ─── Buttons ────────────────────────────────────────────── */
input,
button,
textarea,
select {
    font-size: inherit;
    font-family: var(--font-body);
}

/* Primary button — Gold bg, black text */
button,
.btn,
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.55rem 1.25rem;
    border-radius: var(--border-radius-sm);
    background-color: var(--button-bg);
    color: var(--button-text-color-common);
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.9rem;
    letter-spacing: 0.01em;
    cursor: pointer;
    border: none;
    transition:
        background-color var(--transition-base),
        transform var(--transition-fast),
        box-shadow var(--transition-base);
    box-shadow: var(--shadow-sm);
    text-decoration: none;
    white-space: nowrap;
}

button:hover,
.btn:hover,
.btn-primary:hover {
    background-color: var(--button-bg-hover);
    box-shadow: var(--shadow-lg);
    transform: translateY(-1px);
    color: var(--button-text-color-common);
    text-decoration: none;
}

button:active,
.btn:active,
.btn-primary:active {
    background-color: var(--button-bg-pressed);
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

button:disabled,
.btn:disabled,
.btn-primary:disabled {
    background-color: var(--button-bg-disabled);
    color: var(--color-text-muted);
    cursor: not-allowed;
    opacity: 0.7;
    transform: none;
    box-shadow: none;
}

button:focus-visible,
.btn:focus-visible {
    outline: 2px solid var(--blackstone-gold);
    outline-offset: 3px;
}

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

/* Secondary button — Black bg, white text, gold border */
.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.55rem 1.25rem;
    border-radius: var(--border-radius-sm);
    background-color: var(--button-secondary-bg);
    color: var(--button-secondary-text);
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.9rem;
    letter-spacing: 0.01em;
    cursor: pointer;
    border: 1px solid var(--button-secondary-border);
    transition:
        background-color var(--transition-base),
        border-color var(--transition-base),
        transform var(--transition-fast),
        box-shadow var(--transition-base);
    box-shadow: var(--shadow-sm);
    text-decoration: none;
    white-space: nowrap;
}

.btn-secondary:hover {
    background-color: var(--button-secondary-bg-hover);
    border-color: rgba(247, 203, 7, 0.6);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
    color: var(--button-secondary-text);
    text-decoration: none;
}

.btn-secondary:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

.btn-secondary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ─── Input Fields ───────────────────────────────────────── */
input[type='text'],
input[type='email'],
input[type='password'],
input[type='number'],
input[type='date'],
input[type='time'],
textarea,
select {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--input-border);
    border-radius: var(--border-radius-sm);
    background-color: var(--input-bg);
    color: var(--input-text);
    font-family: var(--font-body);
    font-size: 0.95rem;
    transition:
        border-color var(--transition-base),
        box-shadow var(--transition-base);
    box-sizing: border-box;
}

input[type='text']::placeholder,
input[type='email']::placeholder,
input[type='password']::placeholder,
input[type='number']::placeholder,
textarea::placeholder {
    color: var(--input-placeholder);
}

input[type='text']:focus,
input[type='email']:focus,
input[type='password']:focus,
input[type='number']:focus,
input[type='date']:focus,
input[type='time']:focus,
textarea:focus,
select:focus {
    border-color: var(--input-border-focus);
    outline: none;
    box-shadow: 0 0 0 3px rgba(247, 203, 7, 0.18);
}

input:disabled,
textarea:disabled,
select:disabled {
    background-color: var(--color-bg-1);
    cursor: not-allowed;
    opacity: 0.5;
}

/* Select arrow color */
select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23F7CB07' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2.5rem;
}

textarea {
    min-height: 100px;
    resize: vertical;
}

label {
    font-family: var(--font-body);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-text-muted);
    margin-bottom: 0.35rem;
    display: block;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

/* ─── Radio Buttons ──────────────────────────────────────── */
.radio-button,
input[type='radio'] {
    appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid var(--radio-button-inactive);
    border-radius: 50%;
    position: relative;
    cursor: pointer;
    margin-right: 0.5rem;
    transition: border-color var(--transition-base);
    flex-shrink: 0;
}

.radio-button:checked,
input[type='radio']:checked {
    border-color: var(--radio-button-active);
}

.radio-button:checked::after,
input[type='radio']:checked::after {
    content: '';
    width: 8px;
    height: 8px;
    background-color: var(--radio-button-active);
    border-radius: 50%;
    position: absolute;
    top: 3px;
    left: 3px;
}

input[type='radio']:focus-visible {
    outline: 2px solid var(--blackstone-gold);
    outline-offset: 2px;
}

/* ─── Checkboxes ─────────────────────────────────────────── */
input[type='checkbox'] {
    appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid var(--radio-button-inactive);
    border-radius: var(--border-radius-sm);
    position: relative;
    cursor: pointer;
    margin-right: 0.5rem;
    transition: all var(--transition-base);
    flex-shrink: 0;
}

input[type='checkbox']:checked {
    background-color: var(--radio-button-active);
    border-color: var(--radio-button-active);
}

input[type='checkbox']:checked::after {
    content: '✓';
    color: var(--blackstone-black);
    font-size: 12px;
    font-weight: 800;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

input[type='checkbox']:focus-visible {
    outline: 2px solid var(--blackstone-gold);
    outline-offset: 2px;
}

/* ─── Headers / Subheaders Utilities ─────────────────────── */
.header    { color: var(--header-text-color);    font-family: var(--font-heading); }
.subheader { color: var(--subheader-text-color); font-family: var(--font-heading); }

/* ─── Legend (Charts) ────────────────────────────────────── */
.legend-text {
    fill: var(--color-text);
    font-size: 12px;
    font-family: var(--font-body);
}

/* ─── Responsive ─────────────────────────────────────────── */
@media (min-width: 720px) {
    h1 { font-size: 2.6rem; }
}

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

/* ─── Loading Spinner ────────────────────────────────────── */
@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes pulse-gold {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.4; }
}

.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(247, 203, 7, 0.2);
    border-top-color: var(--blackstone-gold);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

/* ─── Toast Notifications ────────────────────────────────── */
.toast-container {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 9000;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    pointer-events: none;
}

.toast {
    pointer-events: all;
    background: #ffffff;
    border-radius: 8px;
    padding: 1rem 1.25rem;
    min-width: 320px;
    max-width: 420px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    border-left: 4px solid transparent;
    animation: toast-in 0.25s ease;
}

@keyframes toast-in {
    from { opacity: 0; transform: translateX(20px); }
    to   { opacity: 1; transform: translateX(0); }
}

.toast-success { border-left-color: #2ecc71; }
.toast-warning { border-left-color: #F7CB07; }
.toast-error   { border-left-color: #e74c3c; }

.toast-icon {
    width: 22px;
    height: 22px;
    border-radius: 4px;
    flex-shrink: 0;
    margin-top: 1px;
}

.toast-success .toast-icon { background-color: rgba(46, 204, 113, 0.15); }
.toast-warning .toast-icon { background-color: rgba(247, 203, 7, 0.15); }
.toast-error   .toast-icon { background-color: rgba(231, 76, 60, 0.15); }

.toast-body { flex: 1; }

.toast-title {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.88rem;
    color: var(--color-text-main, #160900);
    margin-bottom: 0.2rem;
}

.toast-msg {
    font-family: var(--font-body);
    font-size: 0.82rem;
    color: var(--color-text-main-muted, #666);
    line-height: 1.4;
}

.toast-close {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    border: 1px solid #e5e5e5;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    font-size: 0.75rem;
    flex-shrink: 0;
    padding: 0;
    transition: border-color 0.2s ease, color 0.2s ease;
    box-shadow: none;
    transform: none;
}

.toast-close:hover {
    border-color: #999;
    color: #555;
    background: transparent;
    transform: none;
    box-shadow: none;
}

/* ─── Skeleton Loaders ───────────────────────────────────── */
@keyframes shimmer {
    0%   { background-position: -400px 0; }
    100% { background-position: 400px 0; }
}

.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 800px 100%;
    animation: shimmer 1.4s infinite linear;
    border-radius: 4px;
}

.skeleton-text {
    height: 14px;
    margin-bottom: 8px;
    border-radius: 4px;
}

.skeleton-text.wide  { width: 80%; }
.skeleton-text.short { width: 50%; }
.skeleton-text.tiny  { width: 30%; }

.skeleton-block {
    width: 100%;
    height: 120px;
    border-radius: 8px;
    margin-bottom: 12px;
}

.skeleton-card {
    background: #ffffff;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    padding: 1.5rem;
}
