/**
 * InvoiceAG – Stile amber/slate (dizajni i ri).
 */

/* Header kryesor – bardhë e plotë, pa ndryshim ngjyrë (pa glass/gri) */
.glass-effect {
    background: #ffffff;
}

/* No-scrollbar: fshij scrollbar-in në sidebar */
.no-scrollbar::-webkit-scrollbar {
    display: none;
}
.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Scrollbar i përgjithshëm (për përmbajtje) */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #e2e8f0;
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: #cbd5e1;
}

/* Nav active – ikona amber (nëse vendoset me klasë) */
.nav-item.active i,
a.nav-item.active [data-lucide] {
    color: #d97706;
}

/* Chart container */
.chart-container canvas {
    max-width: 100%;
}

/* Period filter active state (JS toggles .active) */
.period-btn.active {
    color: #0f172a;
    background-color: #f1f5f9;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}
.period-btn:not(.active):hover {
    color: #0f172a;
    background-color: #f8fafc;
}

/* Menuja mobile: kur është e hapur, shfaq backdrop dhe rrëshqit sidebar-in */
body.mobile-menu-open .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
}
body.mobile-menu-open .sidebar-overlay {
    transform: translateX(0);
}
/* Në desktop (lg+) mbaj sidebar-in gjithmonë të dukshëm */
@media (min-width: 1024px) {
    .sidebar-backdrop {
        display: none !important;
    }
}

/* Në mobile, lëre hapësirë majtas në header që butoni i menysë të mos mbulohet */
@media (max-width: 1023px) {
    main > header {
        padding-left: 3.5rem;
    }
}

/* Dropdown menuja: fshij shënuesin e parazgjedhur të summary */
details.nav-dropdown summary::-webkit-details-marker {
    display: none;
}

/* Tranzicion i butë i sidebar-it */
.sidebar-transition {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Blur i shifrave financiare – fsheh vlerat deri sa përdoruesi klikon show */
.stat-value {
    transition: filter 0.3s ease, opacity 0.3s ease;
    user-select: none;
}
.stat-value.stat-blurred {
    filter: blur(10px);
    opacity: 0.6;
    pointer-events: none;
}

/* ============================================
 * Dizajni i unifikuar – butona, inpute, panele
 * Tema: amber/slate
 * ============================================ */

/* Butoni kryesor (primary) – slate-900 */
.btn-primary {
    padding: 0.5rem 1rem;
    background-color: #0f172a;
    color: #fff;
    font-weight: 500;
    border-radius: 0.5rem;
    transition: all 0.2s;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}
.btn-primary:hover {
    background-color: #1e293b;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}
.btn-primary:focus {
    outline: none;
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px #f59e0b;
}

/* Butoni alternativ (amber accent) */
.btn-amber {
    padding: 0.5rem 1rem;
    background-color: #d97706;
    color: #fff;
    font-weight: 500;
    border-radius: 0.5rem;
    transition: all 0.2s;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}
.btn-amber:hover {
    background-color: #b45309;
}
.btn-amber:focus {
    outline: none;
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px #f59e0b;
}

/* Input unifikuar – slate border, amber focus */
.form-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    background-color: #fff;
    color: #0f172a;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.form-input::placeholder {
    color: #94a3b8;
}
.form-input:focus {
    outline: none;
    border-color: #f59e0b;
    box-shadow: 0 0 0 1px #f59e0b;
}

/* Fushë me buton × për të fshirë vlerën */
.input-clear-wrap {
    position: relative;
    display: block;
    width: 100%;
    isolation: isolate;
}
.input-clear-wrap > .form-input {
    display: block;
    width: 100%;
    padding-right: 2rem;
}
.input-clear-wrap > .input-clear-btn {
    position: absolute;
    right: 0.35rem;
    left: auto;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
}
.input-clear-btn {
    position: absolute;
    right: 0.35rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1.25rem;
    height: 1.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: #94a3b8;
    font-size: 1.125rem;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    border-radius: 0.25rem;
}
.input-clear-btn:hover {
    color: #64748b;
    background-color: #f1f5f9;
}
.input-clear-btn.hidden {
    display: none;
}

/* CKEditor Drucklayout: lartësi fikse (mos mbetet i mbyllur pas ndërrimit të panelit) */
#layoutPanelPayment .layout-payment-editor-wrap .cke_contents,
#layoutPanelPayment .layout-payment-editor-wrap .cke_wysiwyg_div {
    min-height: 280px !important;
    height: 280px !important;
}
#layoutPanelPayment .layout-payment-editor-wrap .cke_inner {
    min-height: 320px;
}

