/* BSL Stock App - Custom CSS (Mobile First) */

@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url('../fonts/Inter-Latin.woff2') format('woff2');
}

/* === CSS Variables === */
:root {
    --surface: #f8f9fb;
    --surface-dim: #d9dadc;
    --surface-bright: #f8f9fb;
    --surface-container-lowest: #ffffff;
    --surface-container-low: #f3f4f6;
    --surface-container: #edeef0;
    --surface-container-high: #e7e8ea;
    --surface-container-highest: #e1e2e4;
    --on-surface: #191c1e;
    --on-surface-variant: #444653;
    --inverse-surface: #2e3132;
    --inverse-on-surface: #f0f1f3;
    --outline: #757684;
    --outline-variant: #c4c5d5;
    --surface-tint: #3755c3;
    --primary: #00288e;
    --on-primary: #ffffff;
    --primary-container: #1e40af;
    --on-primary-container: #a8b8ff;
    --inverse-primary: #b8c4ff;
    --secondary: #555f70;
    --on-secondary: #ffffff;
    --secondary-container: #d6e0f4;
    --on-secondary-container: #596374;
    --tertiary: #003d28;
    --on-tertiary: #ffffff;
    --tertiary-container: #00563a;
    --on-tertiary-container: #5bcf9e;
    --error: #ba1a1a;
    --on-error: #ffffff;
    --error-container: #ffdad6;
    --on-error-container: #93000a;
    --primary-fixed: #dde1ff;
    --primary-fixed-dim: #b8c4ff;
    --on-primary-fixed: #001453;
    --on-primary-fixed-variant: #173bab;
    --background: #f8f9fb;
    --on-background: #191c1e;
    --surface-variant: #e1e2e4;
}

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

/* === Body === */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
    background-color: var(--background);
    color: var(--on-surface);
    min-height: 100dvh;
    font-size: 16px;
    line-height: 1.5;
}

/* === Typography === */
.text-display {
    font-size: 24px;
    font-weight: 700;
    line-height: 32px;
}

.text-header-section {
    font-size: 18px;
    font-weight: 600;
    line-height: 24px;
}

.text-body-main {
    font-size: 16px;
    font-weight: 400;
    line-height: 24px;
}

.text-data-entry {
    font-size: 16px;
    font-weight: 500;
    line-height: 20px;
}

.text-label-caps {
    font-size: 12px;
    font-weight: 600;
    line-height: 16px;
    letter-spacing: 0.05em;
}

.text-caption {
    font-size: 12px;
    font-weight: 400;
    line-height: 16px;
}

/* === Colors === */
.text-primary { color: var(--primary); }
.text-on-primary { color: var(--on-primary); }
.text-primary-container { color: var(--primary-container); }
.text-on-primary-container { color: var(--on-primary-container); }
.text-secondary { color: var(--secondary); }
.text-on-secondary { color: var(--on-secondary); }
.text-tertiary { color: var(--tertiary); }
.text-on-tertiary { color: var(--on-tertiary); }
.text-error { color: var(--error); }
.text-on-error { color: var(--on-error); }
.text-on-surface { color: var(--on-surface); }
.text-on-surface-variant { color: var(--on-surface-variant); }
.text-outline { color: var(--outline); }
.text-outline-variant { color: var(--outline-variant); }

.bg-background { background-color: var(--background); }
.bg-white { background-color: var(--surface-container-lowest); }
.bg-surface { background-color: var(--surface); }
.bg-surface-container-low { background-color: var(--surface-container-low); }
.bg-surface-container-lowest { background-color: var(--surface-container-lowest); }
.bg-surface-container { background-color: var(--surface-container); }
.bg-primary { background-color: var(--primary); }
.bg-primary-container { background-color: var(--primary-container); }
.bg-primary-fixed { background-color: var(--primary-fixed); }
.bg-secondary-container { background-color: var(--secondary-container); }
.bg-tertiary { background-color: var(--tertiary); }
.bg-tertiary-container { background-color: var(--tertiary-container); }
.bg-error-container { background-color: var(--error-container); }
.text-on-error-container { color: var(--on-error-container); }

/* === Layout === */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-grow { flex-grow: 1; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-around { justify-content: space-around; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }

.space-y-1 > * + * { margin-top: 4px; }
.space-y-3 > * + * { margin-top: 12px; }
.space-y-6 > * + * { margin-top: 24px; }

.w-full { width: 100%; }
.min-h-screen { min-height: 100dvh; }
.max-w-md { max-width: 28rem; }
.max-w-lg { max-width: 32rem; }

.px-4 { padding-left: 16px; padding-right: 16px; }
.py-8 { padding-top: 32px; padding-bottom: 32px; }
.pt-6 { padding-top: 24px; }
.p-6 { padding: 24px; }
.p-4 { padding: 16px; }
.p-3 { padding: 12px; }
.p-2 { padding: 8px; }
.p-1 { padding: 4px; }
.px-2 { padding-left: 8px; padding-right: 8px; }
.py-2 { padding-top: 8px; padding-bottom: 8px; }
.pl-12 { padding-left: 48px; }
.pr-4 { padding-right: 16px; }
.pr-12 { padding-right: 48px; }
.pb-12 { padding-bottom: 48px; }
.ml-1 { margin-left: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.mb-8 { margin-bottom: 32px; }
.mt-1 { margin-top: 4px; }
.mt-3 { margin-top: 12px; }
.mt-10 { margin-top: 40px; }
.pt-2 { padding-top: 8px; }

/* === Border === */
.border { border-width: 1px; border-style: solid; }
.border-2 { border-width: 2px; border-style: solid; }
.border-t { border-top-width: 1px; border-top-style: solid; }
.border-outline-variant { border-color: var(--outline-variant); }
.border-outline { border-color: var(--outline); }
.border-outline-variant\/30 { border-color: rgba(196, 197, 213, 0.3); }
.border-surface-container { border-color: var(--surface-container); }

.rounded-lg { border-radius: 0.5rem; }
.rounded-xl { border-radius: 0.75rem; }
.rounded-full { border-radius: 9999px; }
.rounded-md { border-radius: 0.375rem; }

/* === Shadow === */
.shadow-sm { box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05); }
.shadow-md { box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1); }
.shadow-lg { box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1); }

