/* ========================================================
   GJENERUES FATURASH - style.css
   ======================================================== */

:root {
    --primary:    #2563eb;
    --primary-dk: #1d4ed8;
    --accent:     #0ea5e9;
    --success:    #16a34a;
    --danger:     #dc2626;
    --bg:         #f1f5f9;
    --border:     #e2e8f0;
    --text:       #1e293b;
    --muted:      #64748b;
    --paper:      #ffffff;
}

* { box-sizing: border-box; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: 0.93rem;
}

/* ---- NAVBAR ---- */
.navbar-brand { font-size: 1.15rem; letter-spacing: 0.3px; }

/* ---- HERO ---- */
.hero-strip {
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    color: #fff;
}
.hero-title  { font-size: 1.6rem; font-weight: 700; margin-bottom: 0.25rem; }
.hero-sub    { font-size: 0.95rem; opacity: 0.88; margin: 0; }

/* ---- CARDS ---- */
.card { border: 1px solid var(--border); border-radius: 10px; }
.section-header {
    background: #f8fafc;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    color: var(--primary);
    padding: 0.7rem 1rem;
    border-radius: 10px 10px 0 0 !important;
    font-size: 0.92rem;
}

/* ---- LOGO UPLOAD ---- */
.logo-upload-area {
    border: 2px dashed var(--border);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.logo-upload-area:hover { border-color: var(--primary); }

/* ---- ITEMS TABLE ---- */
#itemsTable th {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    padding: 0.5rem 0.6rem;
    background: #f8fafc;
}
#itemsTable td { padding: 0.4rem 0.6rem; vertical-align: middle; }
.col-desc  { min-width: 160px; }
.col-qty   { width: 70px; }
.col-unit  { width: 90px; }
.col-price { width: 110px; }
.col-total { width: 110px; }
.col-action { width: 48px; }
.item-total { font-weight: 600; color: var(--primary); }

/* ---- TOTALS CARD ---- */
.card-totali .card-body { background: #f8fafc; }

/* ---- ZGJEDHËSI I GJUHËS ---- */
.lang-switcher {
    display: flex;
    align-items: center;
    gap: 3px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 24px;
    padding: 3px 5px;
}
.lang-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: rgba(255,255,255,0.75) !important;
    text-decoration: none !important;
    padding: 3px 9px;
    border-radius: 18px;
    font-size: 0.75rem;
    font-weight: 600;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}
.lang-btn:hover {
    background: rgba(255,255,255,0.18);
    color: #fff !important;
}
.lang-active {
    background: #fff !important;
    color: var(--primary) !important;
    box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}
.lang-code { font-size: 0.7rem; letter-spacing: 0.3px; }