/* × për fushën Kunde (Rechnung erstellen) */
.invoice-client-search-wrap.input-clear-wrap > .js-invoice-client-search-input {
    padding-right: 2rem;
}
.invoice-client-search-wrap > .invoice-client-clear-btn {
    z-index: 3;
}

/* Zona hover mes rreshtave të pozicionit (Rechnung erstellen) */
.invoice-row-insert-zone {
    position: relative;
    height: 0.375rem;
    margin: 0;
    z-index: 2;
    cursor: pointer;
    transition: height 0.15s ease;
}
.invoice-row-insert-zone:hover,
.invoice-row-insert-zone:focus-visible {
    height: 1.25rem;
    outline: none;
}
.invoice-row-insert-zone:focus-visible::before {
    background: #22c55e;
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.25);
}
.invoice-row-insert-zone:hover::before,
.invoice-row-insert-zone:focus-visible::before {
    background: #22c55e;
}
.invoice-row-insert-zone::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 2px;
    transform: translateY(-50%);
    background: transparent;
    border-radius: 1px;
    transition: background-color 0.15s ease, box-shadow 0.15s ease;
    pointer-events: none;
}
.invoice-row-insert-btn {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) scale(0);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    padding: 0;
    border: none;
    border-radius: 9999px;
    background: #22c55e;
    color: #fff;
    font-size: 1.125rem;
    font-weight: 600;
    line-height: 1;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
    opacity: 0;
    transition: transform 0.15s ease, opacity 0.15s ease;
    z-index: 1;
    pointer-events: none;
}
.invoice-row-insert-zone:hover .invoice-row-insert-btn,
.invoice-row-insert-zone:focus-visible .invoice-row-insert-btn {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}
.invoice-row-insert-btn span {
    display: block;
    margin-top: -1px;
}

/* Buton + për shtim të shumë pozicioneve (Rechnung) */
.invoice-add-multiple-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: 1px solid #22c55e;
    border-radius: 0.375rem;
    background: #fff;
    cursor: pointer;
    transition: background-color 0.15s ease;
}
.invoice-add-multiple-btn:hover {
    background: #f0fdf4;
}
.invoice-add-multiple-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.25rem;
    height: 1.25rem;
    border: 1px solid #22c55e;
    border-radius: 9999px;
    color: #16a34a;
    font-size: 0.875rem;
    font-weight: 700;
    line-height: 1;
}
.invoice-add-multiple-field {
    position: relative;
    margin-top: 0.25rem;
}
.invoice-add-multiple-label {
    position: absolute;
    top: -0.5rem;
    left: 0.75rem;
    padding: 0 0.25rem;
    font-size: 0.6875rem;
    font-weight: 500;
    color: #16a34a;
    background: #fff;
    z-index: 1;
}
.invoice-add-multiple-input {
    border-color: #22c55e !important;
    text-align: center;
    font-size: 1.125rem;
    font-weight: 600;
    padding-top: 0.875rem;
    padding-bottom: 0.875rem;
}
.invoice-add-multiple-input:focus {
    border-color: #16a34a !important;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
}

