@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Playfair+Display:wght@600;700&display=swap');

:root {
    --primary-color: #17354d;
    --secondary-color: #334155;
    --background-color: #cbc9c9;
    --card-background: #f8fafc;
    --text-color: #4b5563;
    --heading-color: #1f2937;
    --accent-color: #007bff;
    --accent-hover: #0069d9;
    --border-color: #d8dee6;
    --muted-color: #64748b;
    --success-color: #166534;
    --danger-color: #b91c1c;
    --shadow: 0 8px 24px rgba(23, 53, 77, 0.10);
    --radius: 12px;
}

html { box-sizing: border-box; width: 100%; overflow-x: hidden; }
*, *::before, *::after { box-sizing: inherit; }
body {
    margin: 0;
    padding: 0 0 100px;
    width: 100%;
    overflow-x: hidden;
    background: var(--background-color);
    color: var(--text-color);
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    line-height: 1.55;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Playfair Display', serif;
    color: var(--heading-color);
    line-height: 1.2;
    margin-top: 0;
}
h1 {
    margin: 0 0 26px;
    padding: 25px 20px;
    background: var(--primary-color);
    color: #fff;
    text-align: center;
    font-size: clamp(1.7rem, 4vw, 2.5rem);
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(15, 23, 42, .16);
}
h2 { font-size: 1.65rem; margin-bottom: 16px; }
h3 { font-size: 1.25rem; margin: 20px 0 10px; }
p { margin: 0 0 14px; }
a { color: var(--accent-color); text-decoration: none; transition: color .18s ease; }
a:hover { color: var(--accent-hover); }
button, input, select { font: inherit; }
button, input[type="submit"] { cursor: pointer; }
:focus-visible { outline: 3px solid rgba(0, 123, 255, .38); outline-offset: 2px; }

/* Current stock */
.content-wrapper {
    width: min(1200px, calc(100% - 36px));
    margin: 0 auto;
    padding: 24px 0 18px;
}
.content-wrapper h1 {
    border-radius: var(--radius);
    margin-bottom: 24px;
}
.section {
    margin: 0 0 22px;
    padding: 24px;
    background: var(--card-background);
    border: 1px solid rgba(23, 53, 77, .09);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.section h2 {
    margin: 0 0 18px;
    padding: 0 0 12px;
    color: var(--primary-color);
    border-bottom: 2px solid var(--accent-color);
}
.section h3 { color: var(--heading-color); }
.stock-table, body > table {
    width: 100%;
    margin: 0 0 18px;
    border-collapse: separate;
    border-spacing: 0;
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
}
.stock-table th, .stock-table td, body > table th, body > table td {
    padding: 12px 15px;
    border-bottom: 1px solid #e5eaf0;
    text-align: left;
    color: var(--text-color);
}
.stock-table th, body > table th {
    background: var(--secondary-color);
    color: #fff;
    font-weight: 600;
    font-size: .82rem;
    letter-spacing: .035em;
    text-transform: uppercase;
}
.stock-table td:last-child, .stock-table th:last-child { width: 130px; }
.stock-table tbody tr:nth-child(even) td, body > table tr:nth-child(even) td { background: #f1f5f9; }
.stock-table tr:last-child td, body > table tr:last-child td { border-bottom: 0; }
.stock-table tr:hover td, body > table tr:hover td { background: #eaf3ff; }

/* Forms */
body > form, #sellForm {
    width: min(540px, calc(100% - 36px));
    margin: 26px auto 36px;
    padding: 28px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: var(--card-background);
    border: 1px solid rgba(23, 53, 77, .10);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
body > form label, #sellForm label {
    display: flex;
    flex-direction: column;
    gap: 7px;
    color: var(--heading-color);
    font-size: .92rem;
    font-weight: 600;
}
body > form select, body > form input[type="text"], body > form input[type="number"],
#sellForm select, #sellForm input[type="text"], #sellForm input[type="number"] {
    display: block;
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    background: #fff;
    color: var(--heading-color);
    border: 1px solid #cbd5e1;
    border-radius: 7px;
    transition: border-color .18s ease, box-shadow .18s ease;
}
body > form select:focus, body > form input:focus, #sellForm select:focus, #sellForm input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, .12);
}
body > form input[type="checkbox"], #sellForm input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent-color); }
button, input[type="submit"], .button {
    min-height: 44px;
    padding: 11px 16px;
    color: #fff;
    background: var(--accent-color);
    border: 1px solid var(--accent-color);
    border-radius: 7px;
    font-weight: 700;
    transition: background .18s ease, border-color .18s ease, transform .12s ease;
}
button:hover, input[type="submit"]:hover, .button:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
button:active, input[type="submit"]:active { transform: translateY(1px); }
form .button, form input[type="submit"] { width: 100%; }
body > p {
    width: min(540px, calc(100% - 36px));
    margin: 0 auto 12px;
    padding: 12px 15px;
    border-radius: 8px;
    background: #eff6ff;
    color: var(--primary-color);
    text-align: left;
}