/* Action bar lang switcher — sfond i bardhë */
.action-bar .lang-switcher {
    background: #f1f5f9;
    border-color: var(--border);
}
.action-bar .lang-btn { color: var(--muted) !important; }
.action-bar .lang-btn:hover { background: var(--border); color: var(--text) !important; }
.action-bar .lang-active { background: var(--primary) !important; color: #fff !important; }

/* ---- NJOFTIM FISKAL ---- */
.alert-fiscal {
    border-left: 4px solid #f59e0b;
    background: #fffbeb;
    color: #78350f;
    border-radius: 8px;
    font-size: 0.875rem;
}

/* ---- VISITOR BADGE ---- */
.visitor-badge {
    display: inline-flex;
    align-items: center;
    background: rgba(255,255,255,0.15);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 20px;
    padding: 3px 12px;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    backdrop-filter: blur(4px);
    white-space: nowrap;
}
.visitor-badge .visitor-label {
    margin-left: 4px;
    font-weight: 400;
    opacity: 0.85;
}
/* action-bar visitor badge (light bg) */
.action-bar .visitor-badge {
    background: #f1f5f9;
    color: var(--primary);
    border-color: var(--border);
}

/* ---- EIMPACT BANNER ---- */
.eimpact-banner {
    background: linear-gradient(135deg, #0f172a 0%, #1a3354 60%, #0f4c81 100%);
    border-top: 4px solid #f59e0b;
    position: relative;
    overflow: hidden;
}
/* Dekorative rrethe sfond */
.eimpact-banner::before {
    content: '';
    position: absolute;
    top: -50px; right: -30px;
    width: 220px; height: 220px;
    background: radial-gradient(circle, rgba(245,158,11,0.15) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}
.eimpact-banner::after {
    content: '';
    position: absolute;
    bottom: -70px; left: 5%;
    width: 300px; height: 300px;
    background: radial-gradient(circle, rgba(14,165,233,0.1) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

/* Wrapper — NUK është <a>, baner si div */
.eimpact-inner {
    display: flex;
    align-items: center;
    gap: 22px;
    padding: 22px 0;
    position: relative;
    z-index: 1;
    text-decoration: none !important;
    color: inherit !important;
}

/* Forced reset për çdo fëmijë brenda bannerit */
.eimpact-banner *,
.eimpact-banner a,
.eimpact-banner a:hover,
.eimpact-banner a:visited,
.eimpact-banner a:active {
    text-decoration: none !important;
    color: inherit;
}

.eimpact-icon-wrap {
    flex-shrink: 0;
    width: 60px; height: 60px;
    background: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
    border-radius: 16px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.7rem;
    color: #fff !important;
    box-shadow: 0 6px 18px rgba(245,158,11,0.45);
}

.eimpact-text {
    flex: 1;
    min-width: 0;
}
.eimpact-title {
    font-size: 1.08rem;
    font-weight: 800;
    color: #ffffff !important;
    margin: 0 0 5px 0;
    line-height: 1.3;
    display: block;
}
.eimpact-sub {
    font-size: 0.83rem;
    color: #94a3b8 !important;
    line-height: 1.5;
    display: block;
}
.eimpact-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}
.eimpact-tag {
    display: inline-block;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    color: #cbd5e1 !important;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 2px 9px;
    border-radius: 20px;
    letter-spacing: 0.3px;
}

.eimpact-cta {
    flex-shrink: 0;
    text-align: center;
}
.eimpact-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: linear-gradient(135deg, #f59e0b 0%, #f97316 100%);
    color: #fff !important;
    font-weight: 800;
    font-size: 0.9rem;
    padding: 12px 24px;
    border-radius: 10px;
    white-space: nowrap;
    box-shadow: 0 4px 16px rgba(245,158,11,0.4);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
    letter-spacing: 0.3px;
    border: none;
    cursor: pointer;
}
.eimpact-banner:hover .eimpact-btn {
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 8px 24px rgba(245,158,11,0.55);
}
.eimpact-url {
    font-size: 0.73rem;
    color: #475569 !important;
    margin-top: 6px;
    letter-spacing: 0.5px;
    display: block;
}

/* ---- FOOTER ---- */
.footer-bar {
    background: var(--text);
    color: #94a3b8;
    padding: 1rem 0;
    font-size: 0.82rem;
}

/* ========================================================
   PREVIEW / INVOICE PAGE
   ======================================================== */
body.preview-body { background: #e9edf2; }

/* Action bar */
.action-bar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: #fff;
    border-bottom: 1px solid var(--border);
    padding: 0.65rem 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

/* Paper */
.invoice-paper {
    background: var(--paper);
    border-radius: 10px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.10);
    padding: 40px 44px;
    max-width: 860px;
    margin: 0 auto;
    /* Mbush faqen e plotë A4 në lartësi */
    min-height: 277mm;
    display: flex;
    flex-direction: column;
}

/* Zona kryesore zgjerohet — footer qëndron poshtë */
.inv-body {
    flex: 1;
    display: flex;
    flex-direction: column;
}
.inv-spacer { flex: 1; }

/* ── RRESHTI 1: Kompania (majtas) + Titulli FATURË (djathtas) ── */
.inv-top-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 4px;
}
.inv-company-block { flex: 1; }
.inv-title-block   { text-align: right; flex-shrink: 0; }

.inv-logo {
    max-height: 70px;
    max-width: 180px;
    object-fit: contain;
    margin-bottom: 10px;
    display: block;
}
.inv-company-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 4px;
}
.inv-meta { font-size: 0.82rem; color: var(--muted); line-height: 1.6; }

.inv-title {
    font-size: 2.4rem;
    font-weight: 900;
    color: var(--primary);
    letter-spacing: 2px;
    line-height: 1;
}

.inv-divider { border-color: var(--border); margin: 14px 0; }

/* ── RRESHTI 2: Klienti (majtas) | Detajet Faturës (djathtas) ── */
.inv-info-row {
    display: flex;
    gap: 20px;
    margin-bottom: 22px;
}

/* Etiketa e seksionit */
.inv-block-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--muted);
    font-weight: 600;
    margin-bottom: 8px;
}

/* Blloku i klientit — majtas, me border të kaltër */
.inv-bleres-block {
    flex: 1;
    background: #f8fafc;
    border-left: 4px solid var(--primary);
    border-radius: 0 8px 8px 0;
    padding: 14px 16px;
}
.inv-bleres-name { font-size: 1.1rem; font-weight: 700; margin-bottom: 4px; color: var(--text); }
.inv-bleres-meta { font-size: 0.82rem; color: var(--muted); line-height: 1.7; }

/* Blloku i detajeve — djathtas, me border të sipërm ngjyrë kaltër */
.inv-details-block {
    flex: 0 0 240px;
    background: #f8fafc;
    border-top: 4px solid var(--primary);
    border-radius: 0 0 8px 8px;
    padding: 14px 16px;
}
.inv-details-table { width: 100%; font-size: 0.85rem; border-collapse: collapse; }
.inv-details-table tr { border-bottom: 1px solid var(--border); }
.inv-details-table tr:last-child { border-bottom: none; }
.inv-dt-label { color: var(--muted); padding: 5px 8px 5px 0; white-space: nowrap; }
.inv-dt-val   { font-weight: 600; padding: 5px 0; text-align: right; }