/* Freitext-rresht & menu veprimesh (Rechnung) */
.invoice-row-actions {
    position: relative;
    display: inline-flex;
}
.invoice-row-actions-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border: 1px solid #cbd5e1;
    border-radius: 9999px;
    background: #f8fafc;
    color: #475569;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.invoice-row-actions-toggle:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
    color: #334155;
}
.invoice-row-actions-menu {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translate(calc(-100% - 0.5rem), -50%);
    z-index: 20;
    display: inline-flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.35rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 9999px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}
.invoice-row-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border: none;
    border-radius: 9999px;
    background: transparent;
    color: #475569;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}
.invoice-row-action-btn:hover {
    background: #f1f5f9;
    color: #0f172a;
}
.invoice-row-action-danger:hover {
    background: #fef2f2;
    color: #dc2626;
}
.invoice-text-row {
    border-left: 3px solid #94a3b8;
}
.invoice-gesamt-row {
    border-left: 3px solid #10b981;
}
.invoice-gesamt-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 9999px;
    background: #0f172a;
    color: #ffffff;
}
.invoice-gesamt-value-wrap {
    position: relative;
}
.invoice-money-input-wrap {
    position: relative;
}
.invoice-money-input-wrap .form-input,
.invoice-gesamt-value-wrap .form-input {
    padding-right: 2rem;
}
.invoice-gesamt-value-suffix {
    position: absolute;
    right: 0.65rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.8125rem;
    font-weight: 500;
    color: #64748b;
    opacity: 0.38;
    pointer-events: none;
    user-select: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.invoice-money-input-suffix {
    position: absolute;
    right: 0.65rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.8125rem;
    font-weight: 500;
    color: #64748b;
    opacity: 0.38;
    pointer-events: none;
    user-select: none;
}

/* Panel / kartë e unifikuar */
.panel {
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 1rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px -1px rgba(0, 0, 0, 0.01);
}

/* Kunde scannen – html5-qrcode (si readqr), video full width */
.client-scan-reader video {
    width: 100% !important;
    max-height: 320px;
    object-fit: cover;
}
.client-scan-reader #html5-qrcode-anchor-scan-type-change,
.client-scan-reader #html5-qrcode-button-camera-permission {
    width: 100%;
    margin-top: 0.5rem;
}

/* Printimi i faturës në panelin admin: vetëm dialogu, pa dritare të re */
.ws-invoice-print-busy {
    position: fixed;
    z-index: 200;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    padding: 0.85rem 1.15rem;
    border-radius: 0.75rem;
    background: #0f172a;
    color: #fff;
    font-size: 0.9rem;
    font-weight: 600;
    box-shadow: 0 10px 30px rgb(15 23 42 / 0.28);
}
.ws-invoice-print-root {
    position: absolute;
    left: -100vw;
    top: 0;
    width: 210mm;
    background: #fff;
}
.ws-invoice-print-root img.page {
    display: block;
    width: 100%;
}
@media print {
    @page {
        size: A4;
        margin: 0;
    }
    html,
    body.ws-printing {
        margin: 0 !important;
        padding: 0 !important;
        height: auto !important;
        min-height: 0 !important;
    }
    body.ws-printing > *:not(#wsInvoicePrintRoot) {
        display: none !important;
    }
    body.ws-printing #wsInvoicePrintRoot {
        position: static !important;
        left: auto !important;
        top: auto !important;
        width: 210mm !important;
        margin: 0 !important;
        padding: 0 !important;
        display: block !important;
        line-height: 0 !important;
    }
    /* Pak nën 297mm, që teprica e imazhit të mos hapë faqe bosh */
    body.ws-printing #wsInvoicePrintRoot img.page {
        display: block !important;
        width: 210mm !important;
        height: 296mm !important;
        margin: 0 !important;
        padding: 0 !important;
        border: 0 !important;
        object-fit: fill;
        object-position: top center;
        page-break-inside: avoid;
        break-inside: avoid;
        page-break-after: auto;
        break-after: auto;
    }
    body.ws-printing #wsInvoicePrintRoot img.page:not(:last-child) {
        page-break-after: always;
        break-after: page;
    }
}