/* === Position === */
.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }
.sticky { position: sticky; }
.top-0 { top: 0; }
.bottom-0 { bottom: 0; }
.bottom-\[64px\] { bottom: 64px; }
.left-0 { left: 0; }
.left-4 { left: 16px; }
.right-4 { right: 16px; }
.inset-y-0 { top: 0; bottom: 0; }
.z-40 { z-index: 40; }
.z-50 { z-index: 50; }

/* === Text === */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.text-sm { font-size: 14px; }
.text-xs { font-size: 12px; }
.text-3xl { font-size: 30px; }
.text-6xl { font-size: 64px; }
.font-bold { font-weight: 700; }
.uppercase { text-transform: uppercase; }
.tracking-widest { letter-spacing: 0.1em; }
.block { display: block; }
.hidden { display: none; }
.inline { display: inline; }

/* === Transform === */
.translate-y-1\/2 { transform: translateY(-50%); }

/* === Pointer Events === */
.pointer-events-none { pointer-events: none; }

/* === Overflow === */
.overflow-hidden { overflow: hidden; }

/* === Transition === */
.transition-colors { transition: background-color 0.15s, color 0.15s, border-color 0.15s; }
.transition-all { transition: all 0.15s; }
.transition-transform { transition: transform 0.15s; }
.duration-100 { transition-duration: 100ms; }

/* === Header === */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 16px;
    height: 48px;
    width: 100%;
    background-color: var(--surface-container-lowest);
    border-bottom: 1px solid var(--outline-variant);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* === Input Field === */
.input-field {
    width: 100%;
    height: 48px;
    background-color: var(--surface-container-lowest);
    border: 2px solid var(--outline-variant);
    border-radius: 0.75rem;
    font-size: 16px;
    font-weight: 500;
    line-height: 20px;
    color: var(--on-surface);
    outline: none;
    transition: border-color 0.15s;
}

.input-field:focus {
    border-color: var(--primary-container);
}

.input-field::placeholder {
    color: var(--outline);
}

/* === Button Primary === */
.btn-primary {
    height: 48px;
    background-color: var(--primary-container);
    color: var(--on-primary);
    font-size: 18px;
    font-weight: 600;
    line-height: 24px;
    border-radius: 0.75rem;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    transition: all 0.15s;
}

.btn-primary:hover {
    filter: brightness(1.1);
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* === Nav Item === */
.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--secondary);
    padding: 4px 16px;
    text-decoration: none;
    border-radius: 0.75rem;
    transition: transform 0.15s, background-color 0.15s;
    min-height: 44px;
}

.nav-item:hover {
    background-color: var(--surface-container);
}

.nav-item:active {
    transform: scale(0.9);
}

.nav-item.active {
    background-color: var(--secondary-container);
    color: var(--on-secondary-container);
}

/* === Hover States === */
.hover\:bg-surface-container-high:hover { background-color: var(--surface-container-high); }
.hover\:bg-surface-container-low:hover { background-color: var(--surface-container-low); }
.hover\:bg-surface-container:hover { background-color: var(--surface-container); }
.hover\:bg-primary\/10:hover { background-color: rgba(0, 40, 142, 0.1); }
.hover\:bg-error-container\/20:hover { background-color: rgba(255, 218, 214, 0.2); }
.hover\:text-primary:hover { color: var(--primary); }

/* === Active States === */
.active\:scale-95:active { transform: scale(0.95); }
.active\:scale-90:active { transform: scale(0.9); }
.active\:scale-\[0\.98\]:active { transform: scale(0.98); }

/* === Spinner === */
.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* === Modal === */
.modal-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.modal-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background-color: var(--surface-container-lowest);
    border-radius: 1rem;
    padding: 24px;
    max-width: 280px;
    width: 90%;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* === Utility for conditional display === */
.\!flex { display: flex !important; }

/* === Bottom padding for nav === */
.pb-\[220px\] { padding-bottom: 220px; }
.pb-\[280px\] { padding-bottom: 280px; }

/* === Fixed bottom positions === */
.bottom-\[64px\] { bottom: 64px; }

/* === Toast notification === */
.toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: #191c1e;
    color: #fff;
    padding: 12px 24px;
    border-radius: 9999px;
    font-size: 14px;
    font-weight: 500;
    z-index: 9999;
    animation: toastIn 0.3s ease, toastOut 0.3s ease 2.5s forwards;
}
@keyframes toastIn { from { opacity: 0; transform: translateX(-50%) translateY(20px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; } }

/* === Height input === */
.h-input { height: 48px; }

/* === Overflow === */
.overflow-y-auto { overflow-y: auto; }
.flex-1 { flex: 1 1 0%; }
.flex-shrink-0 { flex-shrink: 0; }
.pb-40 { padding-bottom: 160px; }