/* Reserved stock cards */
.reserved-item {
    width: min(1000px, calc(100% - 36px));
    margin: 0 auto 14px;
    padding: 18px 20px;
    background: var(--card-background);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--accent-color);
    border-radius: 9px;
    box-shadow: 0 3px 10px rgba(23, 53, 77, .06);
    overflow-wrap: anywhere;
}
.reserved-item strong { display: inline-block; margin-bottom: 7px; color: var(--heading-color); font-size: 1rem; }
.reserved-item form { display: flex; flex-direction: row; flex-wrap: wrap; gap: 9px; margin-top: 14px; }
.reserved-item form button { width: auto; min-width: 120px; }
.reserved-item form button[name="action"][value="unreserve"] { background: var(--secondary-color); border-color: var(--secondary-color); }
.reserved-item form button[name="action"][value="unreserve"]:hover { background: var(--primary-color); }

/* Fixed bottom navigation */
.tabs {
    position: fixed;
    z-index: 1000;
    left: 0;
    bottom: 0;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 10px max(10px, env(safe-area-inset-left)) calc(10px + env(safe-area-inset-bottom));
    background: var(--primary-color);
    border-top: 1px solid rgba(255,255,255,.13);
    box-shadow: 0 -5px 18px rgba(15, 23, 42, .18);
}
.tab {
    flex: 1 1 0;
    max-width: 210px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 43px;
    padding: 10px 13px;
    color: rgba(255,255,255,.82);
    border: 1px solid transparent;
    border-radius: 7px;
    text-align: center;
    text-decoration: none;
    font-size: .9rem;
    font-weight: 600;
    white-space: nowrap;
    background: transparent;
}
.tab:hover { color: #fff; background: rgba(255,255,255,.09); }
.tab.active { color: #fff; background: var(--accent-color); border-color: rgba(255,255,255,.15); }
.tabs .more-tab { width: 50px; flex: 0 0 50px; min-width: 0; margin: 0; padding: 8px; }
.more-tabs-backdrop, .more-tabs-modal { display: none; }

@media (min-width: 601px) {
    .more-tab, .more-tabs-backdrop, .more-tabs-modal { display: none !important; }
}
@media (max-width: 600px) {
    body { padding-bottom: 94px; font-size: 14px; }
    h1 { padding: 21px 15px; margin-bottom: 20px; }
    .content-wrapper { width: calc(100% - 24px); padding-top: 12px; }
    .section { padding: 16px 13px; margin-bottom: 15px; }
    .section h2 { font-size: 1.4rem; }
    .section h3 { font-size: 1.1rem; }
    body > form, #sellForm { width: calc(100% - 24px); padding: 19px 16px; margin-top: 18px; gap: 14px; }
    .stock-table th, .stock-table td, body > table th, body > table td { padding: 10px 11px; font-size: .88rem; }
    .stock-table td:last-child, .stock-table th:last-child { width: 90px; }
    .reserved-item { width: calc(100% - 24px); padding: 15px; }
    .reserved-item form { flex-direction: column; }
    .reserved-item form button { width: 100%; }
    .tab { min-height: 42px; padding: 9px 5px; font-size: .78rem; }
    .tabs { gap: 4px; padding: 8px 7px calc(8px + env(safe-area-inset-bottom)); }
    .tabs .desktop-extra-tab { display: none; }
    .tabs .more-tab { display: inline-flex; }
    .more-tabs-backdrop { position: fixed; inset: 0; z-index: 1001; background: rgba(15, 23, 42, .48); }
    .more-tabs-backdrop.open { display: block; }
    .more-tabs-modal {
        position: fixed;
        z-index: 1002;
        left: 12px;
        right: 12px;
        bottom: calc(75px + env(safe-area-inset-bottom));
        padding: 14px;
        background: var(--card-background);
        border: 1px solid var(--border-color);
        border-radius: 12px;
        box-shadow: 0 12px 35px rgba(15, 23, 42, .25);
    }
    .more-tabs-modal.open { display: block; }
    .more-tabs-handle { width: 38px; height: 4px; margin: 0 auto 12px; background: #cbd5e1; border-radius: 99px; }
    .more-tabs-link { display: block; margin-bottom: 8px; padding: 13px 14px; color: var(--primary-color); background: #eef2f7; border-radius: 7px; font-weight: 700; }
    .more-tabs-link:last-child { margin-bottom: 0; }
    .more-tabs-link:hover, .more-tabs-link.active { color: #fff; background: var(--accent-color); }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
