/* ============================================================================
   Focus SB Trade Price List - Styles
   Brand: Charcoal #464749, Gold Accent #ba9533
   ============================================================================ */

:root {
    --primary: #464749;
    --accent: #ba9533;
    --bg: #ffffff;
    --bg-alt: #f5f5f5;
    --bg-light: #e2e2e4;
    --text: #464749;
    --text-muted: #868d93;
    --border: #ddd;
    --error: #c0392b;
    --success: #27ae60;
    --radius: 6px;
}

/* ============================================================================
   Reset & Base
   ============================================================================ */

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: var(--font-body, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif);
    color: var(--text);
    background: var(--bg);
    line-height: 1.5;
}

h1, h2, h3 {
    font-family: var(--font-heading, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif);
    font-weight: 400;
    color: var(--primary);
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ============================================================================
   Login Page
   ============================================================================ */

.login-body {
    background: var(--bg-alt);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.login-container {
    background: var(--bg);
    padding: 40px;
    border-radius: var(--radius);
    box-shadow: 0 2px 20px rgba(0,0,0,0.08);
    max-width: 400px;
    width: 100%;
    text-align: center;
}

.login-logo {
    margin-bottom: 20px;
}

.login-logo .logo {
    max-width: 180px;
    height: auto;
}

.login-container h2 {
    font-size: 24px;
    margin-bottom: 8px;
}

.login-subtitle {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 24px;
}

.login-form {
    text-align: left;
}

.login-form label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text);
}

.login-form input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 16px;
    margin-bottom: 16px;
    font-family: inherit;
}

.login-form input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(186, 149, 51, 0.15);
}

.login-help {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 20px;
}

.error-banner {
    background: #fdf0ef;
    border: 1px solid #e8c4c0;
    color: var(--error);
    padding: 10px 14px;
    border-radius: var(--radius);
    font-size: 14px;
    margin-bottom: 16px;
}

/* ============================================================================
   Buttons
   ============================================================================ */

.btn-primary {
    display: inline-block;
    width: 100%;
    padding: 10px 24px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-size: 16px;
    font-family: var(--font-heading, 'Segoe UI', sans-serif);
    cursor: pointer;
    text-align: center;
    transition: background 0.2s;
}

.btn-primary:hover {
    background: var(--accent);
    text-decoration: none;
}

.btn-accent {
    display: inline-block;
    padding: 8px 20px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-family: var(--font-heading, 'Segoe UI', sans-serif);
    cursor: pointer;
    transition: background 0.2s;
}

.btn-accent:hover {
    background: #a68430;
}

.btn-remove {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    transition: all 0.2s;
}

.btn-remove:hover {
    border-color: var(--error);
    color: var(--error);
}

/* ============================================================================
   App Header
   ============================================================================ */

.app-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 24px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}

.header-logo {
    height: 32px;
    width: auto;
}

.app-header h1 {
    font-size: 18px;
    flex: 1;
}

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

/* ============================================================================
   Main App
   ============================================================================ */

.app-main {
    max-width: 960px;
    margin: 0 auto;
    padding: 24px;
}

/* ============================================================================
   Filter Section
   ============================================================================ */

.filter-section {
    margin-bottom: 24px;
}

.filter-section h2 {
    font-size: 18px;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--accent);
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.filter-group-full {
    grid-column: 1 / -1;
}

.filter-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text);
}

.filter-group select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
    background: var(--bg);
    color: var(--text);
    cursor: pointer;
}

.filter-group select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(186, 149, 51, 0.15);
}

/* ============================================================================
   Price Display
   ============================================================================ */

.price-section {
    margin-bottom: 24px;
}

.price-card {
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
}

.price-info {
    display: flex;
    align-items: baseline;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.price-code {
    font-weight: 700;
    font-size: 14px;
    color: var(--primary);
    font-family: monospace;
}

.price-desc {
    flex: 1;
    font-size: 14px;
    color: var(--text);
    min-width: 200px;
}

.price-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--accent);
    font-family: var(--font-heading, 'Segoe UI', sans-serif);
}

