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

:root {
    --bg: #0f172a;
    --card: #1e293b;
    --accent: #3b82f6;
    --accent-glow: rgba(59, 130, 246, 0.4);
    --text-white: #ffffff;
    --text-dim: #94a3b8;
    --border: rgba(255, 255, 255, 0.1);
    --radius-lg: 16px;
    --radius-sm: 8px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    background-color: var(--bg);
    color: var(--text-white);
    font-family: 'Inter', sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
}

/* ════ INPUT SECTION ════ */
.main-container {
    width: 100%;
    max-width: 800px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.search-section {
    background: var(--card);
    padding: 10px;
    border-radius: var(--radius-lg);
    display: flex;
    gap: 10px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.4);
    border: 1px solid var(--border);
}

.input-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    background: #00000030;
    border-radius: var(--radius-sm);
    padding: 0 20px;
    border: 1px solid transparent;
    transition: 0.3s;
}

.input-wrap:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 10px var(--accent-glow);
}

.input-wrap i { color: var(--accent); margin-right: 15px; }

input {
    background: none;
    border: none;
    color: #fff;
    width: 100%;
    height: 50px;
    font-size: 1rem;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
    outline: none;
}

.btn-glow {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 0 30px;
    border-radius: var(--radius-sm);
    font-weight: 800;
    cursor: pointer;
    font-family: 'Outfit', sans-serif;
    transition: 0.3s;
    text-transform: uppercase;
    font-size: 0.9rem;
}

.btn-glow:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px var(--accent-glow);
}

/* ════ INVOICE DISPLAY (Compact) ════ */
.invoice-container {
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.invoice-sheet {
    background: #ffffff;
    color: #1e293b;
    border-radius: var(--radius-sm);
    padding: 40px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    background-image: 
        radial-gradient(circle at 2px 2px, rgba(0,0,0,0.02) 1px, transparent 0);
    background-size: 24px 24px;
}

.watermark {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-30deg);
    font-size: 5rem;
    font-weight: 900;
    opacity: 0.04;
    white-space: nowrap;
    pointer-events: none;
    color: #000;
}

/* ════ HEADER ════ */
.inv-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 2px solid #f1f5f9;
    padding-bottom: 25px;
    margin-bottom: 30px;
}

.logo-area { display: flex; align-items: center; gap: 15px; }

.logo-circle {
    width: 60px;
    height: 60px;
    background: #1e293b;
    color: #3b82f6;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.8rem;
}

.logo-text h1 { font-family: 'Outfit', sans-serif; font-size: 1.6rem; color: #0f172a; line-height: 1; }
.logo-text h1 span { color: var(--accent); }
.logo-text p { font-size: 0.7rem; font-weight: 800; color: #64748b; letter-spacing: 2px; }

.inv-meta { text-align: right; }
.inv-label { font-size: 0.65rem; font-weight: 800; color: #94a3b8; }
.inv-value { font-family: 'Outfit', sans-serif; font-size: 1.1rem; font-weight: 700; }
.inv-value.accent { color: var(--accent); }

/* ════ ADDRESSES ════ */
.address-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    margin-bottom: 30px;
}

.addr-box h3 { font-size: 0.75rem; color: var(--accent); margin-bottom: 10px; border-bottom: 1px solid #f1f5f9; padding-bottom: 5px; }
.addr-box strong { font-size: 1rem; color: #0f172a; display: block; margin-bottom: 5px; }
.addr-box p { font-size: 0.85rem; color: #475569; line-height: 1.4; }
.addr-box.receiver { text-align: right; }
.contact { font-weight: bold; font-style: italic; color: var(--accent) !important; margin-top: 5px; }

/* ════ TABLE ════ */
.items-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 30px;
}

.items-table th {
    background: #f8fafc;
    padding: 12px 15px;
    font-size: 0.75rem;
    font-weight: 800;
    color: #64748b;
    border-top: 1px solid #f1f5f9;
    border-bottom: 1px solid #f1f5f9;
}

.items-table td {
    padding: 15px;
    font-size: 0.95rem;
    border-bottom: 1px solid #f1f5f9;
}

.center { text-align: center; }
.right { text-align: right; font-weight: 700; }

/* ════ SUMMARY ════ */
.summary-area {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    align-items: end;
}

.stamp-box { position: relative; }

.stamp {
    position: absolute;
    top: -50px;
    border: 4px solid rgba(239, 68, 68, 0.4);
    color: rgba(239, 68, 68, 0.6);
    padding: 5px 15px;
    font-weight: 900;
    font-size: 1.2rem;
    border-radius: 8px;
    transform: rotate(-12deg);
    text-transform: uppercase;
    font-family: 'Outfit', sans-serif;
}

.totals-box {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.total-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: #64748b;
}

.total-row.main {
    margin-top: 5px;
    padding-top: 10px;
    border-top: 2px solid #0f172a;
    font-size: 1.4rem;
    font-weight: 900;
    color: #0f172a;
}

.loyalty-box {
    margin-top: 15px;
    background: #eff6ff;
    border: 1px dashed var(--accent);
    padding: 8px 15px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--accent);
    font-size: 0.8rem;
}

.loyalty-box strong { font-weight: 900; font-size: 0.95rem; }

/* ════ SIGNATURE ════ */
.inv-footer {
    border-top: 1px solid #f1f5f9;
    margin-top: 40px;
    padding-top: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.small-info { font-size: 0.65rem; color: #94a3b8; max-width: 250px; line-height: 1.4; }

.signature-box { text-align: right; }
.hand-sign {
    font-family: 'Dancing Script', cursive;
    font-size: 2rem;
    color: #1e3a8a;
    margin-bottom: -5px;
}
.sign-label {
    font-size: 0.6rem;
    font-weight: 800;
    color: #94a3b8;
    letter-spacing: 1px;
    border-top: 1px solid #e2e8f0;
    padding-top: 5px;
}

/* ════ ANIMATIONS ════ */
@keyframes slideUp {
    from { opacity: 0; transform: translateY(40px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Loader Styles ... (Keep yours or refine) */
.generating-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.waterfall {
    position: absolute;
    width: 100%;
    height: 100%;
    overflow: hidden;
    opacity: 0.15;
    pointer-events: none;
}

.fake-doc {
    position: absolute;
    width: 40px;
    height: 55px;
    background: #fff;
    border-radius: 4px;
    bottom: -60px;
    animation: waterfallMove linear infinite;
}

@keyframes waterfallMove {
    0% { transform: translateY(0); }
    100% { transform: translateY(-120vh); }
}

.hidden { display: none !important; }
.error-box {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    padding: 15px;
    border-radius: var(--radius-sm);
    text-align: center;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.footer-note { text-align: center; font-size: 0.75rem; color: var(--text-dim); opacity: 0.5; }