/* Items Table */
.inv-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 0;
    font-size: 0.88rem;
}
.inv-table thead tr {
    background: var(--primary);
    color: #fff;
}
.inv-table thead th {
    padding: 10px 12px;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.inv-th-nr    { width: 36px; text-align: center; }
.inv-th-desc  { }
.inv-th-qty   { width: 72px; text-align: center; }
.inv-th-unit  { width: 80px; text-align: center; }
.inv-th-price { width: 120px; text-align: right; }
.inv-th-total { width: 120px; text-align: right; }

.inv-table tbody td { padding: 9px 12px; border-bottom: 1px solid var(--border); }
.inv-row-even { background: #fff; }
.inv-row-odd  { background: #f8fafc; }
.inv-td-nr    { text-align: center; color: var(--muted); font-size: 0.8rem; }
.inv-td-qty   { text-align: center; }
.inv-td-unit  { text-align: center; color: var(--muted); font-size: 0.82rem; }
.inv-td-price { text-align: right; }
.inv-td-total { text-align: right; font-weight: 600; }

/* Totals */
.inv-totals-wrap {
    display: flex;
    justify-content: flex-end;
    margin-top: 20px;
    margin-bottom: 24px;
}
.inv-totals-table { width: 300px; font-size: 0.9rem; border-collapse: collapse; }
.inv-totals-table td { padding: 5px 10px; }
.inv-tot-label { color: var(--muted); text-align: right; }
.inv-tot-val   { text-align: right; font-weight: 500; min-width: 110px; }
.inv-tot-grand { background: var(--primary); color: #fff; border-radius: 4px; }
.inv-tot-grand-label { padding: 10px 10px; font-weight: 700; text-align: right; font-size: 0.88rem; border-radius: 4px 0 0 4px; }
.inv-tot-grand-val   { padding: 10px 10px; font-weight: 800; font-size: 1.1rem; text-align: right; border-radius: 0 4px 4px 0; }

/* Notes */
.inv-notes { background: #fffbeb; border: 1px solid #fde68a; border-radius: 6px; padding: 14px 16px; margin-bottom: 24px; }
.inv-notes-title { font-weight: 700; font-size: 0.85rem; color: #92400e; margin-bottom: 6px; }
.inv-notes-body  { font-size: 0.85rem; color: #78350f; line-height: 1.6; }

/* Invoice Footer */
.inv-footer { margin-top: 28px; }
.inv-footer-line { border-top: 2px solid var(--primary); margin-bottom: 8px; }
.inv-footer-text { font-size: 0.78rem; color: var(--muted); text-align: center; }

/* ========================================================
   PRINT STYLES
   ======================================================== */
@media print {
    .no-print, .action-bar { display: none !important; }
    body { background: white !important; margin: 0 !important; padding: 0 !important; }
    #invoiceContainer { margin: 0 !important; padding: 0 !important; }
    .invoice-paper {
        box-shadow: none !important;
        border-radius: 0 !important;
        padding: 18mm 20mm !important;
        max-width: 100% !important;
        width: 100% !important;
        min-height: 257mm !important;
    }
    .container { max-width: 100% !important; padding: 0 !important; margin: 0 !important; }
    .inv-tot-grand { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .inv-table thead tr { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .inv-bleres-block  { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .inv-details-block { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ========================================================
   RESPONSIVE
   ======================================================== */
@media (max-width: 768px) {
    .invoice-paper { padding: 20px 18px; }
    .inv-top-row  { flex-direction: column; gap: 10px; }
    .inv-title-block { text-align: left; }
    .inv-title    { font-size: 1.8rem; }
    .inv-info-row { flex-direction: column; }
    .inv-details-block { flex: 0 0 auto; width: 100%; }
    .inv-totals-table { width: 100%; }
    .inv-totals-wrap { justify-content: flex-start; }
    .col-unit, .inv-th-unit, .inv-td-unit { display: none; }
}

@media (max-width: 576px) {
    .hero-title { font-size: 1.3rem; }
    .card-body { padding: 0.75rem; }
    #itemsTable .col-unit { display: none; }
    .visitor-label { display: none; }
}

/* Banner responsive */
@media (max-width: 640px) {
    .eimpact-inner { flex-wrap: wrap; gap: 12px; }
    .eimpact-cta { width: 100%; text-align: left; }
    .eimpact-btn { width: 100%; text-align: center; display: block; }
    .eimpact-icon-wrap { width: 44px; height: 44px; font-size: 1.3rem; }
    .eimpact-title { font-size: 0.95rem; }
}