.price-usb-info {
    display: flex;
    gap: 16px;
    margin-bottom: 12px;
    color: var(--text-muted);
}

.add-to-quote-form {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}

.add-to-quote-form label {
    font-size: 13px;
    font-weight: 600;
}

.qty-input {
    width: 70px;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    text-align: center;
    font-family: inherit;
}

.qty-input:focus {
    outline: none;
    border-color: var(--accent);
}

/* ============================================================================
   Quote Table
   ============================================================================ */

.quote-section {
    margin-bottom: 24px;
}

.quote-section h2 {
    font-size: 18px;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--accent);
}

.duplicate-warning {
    background: #fef9e7;
    border: 1px solid #d4ac0d;
    color: #7d6608;
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 14px;
    text-align: center;
    margin-bottom: 12px;
}

.empty-quote {
    color: var(--text-muted);
    font-size: 14px;
    padding: 20px;
    text-align: center;
    background: var(--bg-alt);
    border-radius: var(--radius);
}

.quote-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.quote-table th {
    text-align: left;
    padding: 8px 12px;
    background: var(--primary);
    color: #fff;
    font-weight: 600;
    font-size: 13px;
}

.quote-table th:first-child {
    border-radius: var(--radius) 0 0 0;
}

.quote-table th:last-child {
    border-radius: 0 var(--radius) 0 0;
}

.quote-table td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.quote-table tbody tr:nth-child(even) {
    background: var(--bg-alt);
}

.quote-table tbody tr:hover {
    background: #f0ece0;
}

.total-row td {
    background: var(--bg-alt) !important;
    border-top: 2px solid var(--primary);
    font-size: 15px;
}

.qty-input-sm {
    width: 60px;
    padding: 4px 6px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 13px;
    text-align: center;
    font-family: inherit;
}

.qty-input-sm:focus {
    outline: none;
    border-color: var(--accent);
}

.inline-qty-form {
    display: inline;
}

.quote-actions {
    margin-top: 16px;
    text-align: right;
}

.quote-actions .btn-primary {
    width: auto;
    padding: 10px 30px;
}

/* ============================================================================
   Admin Dashboard
   ============================================================================ */

.admin-body {
    background: var(--bg-alt);
}

.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    background: var(--primary);
    color: #fff;
}

.admin-header h1 {
    color: #fff;
    font-size: 18px;
}

.back-link {
    color: rgba(255,255,255,0.7);
    font-size: 13px;
}

.back-link:hover {
    color: #fff;
}

.admin-main {
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px;
}

.admin-section {
    background: var(--bg);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.admin-section h2 {
    font-size: 16px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    text-align: center;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.stat-label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.stat-value {
    display: block;
    font-size: 22px;
    font-weight: 700;
    color: var(--primary);
    font-family: var(--font-heading, 'Segoe UI', sans-serif);
}

/* Admin Tables */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.admin-table th {
    text-align: left;
    padding: 6px 10px;
    background: var(--bg-alt);
    font-weight: 600;
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border-bottom: 1px solid var(--border);
}

.admin-table td {
    padding: 6px 10px;
    border-bottom: 1px solid #eee;
}

.admin-table tbody tr:hover {
    background: var(--bg-alt);
}

.log-table {
    font-family: monospace;
    font-size: 12px;
}

.nowrap {
    white-space: nowrap;
}

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

.error {
    color: var(--error);
}

/* ============================================================================
   HTMX Loading Indicator
   ============================================================================ */

.htmx-indicator {
    opacity: 0;
    transition: opacity 200ms ease-in;
}

.htmx-request .htmx-indicator {
    opacity: 1;
}

.htmx-request select {
    opacity: 0.6;
}

/* ============================================================================
   Responsive
   ============================================================================ */

@media (max-width: 600px) {
    .app-main, .admin-main {
        padding: 16px;
    }

    .filter-grid {
        grid-template-columns: 1fr;
    }

    .price-info {
        flex-direction: column;
        gap: 4px;
    }

    .price-value {
        font-size: 20px;
    }

    .quote-table {
        font-size: 12px;
    }

    .quote-table th, .quote-table td {
        padding: 6px 8px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
