/* ==========================================================================
   Weavify Supplier Portal — Ledger design system
   Mirrors weavify.io frontend tokens (assets/weavify-tokens.css).
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&family=IBM+Plex+Sans+Condensed:wght@500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
    --registry-black: #171411;
    --ledger-white:   #F7F3EA;
    --signal-coral:   #F05A3B;
    --machine-green:  #157A5B;
    --protocol-blue:  #2F5BFF;
    --field-grey:     #D8D1C4;
    --clay-brown:     #7A4E35;
    --warning-amber:  #D8951A;
    --error-red:      #B3261E;

    --green-tint: #E4EFEA;
    --blue-tint:  #E2E8FF;
    --coral-tint: #FCE2DC;
    --amber-tint: #F4E4C2;
    --red-tint:   #F0D7D5;

    --surface:        #F7F3EA;
    --surface-raised: #FFFFFF;
    --surface-inverse:#171411;

    --fg-primary:   #171411;
    --fg-secondary: #4A433D;
    --fg-tertiary:  #7A4E35;

    --border-strong:  #171411;
    --border-default: #B8B0A1;
    --border-soft:    #D8D1C4;

    /* Legacy token shims so existing class hooks keep working. */
    --bg-dark:          #F7F3EA;
    --bg-surface:       #FFFFFF;
    --bg-surface-solid: #FFFFFF;
    --neon-blue:        #F05A3B;
    --neon-purple:      #F05A3B;
    --accent:           #F05A3B;
    --text-primary:     #171411;
    --text-secondary:   #4A433D;
    --text-tertiary:    #7A4E35;
    --glass-border:     #D8D1C4;
    --glow-shadow:      none;
    --success: #157A5B;
    --warning: #D8951A;
    --danger:  #B3261E;

    --font-sans:  'IBM Plex Sans','Atkinson Hyperlegible','Source Sans 3',Arial,sans-serif;
    --font-label: 'IBM Plex Sans Condensed','Bahnschrift','Barlow Condensed','Arial Narrow',sans-serif;
    --font-mono:  'IBM Plex Mono','JetBrains Mono','Roboto Mono',ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;

    --radius-1: 2px;
    --radius-2: 4px;
    --radius-3: 6px;
    --radius-4: 8px;
    --radius-pill: 999px;

    --shadow-1: 0 1px 0 rgba(23, 20, 17, 0.06);
    --shadow-2: 0 1px 2px rgba(23, 20, 17, 0.08);

    --dur-fast: 120ms;
    --dur-base: 180ms;
    --ease: cubic-bezier(0.2, 0, 0, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: var(--font-sans);
    background-color: var(--surface);
    color: var(--fg-primary);
    line-height: 1.55;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
    font-family: var(--font-sans);
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--fg-primary);
}

.brand-logo {
    font-family: var(--font-sans);
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--registry-black);
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--signal-coral); }

::selection { background: var(--signal-coral); color: var(--ledger-white); }

/* Glass shim → flat raised panel */
.glass {
    background: var(--surface-raised);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: 1px solid var(--field-grey);
    border-radius: var(--radius-3);
    box-shadow: var(--shadow-1);
}

.accent { color: var(--signal-coral); }

/* Screens */
.screen { display: none; }
.screen.active { display: block; }

/* ==========================================================================
   LOGIN / REGISTER
   ========================================================================== */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    background: var(--surface);
}

.login-card {
    width: 100%;
    max-width: 440px;
    padding: 36px 32px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    box-shadow: var(--shadow-2);
}

.login-header { text-align: left; margin-bottom: 6px; }
.login-header .brand-logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--registry-black);
    margin-bottom: 14px;
}
.login-header .brand-logo::before {
    content: '';
    display: inline-block;
    width: 28px; height: 28px;
    background: url('https://weavify.io/images/logo/monogram.svg') no-repeat center / contain;
    flex-shrink: 0;
}
.login-header h1 {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--registry-black);
    margin: 4px 0 4px;
}
.login-subtitle {
    font-family: var(--font-mono);
    color: var(--fg-tertiary);
    font-size: 12px;
    letter-spacing: 0.02em;
    margin-top: 0;
}

.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    font-family: var(--font-label);
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--fg-tertiary);
    margin-bottom: 6px;
}

input, select, textarea {
    width: 100%;
    padding: 11px 14px;
    background: var(--surface-raised);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-2);
    color: var(--fg-primary);
    font-family: var(--font-sans);
    font-size: 15px;
    outline: none;
    transition: border-color var(--dur-fast) var(--ease),
                box-shadow var(--dur-fast) var(--ease);
}

input:focus, select:focus, textarea:focus {
    border-color: var(--registry-black);
    box-shadow: 0 0 0 3px rgba(240, 90, 59, 0.18);
}

input::placeholder { color: #9c9384; }

.select-input {
    background: var(--surface-raised);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-2);
    color: var(--fg-primary);
    padding: 9px 14px;
    font-size: 14px;
    max-width: 280px;
}
.select-input option { background: var(--surface-raised); color: var(--fg-primary); }

