/* CollectBase SPA Stylesheet */
/* Matches collectbase.netsons.org legacy look */

:root {
    --primary: #1a1a1a;
    --secondary: #4a4a4a;
    --accent: #c9a961;
    --brand-blue: #2c5aa0;
    --bg: #ffffff;
    --light-gray: #f5f5f5;
    --medium-gray: #e0e0e0;
    --text: #222222;
    --text-light: #666666;
    --border: #d4d4d4;
    --success: #2d7d3a;
    --error: #c92a2a;
    --transition: all 0.3s ease;
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
img, video, iframe, table, pre, code { max-width: 100%; height: auto; }
p, li, td, th, span, div { word-wrap: break-word; overflow-wrap: break-word; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 16px; line-height: 1.6; color: var(--text); background: var(--bg);
    min-height: 100vh; display: flex; flex-direction: column;
    -webkit-text-size-adjust: 100%;
}
a { color: var(--text); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--accent); }
img { max-width: 100%; height: auto; }
hr { border: none; border-top: 1px solid var(--border); margin: 2rem 0; }
h1, h2, h3, h4, h5, h6 { font-weight: 400; line-height: 1.2; margin-bottom: 1rem; color: var(--primary); }
h1 { font-size: 2.5rem; } h2 { font-size: 2rem; } h3 { font-size: 1.5rem; } h4 { font-size: 1.25rem; }

/* --- Layout --- */
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.container-wide { max-width: 1400px; margin: 0 auto; padding: 0 20px; }
#app { flex: 1; padding: 40px 20px; max-width: 1200px; margin: 0 auto; width: 100%; }

/* --- Header overrides (universal-header.css handles main styling) --- */
.nav-link.active { background: var(--light-gray); color: var(--accent); }

