/* ============================================================
   VEHICLE SALE BILL DATA MANAGER — STYLESHEET
   AI-Powered Auto-Extraction Edition
   ============================================================ */
:root {
    --blue: #1565c0; --blue-d: #0d47a1; --blue-l: #e3f2fd;
    --green: #2e7d32; --green-d: #1b5e20; --green-l: #e8f5e9;
    --saffron: #ef6c00; --saffron-d: #e65100; --saffron-l: #fff3e0;
    --red: #c62828; --red-d: #b71c1c; --red-l: #ffebee;
    --violet: #7b1fa2; --violet-d: #4a148c; --violet-l: #f3e5f5;
    --teal: #00796b; --teal-d: #004d40; --teal-l: #e0f2f1;
    --bg: #f4f7fc; --card: #fff; --text: #1a1a2e; --muted: #666;
    --border: #d4dbe6; --radius: 14px; --radius-sm: 8px;
    --shadow: 0 4px 20px rgba(0,0,0,0.07);
    --shadow-lg: 0 8px 36px rgba(0,0,0,0.10);
    --font: 'DM Sans', 'Segoe UI', sans-serif;
    --font-display: 'Playfair Display', Georgia, serif;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 70px; }
body { font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.65; font-weight: 600; }
.container { max-width: 1320px; margin: 0 auto; padding: 0 24px; }