/* ==========================================================================
   BUTTONS
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 18px;
    border-radius: var(--radius-3);
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 14.5px;
    line-height: 1;
    cursor: pointer;
    border: 1.5px solid transparent;
    transition: background var(--dur-fast) var(--ease),
                color var(--dur-fast) var(--ease),
                border-color var(--dur-fast) var(--ease);
}

.btn-primary {
    background: var(--signal-coral);
    color: var(--ledger-white);
    border-color: var(--signal-coral);
}
.btn-primary:hover {
    background: #D94A2D;
    border-color: #D94A2D;
}

.btn-outline {
    background: var(--surface-raised);
    border: 1.5px solid var(--registry-black);
    color: var(--registry-black);
}
.btn-outline:hover {
    background: var(--registry-black);
    color: var(--ledger-white);
}

.btn-sm { padding: 7px 12px; font-size: 12.5px; }
.btn-full { width: 100%; }

.btn-danger {
    background: var(--surface-raised);
    color: var(--error-red);
    border-color: var(--error-red);
}
.btn-danger:hover {
    background: var(--error-red);
    color: var(--ledger-white);
}

.btn-success {
    background: var(--machine-green);
    color: var(--ledger-white);
    border-color: var(--machine-green);
}

.btn:focus-visible {
    outline: 2px solid var(--signal-coral);
    outline-offset: 2px;
}

.error-text {
    color: var(--error-red);
    font-family: var(--font-mono);
    font-size: 12.5px;
    margin-top: 10px;
    text-align: left;
}

.login-footer {
    text-align: center;
    margin-top: 8px;
    color: var(--fg-secondary);
    font-size: 13.5px;
}
.login-footer a {
    color: var(--registry-black);
    font-weight: 600;
    border-bottom: 1px solid var(--field-grey);
}
.login-footer a:hover { color: var(--signal-coral); border-bottom-color: var(--signal-coral); }

/* ==========================================================================
   DASHBOARD NAV
   ========================================================================== */
.dash-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: var(--ledger-white);
    border-radius: 0;
    border: none;
    border-bottom: 1px solid var(--field-grey);
    box-shadow: none;
    padding: 0 24px;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

.dash-nav-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.dash-nav .brand-logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 20px;
    font-weight: 700;
}
.dash-nav .brand-logo::before {
    content: '';
    display: inline-block;
    width: 26px; height: 26px;
    background: url('https://weavify.io/images/logo/monogram.svg') no-repeat center / contain;
    flex-shrink: 0;
}

.nav-tag {
    font-family: var(--font-label);
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--fg-tertiary);
    vertical-align: middle;
    margin-left: 6px;
}

.nav-user { display: flex; align-items: center; gap: 14px; }
#nav-user-name {
    color: var(--fg-secondary);
    font-size: 13.5px;
    font-family: var(--font-mono);
}

/* ==========================================================================
   DASHBOARD LAYOUT
   ========================================================================== */
.dash-layout {
    display: flex;
    padding-top: 64px;
    min-height: 100vh;
}

.dash-sidebar {
    width: 232px;
    position: fixed;
    top: 64px;
    bottom: 0;
    left: 0;
    background: var(--surface);
    border-radius: 0;
    border: none;
    border-right: 1px solid var(--field-grey);
    box-shadow: none;
    padding: 20px 0;
    overflow-y: auto;
}

.sidebar-menu { list-style: none; }

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 24px;
    cursor: pointer;
    color: var(--fg-secondary);
    font-size: 14px;
    font-weight: 500;
    transition: color var(--dur-fast) var(--ease),
                background var(--dur-fast) var(--ease),
                border-color var(--dur-fast) var(--ease);
    border-left: 3px solid transparent;
}

.sidebar-item:hover {
    color: var(--registry-black);
    background: rgba(23, 20, 17, 0.04);
}
.sidebar-item.active {
    color: var(--registry-black);
    border-left-color: var(--signal-coral);
    background: var(--coral-tint);
}
.sidebar-item.active svg { stroke: var(--signal-coral); }

/* Main */
.dash-main {
    flex: 1;
    margin-left: 232px;
    padding: 32px;
    max-width: 1200px;
}

.tab-content { display: none; }
.tab-content.active { display: block; }

.tab-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
    padding-bottom: 16px;
    border-bottom: 1.5px solid var(--registry-black);
}

.tab-header h2 {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

/* ==========================================================================
   CARD GRID
   ========================================================================== */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

.business-card {
    padding: 22px;
    cursor: pointer;
    transition: border-color var(--dur-fast) var(--ease),
                box-shadow var(--dur-fast) var(--ease);
}

.business-card:hover {
    border-color: var(--registry-black);
    box-shadow: var(--shadow-2);
}

.business-card-name {
    font-family: var(--font-sans);
    font-size: 18px;
    font-weight: 600;
    color: var(--registry-black);
    letter-spacing: -0.01em;
}
.business-card-type {
    display: inline-block;
    padding: 3px 8px;
    border-radius: var(--radius-1);
    font-family: var(--font-label);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-top: 10px;
    background: var(--coral-tint);
    color: var(--signal-coral);
    border: 1px solid var(--signal-coral);
}
.business-card-meta {
    color: var(--fg-secondary);
    font-size: 13.5px;
    margin-top: 8px;
}

/* ==========================================================================
   DATA TABLE
   ========================================================================== */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 12px;
}