/* --- Buttons --- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 10px 22px; font-size: 0.92rem; text-align: center;
    cursor: pointer; border: none; border-radius: 6px; transition: var(--transition);
    font-weight: 500; text-decoration: none; line-height: 1.4;
    font-family: inherit;
}
.btn:hover { text-decoration: none; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--brand-blue); color: #fff; }
.btn-primary:hover { background: #234a85; color: #fff; }
.btn-outline { background: transparent; border: 1px solid var(--brand-blue); color: var(--brand-blue); }
.btn-outline:hover { background: var(--brand-blue); color: #fff; }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: #b89651; color: #fff; }
.btn-danger { background: var(--error); color: #fff; }
.btn-danger:hover { filter: brightness(0.92); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { filter: brightness(0.92); }
.btn-default { background: #fff; color: var(--text); border: 1px solid var(--border); }
.btn-default:hover { border-color: var(--brand-blue); color: var(--brand-blue); }
.btn-sm { padding: 6px 14px; font-size: 0.82rem; border-radius: 5px; }
.btn-block { width: 100%; }

/* Icon-only action buttons (used in table .actions cells) */
.btn-icon {
    width: 32px; height: 32px; padding: 0; border-radius: 6px;
    font-size: 0.95rem; line-height: 1; flex: 0 0 auto;
}
.btn-icon.btn-sm { width: 28px; height: 28px; font-size: 0.85rem; border-radius: 5px; }
.btn-icon.btn-lg { width: 44px; height: 44px; font-size: 1.2rem; border-radius: 8px; }
.btn-icon.btn-default { background: #fff; color: var(--text-light); border: 1px solid var(--border); }
.btn-icon.btn-default:hover { color: var(--brand-blue); border-color: var(--brand-blue); background: #fff; }
.btn-icon.btn-ghost { background: transparent; border: 1px solid transparent; color: var(--text-light); }
.btn-icon.btn-ghost:hover { background: var(--light-gray); color: var(--brand-blue); }
.btn-icon.btn-ghost.btn-danger { background: transparent; color: var(--error); }
.btn-icon.btn-ghost.btn-danger:hover { background: #fdecec; color: var(--error); filter: none; }
.btn-icon.btn-primary { background: var(--brand-blue); color: #fff; border: 1px solid var(--brand-blue); }
.btn-icon.btn-primary:hover { background: #234a85; border-color: #234a85; color: #fff; }
.btn-icon.btn-accent { background: var(--accent); color: #fff; border: 1px solid var(--accent); }
.btn-icon.btn-accent:hover { filter: brightness(0.92); }
.btn-icon.btn-success { background: var(--success); color: #fff; border: 1px solid var(--success); }
.btn-icon.btn-success:hover { filter: brightness(0.92); }
.btn-icon.btn-outline { background: #fff; color: var(--brand-blue); border: 1px solid var(--brand-blue); }
.btn-icon.btn-outline:hover { background: var(--brand-blue); color: #fff; }
.btn-icon.btn-danger { background: var(--error); color: #fff; border: 1px solid var(--error); }
.btn-icon.btn-danger:hover { filter: brightness(0.92); }
.table .actions, .data-table .actions { display: flex; gap: 4px; justify-content: flex-end; align-items: center; flex-wrap: nowrap; }

/* --- Cards --- */
.card {
    background: #fff; border: 1px solid var(--border); overflow: hidden;
    transition: var(--transition); cursor: pointer;
}
.card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.card-cover { width: 100%; height: 280px; object-fit: cover; background: var(--light-gray); }
.card-body { padding: 20px; }
.card-body h3 { font-size: 1.125rem; font-weight: 400; margin-bottom: 10px; }
.card-meta { font-size: 0.875rem; color: var(--text-light); margin-bottom: 10px; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 30px; }

/* --- Badges --- */
.badge {
    display: inline-block; padding: 4px 12px; font-size: 0.8rem; font-weight: 500;
    text-transform: uppercase; letter-spacing: 0.5px; background: var(--light-gray); color: var(--secondary);
}
.badge-success { background: #d4edda; color: var(--success); }
.badge-warning { background: #fff3cd; color: #856404; }
.badge-danger { background: #f8d7da; color: var(--error); }
.badge-info { background: #d1ecf1; color: #0c5460; }
.badge-lg { font-size: 0.9rem; padding: 6px 16px; }

/* --- Forms --- */
.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-size: 0.95rem; margin-bottom: 8px; color: var(--text); }
.form-group input, .form-group select, .form-group textarea {
    width: 100%; padding: 12px; border: 1px solid var(--border); border-radius: 2px;
    font-size: 0.95rem; font-family: inherit; transition: var(--transition);
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none; border-color: var(--accent);
}
.form-group textarea { resize: vertical; min-height: 120px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.form-error { color: var(--error); font-size: 0.875rem; margin-top: 5px; }
.form-card { background: #fff; padding: 40px; border: 1px solid var(--border); }

/* --- Auth pages --- */
.auth-page { display: flex; justify-content: center; align-items: flex-start; padding-top: 60px; }
.auth-card { background: #fff; padding: 40px; border: 1px solid var(--border); width: 100%; max-width: 500px; }
.auth-card h1 { text-align: center; margin-bottom: 2rem; font-weight: 300; }
.auth-link { text-align: center; margin-top: 1.5rem; font-size: 0.9rem; color: var(--text-light); }

/* --- Search bar --- */
.search-bar { margin-bottom: 1.5rem; }
.search-bar input {
    width: 100%; max-width: 500px; padding: 10px 15px; border: 1px solid var(--border);
    border-radius: 2px; font-size: 0.95rem;
}
.search-bar input:focus { outline: none; border-color: var(--accent); }
.filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 1.5rem; }
.filters select { padding: 8px 12px; border: 1px solid var(--border); border-radius: 2px; font-size: 0.9rem; }

/* --- Tables --- */
.table-wrapper { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--border); background: #fff; margin-bottom: 1rem; }
.table, .data-table {
    width: 100%; border-collapse: collapse; background: #fff;
    font-size: 0.92rem;
}
.table-wrapper > .table, .table-wrapper > .data-table { border: none; }
.table { border: 1px solid var(--border); }
.table th, .table td,
.data-table th, .data-table td {
    padding: 12px 15px; text-align: left; border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.table thead th, .data-table thead th {
    background: var(--light-gray); font-weight: 600; font-size: 0.78rem;
    text-transform: uppercase; letter-spacing: 0.6px; color: var(--secondary);
    border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table tbody tr:last-child td, .data-table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover, .data-table tbody tr:hover { background: var(--light-gray); }
.table .text-right, .data-table .text-right { text-align: right; }
.table .text-center, .data-table .text-center { text-align: center; }
.table-striped tbody tr:nth-child(even) { background: #fafafa; }
.table-striped tbody tr:nth-child(even):hover { background: var(--light-gray); }
.table-compact th, .table-compact td { padding: 8px 12px; font-size: 0.88rem; }
.clickable-row { cursor: pointer; }

/* Sortable headers */
.table th.sortable, .data-table th.sortable {
    cursor: pointer; user-select: none; position: relative;
    transition: background 0.15s ease;
}
.table th.sortable:hover, .data-table th.sortable:hover { background: #ececec; color: var(--primary); }
.table th.sortable .sort-label, .data-table th.sortable .sort-label { vertical-align: middle; }
.sort-arrow {
    display: inline-block; margin-left: 6px; font-size: 0.7rem; vertical-align: middle;
    line-height: 1;
}
.sort-arrow--idle { opacity: 0.35; }
.sort-arrow--active { opacity: 1; color: var(--accent); }
.sort-order {
    display: inline-block; margin-left: 4px; min-width: 14px; padding: 1px 5px;
    background: var(--accent); color: #fff; border-radius: 8px;
    font-size: 0.65rem; font-weight: 600; vertical-align: middle; line-height: 1.2;
}

/* Empty / loading / error states for tables */
.empty-state {
    text-align: center; padding: 48px 24px; background: #fff;
    border: 1px dashed var(--border); color: var(--text-light);
}
.empty-state .empty-icon { font-size: 2rem; margin-bottom: 12px; opacity: 0.5; }
.empty-state h4 { font-weight: 500; color: var(--secondary); margin-bottom: 6px; font-size: 1rem; }
.empty-state p { font-size: 0.9rem; margin: 0 0 1rem; color: var(--text-light); }
.empty-state .btn { margin-top: 8px; }
.table-wrapper + .empty-state { margin-top: 0; }
.table-loading { text-align: center; padding: 32px; color: var(--text-light); background: #fff; border: 1px solid var(--border); }
.table-error {
    text-align: center; padding: 24px; background: #fff;
    border: 1px solid #f5c2c7; color: var(--error);
}

/* --- Page header --- */
.page-header { display: flex; align-items: center; gap: 1rem; margin-bottom: 2rem; flex-wrap: wrap; }
.page-header h1 { font-size: 2rem; font-weight: 300; margin-bottom: 0; }

/* --- Breadcrumb --- */
.breadcrumb { font-size: 0.875rem; color: var(--text-light); margin-bottom: 1rem; }
.breadcrumb a { color: var(--text); }
.breadcrumb a:hover { color: var(--accent); }

/* --- Hero --- */
.hero {
    text-align: center; padding: 80px 20px; background: var(--light-gray); margin-bottom: 40px;
}
.hero h1 { font-size: 2.5rem; font-weight: 300; margin-bottom: 20px; }
.hero p { font-size: 1.125rem; color: var(--text-light); margin-bottom: 30px; }

.features-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin: 40px 0; }
.feature-card { text-align: center; padding: 30px 20px; border: 1px solid var(--border); transition: var(--transition); }
.feature-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.feature-card .icon { font-size: 2rem; margin-bottom: .75rem; }
.feature-card h3 { font-size: 1rem; font-weight: 400; margin-bottom: .3rem; }
.feature-card p { font-size: 0.875rem; color: var(--text-light); }

/* --- Auction detail --- */
.auction-detail .cover-img { width: 100%; max-height: 320px; object-fit: cover; margin-bottom: 1.5rem; }
.auction-meta { display: flex; flex-wrap: wrap; gap: .75rem; margin-bottom: 15px; font-size: 0.875rem; color: var(--text-light); }
.lots-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; }
.lot-card { background: #fff; padding: 20px; border: 1px solid var(--border); transition: var(--transition); }
.lot-card:hover { border-color: var(--accent); }
.lot-card h4 { font-size: 1rem; font-weight: 400; margin-bottom: 8px; }
.lot-number { font-size: 0.8rem; color: var(--text-light); font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; }

/* --- Business detail --- */
.business-header { display: flex; gap: 1.5rem; align-items: center; margin-bottom: 1.5rem; padding-bottom: 1.5rem; border-bottom: 1px solid var(--border); }
.business-logo-lg { width: 80px; height: 80px; object-fit: contain; }
.business-badges { display: flex; gap: 8px; margin-top: .5rem; }

/* Tabs */
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--border); margin-bottom: 2rem; }
.tab {
    padding: 12px 24px; background: none; border: none; border-bottom: 2px solid transparent;
    cursor: pointer; font-size: 0.95rem; color: var(--text-light); margin-bottom: -1px;
    transition: var(--transition); text-transform: uppercase; letter-spacing: 0.5px;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* --- Items grid --- */
.items-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 20px; }
.item-card { background: #fff; overflow: hidden; border: 1px solid var(--border); transition: var(--transition); }
.item-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.item-thumb { width: 100%; height: 200px; object-fit: cover; }
.item-thumb-placeholder { width: 100%; height: 200px; background: var(--light-gray); }
.item-card-body { padding: 15px; }
.item-card-body h3 { font-size: 1rem; font-weight: 400; margin-bottom: 8px; }
.item-price { font-size: 1.25rem; color: var(--primary); }
.item-estimate { font-size: 0.875rem; color: var(--text-light); }

/* --- Dashboard --- */
.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 20px; margin-bottom: 40px; }
.dash-card {
    padding: 30px 20px; text-align: center; border: 1px solid var(--border);
    cursor: pointer; transition: var(--transition);
}
.dash-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.dash-icon { font-size: 2rem; margin-bottom: .75rem; }
.dash-card h3 { font-size: 1rem; font-weight: 400; margin-bottom: .25rem; }
.dash-card p { font-size: 0.875rem; color: var(--text-light); }
.dashboard-sections { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; }
.dashboard-sections section { border: 1px solid var(--border); padding: 20px; }
.dashboard-sections h2 { font-size: 1.25rem; font-weight: 400; margin-bottom: 1rem; }

/* --- Invoice detail --- */
.invoice-summary { display: flex; gap: 2rem; margin-bottom: 1.5rem; font-size: 0.9rem; }
.invoice-totals { max-width: 350px; margin-left: auto; margin-top: 1rem; }
.total-row { display: flex; justify-content: space-between; padding: 8px 0; font-size: 0.9rem; }
.total-final { font-weight: 600; font-size: 1.1rem; border-top: 2px solid var(--primary); padding-top: 12px; margin-top: 8px; }

/* --- Watchlist --- */
.watchlist-card { display: flex; align-items: center; }

/* --- Profile / Addresses --- */
.address-card { background: #fff; padding: 20px; margin-bottom: 15px; border: 1px solid var(--border); border-left: 3px solid var(--medium-gray); }
.address-default { border-left-color: var(--accent); }

/* --- Pagination --- */
.pagination { display: flex; justify-content: center; gap: 4px; margin-top: 2rem; padding: .5rem 0; }
.pagination button {
    padding: 8px 16px; border: 1px solid var(--border); background: #fff;
    cursor: pointer; font-size: 0.9rem; transition: var(--transition);
}
.pagination button:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.pagination button.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.pagination button:disabled { opacity: .4; cursor: not-allowed; }

/* --- Toast --- */
.toast-container { position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 9999; display: flex; flex-direction: column; gap: .5rem; }
.toast {
    padding: 12px 20px; color: #fff; font-size: 0.9rem;
    box-shadow: 0 4px 12px rgba(0,0,0,.15); animation: toast-in .3s ease;
    max-width: 380px;
}
.toast-success { background: var(--success); }
.toast-error { background: var(--error); }
.toast-warning { background: #e9c46a; color: var(--text); }
.toast-info { background: var(--primary); }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* --- Spinner --- */
.loading-spinner { display: flex; justify-content: center; padding: 3rem; }
.spinner {
    width: 32px; height: 32px; border: 3px solid var(--medium-gray); border-top-color: var(--accent);
    border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Empty / Error states --- */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-light); }
.empty-state .btn { margin-top: 1.5rem; }
.error-page { text-align: center; padding: 60px 20px; }
.error-page h2 { margin-bottom: .5rem; color: var(--error); }
.text-muted { color: var(--text-light); }
.text-error { color: var(--error); }
.info-grid p { margin-bottom: .5rem; }

/* --- Footer --- */
.footer {
    background: var(--primary); color: rgba(255,255,255,0.6); padding: 20px;
    text-align: center; font-size: 0.875rem; margin-top: auto;
}
.footer a { color: rgba(255,255,255,0.8); }
.footer a:hover { color: var(--accent); }

/* --- Utility --- */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-20 { margin-top: 20px; }
.mb-20 { margin-bottom: 20px; }

/* --- Responsive --- */
@media (max-width: 768px) {
    body { font-size: 14px; }
    h1 { font-size: 1.75rem; } h2 { font-size: 1.5rem; } h3 { font-size: 1.25rem; }
    .container, .container-wide { padding: 0 15px; max-width: 100%; }

    /* Force flex containers to wrap */
    [style*="display: flex"], [style*="display:flex"], .flex, .d-flex { flex-wrap: wrap !important; }

    .form-row { grid-template-columns: 1fr; }
    .dashboard-sections { grid-template-columns: 1fr; }
    .hero { padding: 40px 15px; }
    .hero h1 { font-size: 1.75rem; }
    .business-header { flex-direction: column; text-align: center; }
    #app { padding: 20px 15px; }
    .btn { width: 100%; text-align: center; padding: 12px 20px; }
    .filters { flex-direction: column; gap: 10px; }
    .filters select { width: 100%; font-size: 16px; }
    .form-group input, .form-group select, .form-group textarea { font-size: 16px; }

    /* Tables */
    table, .data-table { min-width: 600px; font-size: 13px; }
    table th, table td { padding: 8px 6px; white-space: nowrap; }

    /* Dashboard */
    .dashboard-grid { grid-template-columns: 1fr 1fr; }

    /* Footer */
    .footer-content { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    body { font-size: 13px; }
    h1 { font-size: 1.5rem; } h2 { font-size: 1.25rem; }
    .container, .container-wide { padding: 0 10px; }
    .btn { padding: 10px 16px; font-size: 14px; }
    table, .data-table { min-width: 500px; font-size: 12px; }
    table th, table td { padding: 6px 4px; }
}