/* ===== NAV ===== */
#stickyNav {
    position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
    background: linear-gradient(135deg, var(--blue-d), var(--violet-d));
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 28px; height: 60px; box-shadow: 0 3px 20px rgba(0,0,0,0.25);
}
.nav-brand { color: #fff; font-size: 16px; font-weight: 900; display: flex; align-items: center; gap: 8px; }
.nav-logo { font-size: 20px; color: #ffd54f; }
.nav-links { display: flex; gap: 4px; align-items: center; }
.nav-btn {
    color: rgba(255,255,255,0.9); background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15); padding: 6px 14px;
    border-radius: 6px; font-size: 12px; font-weight: 800;
    text-decoration: none; cursor: pointer; transition: all .2s;
}
.nav-btn:hover { background: rgba(255,255,255,0.22); color: #fff; }
.nav-print { background: var(--saffron); border-color: var(--saffron-d); }
.hamburger { display: none; background: none; border: none; cursor: pointer; flex-direction: column; gap: 5px; padding: 6px; }
.hamburger span { display: block; width: 24px; height: 2.5px; background: #fff; border-radius: 2px; }

/* ===== HERO ===== */
#hero {
    margin-top: 60px; position: relative; overflow: hidden;
    background: linear-gradient(155deg, #0a1628 0%, var(--blue-d) 35%, var(--violet-d) 70%, #1a0a2e 100%);
    padding: 80px 24px 110px; text-align: center;
}
.hero-bg-pattern { position: absolute; inset: 0; background-image: radial-gradient(rgba(255,255,255,0.04) 1px, transparent 1px); background-size: 28px 28px; }
.hero-inner { position: relative; z-index: 2; }
.hero-badge { display: inline-block; background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.2); padding: 8px 24px; border-radius: 30px; color: #bbdefb; font-size: 12.5px; font-weight: 700; margin-bottom: 26px; }
#hero h1 { font-family: var(--font-display); color: #fff; font-size: 48px; font-weight: 900; line-height: 1.1; margin-bottom: 18px; }
.gradient-text { background: linear-gradient(135deg, #ffd54f, #ffab00, #ff6d00); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.hero-sub { color: #90caf9; font-size: 16.5px; max-width: 680px; margin: 0 auto 32px; font-weight: 600; }
.hero-cta { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin-bottom: 40px; }
.hero-stats { display: flex; gap: 40px; justify-content: center; }
.stat-item { text-align: center; }
.stat-num { display: block; font-size: 32px; font-weight: 900; color: #ffd54f; font-family: var(--font-display); }
.stat-label { font-size: 12px; color: #90caf9; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; }
.hero-wave { position: absolute; bottom: -2px; left: 0; right: 0; }
.hero-wave svg { width: 100%; height: 70px; display: block; }

/* ===== BUTTONS ===== */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 12px 28px; border-radius: 10px; font-size: 14px; font-weight: 800; border: none; cursor: pointer; text-decoration: none; transition: all .25s; font-family: var(--font); }
.btn-glow { background: linear-gradient(135deg, var(--saffron), #f57c00); color: #fff; box-shadow: 0 4px 16px rgba(239,108,0,0.35); }
.btn-glow:hover { transform: translateY(-2px); box-shadow: 0 6px 24px rgba(239,108,0,0.45); }
.btn-outline { background: transparent; border: 2px solid rgba(255,255,255,0.35); color: #fff; }
.btn-outline:hover { background: rgba(255,255,255,0.15); }
.btn-outline-dark { background: transparent; border: 2px solid var(--border); color: var(--text); }
.btn-outline-dark:hover { background: var(--blue-l); }
.btn-sm { padding: 7px 16px; font-size: 12.5px; border-radius: 7px; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-d); }
.btn-accent { background: var(--saffron); color: #fff; }
.btn-accent:hover { background: var(--saffron-d); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: var(--red-d); }

/* AI Extract Button */
.btn-ai {
    background: linear-gradient(135deg, #ff6f00, #f50057, #7b1fa2);
    color: #fff; padding: 14px 32px; border-radius: 12px;
    font-size: 15px; font-weight: 900; border: none; cursor: pointer;
    box-shadow: 0 4px 20px rgba(245,0,87,0.35);
    transition: all .3s; animation: aiPulse 2s ease-in-out infinite;
    position: relative; overflow: hidden;
}
.btn-ai:hover { transform: translateY(-3px) scale(1.02); box-shadow: 0 8px 30px rgba(245,0,87,0.45); animation: none; }
.btn-ai:disabled { opacity: 0.6; cursor: not-allowed; animation: none; transform: none; }
.btn-ai .ai-icon { font-size: 18px; }
@keyframes aiPulse {
    0%, 100% { box-shadow: 0 4px 20px rgba(245,0,87,0.35); }
    50% { box-shadow: 0 6px 30px rgba(245,0,87,0.55); }
}

/* ===== SECTIONS ===== */
section { padding: 56px 0; }
.sec-title { font-family: var(--font-display); font-size: 30px; font-weight: 900; color: var(--blue-d); text-align: center; margin-bottom: 8px; display: flex; align-items: center; justify-content: center; gap: 10px; }
.sec-icon { font-size: 26px; }
.sec-desc { text-align: center; color: var(--muted); font-size: 15px; margin-bottom: 34px; }

/* ===== FLOWCHART ===== */
#flowchart { background: var(--card); }
.flow-wrap { max-width: 980px; margin: 0 auto; background: #fafbfe; border: 2px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); overflow-x: auto; }
#flowSVG { width: 100%; height: auto; min-width: 680px; }

/* ===== UPLOAD ===== */
#upload { background: var(--bg); }
.upload-zone { max-width: 620px; margin: 0 auto; border: 3px dashed var(--blue); border-radius: var(--radius); background: var(--blue-l); padding: 48px 28px; text-align: center; cursor: pointer; transition: all .3s; }
.upload-zone:hover, .upload-zone.drag-over { border-color: var(--saffron); background: var(--saffron-l); transform: scale(1.01); }
.upload-anim { position: relative; width: 80px; height: 80px; margin: 0 auto 16px; }
.upload-circle { position: absolute; inset: 0; border: 3px solid var(--blue); border-radius: 50%; border-top-color: var(--saffron); animation: spin 2.5s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.upload-icon-inner { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 36px; }
.upload-zone h3 { font-size: 19px; font-weight: 900; color: var(--blue-d); margin-bottom: 4px; }
.upload-zone p { color: var(--muted); font-weight: 600; }
.upload-badge { display: inline-block; margin-top: 12px; background: rgba(21,101,192,0.08); padding: 5px 16px; border-radius: 20px; font-size: 11.5px; font-weight: 800; color: var(--blue); }

/* Gallery */
.upload-gallery { margin-top: 32px; }
.gallery-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; flex-wrap: wrap; gap: 10px; }
.gallery-header h3 { font-size: 18px; font-weight: 900; color: var(--blue-d); }
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.gallery-card { background: var(--card); border: 2px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; box-shadow: var(--shadow); transition: all .2s; }
.gallery-card:hover { border-color: var(--blue); box-shadow: var(--shadow-lg); }
.gallery-thumb { height: 160px; overflow: hidden; background: #f0f3f8; display: flex; align-items: center; justify-content: center; }
.gallery-thumb img { width: 100%; height: 100%; object-fit: cover; }
.gallery-thumb .file-type-icon { font-size: 56px; }
.gallery-info { padding: 12px; }
.gallery-info h4 { font-size: 13px; font-weight: 800; color: var(--text); margin-bottom: 4px; word-break: break-all; }
.gallery-info p { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.gallery-btns { display: flex; gap: 6px; padding: 0 12px 12px; }
.gallery-btns .btn { flex: 1; justify-content: center; font-size: 11.5px; padding: 6px 8px; }

/* ===== WORKSPACE ===== */
#workspace { background: var(--card); }
.workspace-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
.ws-preview, .ws-form { background: var(--bg); border: 2px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.ws-preview-header, .ws-form-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 14px 18px; background: linear-gradient(135deg, var(--blue-d), var(--violet-d));
    color: #fff; flex-wrap: wrap; gap: 8px;
}
.ws-preview-header h3, .ws-form-header h3 { font-size: 15px; font-weight: 900; }
#previewSelect { padding: 5px 10px; border-radius: 6px; border: 1px solid rgba(255,255,255,0.3); background: rgba(255,255,255,0.15); color: #fff; font-weight: 700; font-size: 12px; max-width: 200px; cursor: pointer; }
#previewSelect option { color: #333; background: #fff; }
.ws-preview-body { padding: 16px; min-height: 350px; max-height: 550px; overflow-y: auto; }
.ws-preview-body img { width: 100%; border-radius: 8px; border: 1px solid var(--border); }
.ws-empty { text-align: center; padding: 60px 20px; color: #999; }
.ws-empty-icon { font-size: 60px; margin-bottom: 12px; }
.ws-empty p { font-weight: 600; }

/* AI Extract Bar */
.ws-extract-bar { padding: 16px; background: linear-gradient(135deg, #fce4ec, #f3e5f5); border-top: 2px solid #f48fb1; text-align: center; }
.extract-status { margin-top: 10px; font-size: 13px; font-weight: 800; color: var(--violet-d); min-height: 20px; }
.extract-status .spinner { display: inline-block; width: 16px; height: 16px; border: 3px solid #e1bee7; border-top-color: var(--violet); border-radius: 50%; animation: spin 0.8s linear infinite; vertical-align: middle; margin-right: 8px; }

/* Highlight auto-filled fields */
.fg input.ai-filled, .fg textarea.ai-filled {
    border-color: var(--green) !important;
    background: #e8f5e9 !important;
    animation: fieldGlow 1.5s ease-out;
}
@keyframes fieldGlow {
    0% { box-shadow: 0 0 0 4px rgba(46,125,50,0.3); }
    100% { box-shadow: 0 0 0 0 rgba(46,125,50,0); }
}

/* Sheet preview */
.sheet-preview { overflow-x: auto; }
.sheet-preview table { width: 100%; border-collapse: collapse; font-size: 11px; }
.sheet-preview th { background: var(--blue); color: #fff; padding: 7px 8px; font-weight: 800; text-align: left; white-space: nowrap; border: 1px solid var(--blue-d); }
.sheet-preview td { padding: 6px 8px; font-weight: 700; border: 1px solid #e5e5e5; }
.sheet-preview tr:nth-child(even) { background: #f7f9fd; }

/* Form */
.form-body { padding: 18px; }
.fg-row { display: grid; gap: 14px; margin-bottom: 14px; grid-template-columns: 1fr; }
.fg-row-2 { grid-template-columns: 1fr 1fr; }
.fg-row-3 { grid-template-columns: 1fr 1fr 1fr; }
.fg { display: flex; flex-direction: column; }
.fg.full { grid-column: 1 / -1; }
.fg label { font-size: 11.5px; font-weight: 800; color: var(--blue-d); margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.3px; }
.req { color: var(--red); }
.fg input, .fg textarea { padding: 10px 12px; border: 2px solid var(--border); border-radius: var(--radius-sm); font-size: 13.5px; font-weight: 700; font-family: var(--font); color: var(--text); transition: border-color .2s, background .3s; }
.fg input:focus, .fg textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(21,101,192,0.12); }
.fg input::placeholder, .fg textarea::placeholder { color: #aaa; font-weight: 600; }
.form-btns { display: flex; gap: 12px; margin-top: 8px; flex-wrap: wrap; }

/* ===== TABLE ===== */
#dataTable { background: var(--bg); }
.table-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; flex-wrap: wrap; gap: 10px; }
.rec-count { font-size: 15px; font-weight: 800; color: var(--violet); background: var(--violet-l); padding: 7px 18px; border-radius: 8px; }
.table-bar-btns { display: flex; gap: 8px; }
.table-scroll { overflow-x: auto; border-radius: var(--radius); box-shadow: var(--shadow-lg); border: 2px solid var(--blue); }
#recTable { width: 100%; border-collapse: collapse; min-width: 1200px; background: #fff; }
#recTable thead { background: linear-gradient(135deg, var(--blue-d), var(--violet-d)); }
#recTable th { color: #fff; padding: 12px 10px; font-size: 11px; font-weight: 800; text-transform: uppercase; text-align: left; white-space: nowrap; border-right: 1px solid rgba(255,255,255,0.12); }
#recTable th:last-child { border-right: none; }
#recTable td { padding: 10px; font-size: 12.5px; font-weight: 700; border-bottom: 1px solid #eaeaea; border-right: 1px solid #f2f2f2; vertical-align: top; }
#recTable td:last-child { border-right: none; }
#recTable tbody tr:hover { background: var(--blue-l); }
#recTable tbody tr:nth-child(even) { background: #fafcff; }
.empty-row td { text-align: center; padding: 40px !important; color: #999; font-style: italic; }
.act-btns { display: flex; gap: 5px; white-space: nowrap; }
.btn-edit { background: var(--saffron); color: #fff; border: none; padding: 5px 10px; border-radius: 5px; font-size: 11px; font-weight: 800; cursor: pointer; }
.btn-del { background: var(--red); color: #fff; border: none; padding: 5px 10px; border-radius: 5px; font-size: 11px; font-weight: 800; cursor: pointer; }
.btn-edit:hover { background: var(--saffron-d); }
.btn-del:hover { background: var(--red-d); }

/* ===== EXPORT ===== */
#export { background: var(--card); }
.export-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; max-width: 920px; margin: 0 auto; }
.exp-card { text-align: center; padding: 34px 22px; border-radius: var(--radius); box-shadow: var(--shadow); transition: transform .2s, box-shadow .2s; cursor: pointer; }
.exp-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.exp-excel { background: var(--green-l); border: 2px solid var(--green); }
.exp-word { background: var(--blue-l); border: 2px solid var(--blue); }
.exp-pdf { background: var(--red-l); border: 2px solid var(--red); }
.exp-icon { font-size: 44px; margin-bottom: 10px; }
.exp-card h3 { font-size: 18px; font-weight: 900; margin-bottom: 8px; }
.exp-excel h3 { color: var(--green-d); } .exp-word h3 { color: var(--blue-d); } .exp-pdf h3 { color: var(--red-d); }
.exp-card p { font-size: 13px; color: var(--muted); margin-bottom: 18px; }
.btn-export-excel { background: var(--green); color: #fff; } .btn-export-word { background: var(--blue); color: #fff; } .btn-export-pdf { background: var(--red); color: #fff; }
.btn-export-excel:hover { background: var(--green-d); } .btn-export-word:hover { background: var(--blue-d); } .btn-export-pdf:hover { background: var(--red-d); }

/* ===== FOOTER ===== */
footer { background: linear-gradient(135deg, #0f1729, #1a1a2e); color: #bbb; padding: 44px 0 0; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 36px; margin-bottom: 28px; }
.footer-about h3 { color: #ffd54f; font-size: 18px; font-weight: 900; margin-bottom: 10px; }
.footer-about p { font-size: 13px; line-height: 1.8; }
.footer-disc h4 { color: #ff8a65; font-size: 15px; font-weight: 800; margin-bottom: 8px; }
.footer-disc p { font-size: 12.5px; color: #999; line-height: 1.8; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,0.08); padding: 16px 0; text-align: center; }
.footer-bottom p { font-size: 12.5px; color: #777; font-weight: 700; }

/* ===== TOAST ===== */
.toast-box { position: fixed; bottom: 28px; right: 28px; z-index: 9999; padding: 13px 26px; border-radius: 10px; font-size: 13.5px; font-weight: 800; color: #fff; box-shadow: 0 6px 24px rgba(0,0,0,0.18); transform: translateX(140%); transition: transform .35s cubic-bezier(.4,0,.2,1); }
.toast-box.show { transform: translateX(0); }
.toast-box.success { background: var(--green); }
.toast-box.error { background: var(--red); }
.toast-box.info { background: var(--blue); }

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) { .workspace-layout { grid-template-columns: 1fr; } }
@media (max-width: 900px) {
    .nav-links { display: none; flex-direction: column; position: absolute; top: 60px; left: 0; right: 0; background: var(--blue-d); padding: 12px; box-shadow: 0 8px 20px rgba(0,0,0,0.3); }
    .nav-links.open { display: flex; }
    .hamburger { display: flex; }
    #hero h1 { font-size: 34px; }
    .fg-row-2, .fg-row-3 { grid-template-columns: 1fr; }
    .export-grid { grid-template-columns: 1fr; }
    .footer-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
    #hero { padding: 50px 16px 80px; } #hero h1 { font-size: 28px; } .sec-title { font-size: 22px; }
    .table-bar { flex-direction: column; align-items: stretch; }
}
/* ===== PRINT ===== */
@media print {
    #stickyNav, .hero-cta, .hero-stats, .form-btns, .table-bar-btns, .act-btns, .no-print, #upload, #export, .hamburger, .ws-preview, .ws-form-header .btn, .btn, .upload-zone, .upload-gallery, .hero-badge, .hero-bg-pattern, .ws-extract-bar { display: none !important; }
    body { background: #fff; font-size: 10pt; } section { padding: 16px 0; break-inside: avoid; }
    #hero { padding: 20px; margin-top: 0; background: #fff !important; }
    #hero h1 { color: #333 !important; -webkit-text-fill-color: #333 !important; }
    .table-scroll { box-shadow: none; border: 1px solid #333; }
    #recTable { min-width: auto; font-size: 9pt; }
    #recTable thead { background: #333 !important; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
    footer { background: #fff !important; color: #333; }
    .footer-about h3, .footer-disc h4 { color: #333 !important; }
    .footer-disc p, .footer-about p, .footer-bottom p { color: #555 !important; }
}