.data-table th {
    text-align: left;
    padding: 10px 14px;
    font-family: var(--font-label);
    font-size: 11px;
    color: var(--fg-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
    border-bottom: 1.5px solid var(--registry-black);
}

.data-table td {
    padding: 12px 14px;
    font-size: 14px;
    border-bottom: 1px solid var(--field-grey);
    color: var(--fg-primary);
}

.data-table tr:hover td { background: rgba(23, 20, 17, 0.03); }

/* ==========================================================================
   STATUS BADGES (Ledger chips)
   ========================================================================== */
.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: var(--radius-1);
    font-family: var(--font-label);
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    border: 1px solid currentColor;
}
.badge-confirmed { color: var(--machine-green); background: var(--green-tint); }
.badge-held      { color: var(--warning-amber); background: var(--amber-tint); }
.badge-cancelled { color: var(--error-red);     background: var(--red-tint); }
.badge-expired   { color: var(--fg-tertiary);   background: transparent; border-color: var(--border-default); }

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--fg-tertiary);
    font-family: var(--font-mono);
    font-size: 13.5px;
}

/* ==========================================================================
   SECTION CARDS
   ========================================================================== */
.section-card {
    padding: 24px;
    margin-bottom: 18px;
}

.section-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--field-grey);
}

.section-card-header h3 {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

/* Menu items */
.menu-item-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--field-grey);
}

.menu-item-row:last-child { border-bottom: none; }
.menu-item-name { font-weight: 500; color: var(--fg-primary); }
.menu-item-price {
    font-family: var(--font-mono);
    color: var(--registry-black);
    font-weight: 600;
}
.menu-item-actions { display: flex; gap: 8px; }

/* ==========================================================================
   AVAILABILITY GRID
   ========================================================================== */
.avail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 14px;
    margin-top: 8px;
}

.avail-card {
    padding: 18px;
    text-align: left;
}

.avail-date {
    font-family: var(--font-mono);
    font-weight: 600;
    color: var(--registry-black);
    font-size: 14px;
}
.avail-type {
    font-family: var(--font-label);
    color: var(--fg-tertiary);
    font-size: 10.5px;
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
}
.avail-count {
    font-size: 32px;
    font-weight: 700;
    margin: 10px 0 0;
    letter-spacing: -0.02em;
    color: var(--registry-black);
}
.avail-label { color: var(--fg-tertiary); font-size: 12.5px; }

/* ==========================================================================
   VENUE CARD ACTIONS + EMBED MODAL
   ========================================================================== */
.business-card-actions {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--field-grey);
    display: flex;
    gap: 8px;
}

.embed-block {
    background: var(--surface);
    border: 1px solid var(--field-grey);
    border-radius: var(--radius-3);
    padding: 14px 14px 12px;
    margin-bottom: 12px;
}
.embed-block-header {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 10px;
}
.embed-block-header strong {
    font-size: 13.5px;
    color: var(--registry-black);
    letter-spacing: -0.01em;
}
.embed-block-hint {
    font-family: var(--font-mono);
    font-size: 11.5px;
    color: var(--fg-tertiary);
    line-height: 1.5;
}
.embed-block-hint code {
    background: var(--surface-raised);
    border: 1px solid var(--field-grey);
    border-radius: 2px;
    padding: 0 4px;
    font-size: 11px;
    color: var(--signal-coral);
}
.embed-snippet {
    width: 100%;
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.5;
    background: var(--surface-raised);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-2);
    color: var(--registry-black);
    padding: 10px 12px;
    resize: vertical;
    margin-bottom: 10px;
}
.embed-snippet:focus {
    border-color: var(--registry-black);
    box-shadow: 0 0 0 3px rgba(240, 90, 59, 0.18);
    outline: none;
}

/* ==========================================================================
   MODAL
   ========================================================================== */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(23, 20, 17, 0.55);
    backdrop-filter: blur(2px);
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal-overlay.active { display: flex; }

.modal {
    width: 100%;
    max-width: 520px;
    max-height: 85vh;
    overflow-y: auto;
    padding: 28px;
    background: var(--surface-raised);
    border: 1px solid var(--field-grey);
    border-radius: var(--radius-3);
    box-shadow: 0 8px 24px rgba(23, 20, 17, 0.18);
}

.modal h3 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 1.5px solid var(--registry-black);
    letter-spacing: -0.01em;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

*:focus-visible {
    outline: 2px solid var(--signal-coral);
    outline-offset: 2px;
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 768px) {
    .dash-sidebar { display: none; }
    .dash-main { margin-left: 0; padding: 20px 16px; }
    .card-grid { grid-template-columns: 1fr; }
    .tab-header { flex-direction: column; align-items: flex-start; }
    .tab-header h2 { font-size: 24px; }
    .login-card { padding: 28px 22px; }
}
