/* ====================================================
    ROOT VARIABLES
==================================================== */

:root {
    --light-bg: #fdfaf5;
}

/* ====================================================
    FONT & BASE
==================================================== */

@font-face {
    font-family: "Speda";
    src: url("fonts/Speda.woff2") format("woff2"),
         url("fonts/Speda.woff") format("woff");
    font-weight: normal;
    font-style: normal;
}

body {
    background-color: var(--light-bg);
    font-family: "Speda", "Noto Sans Arabic", system-ui, -apple-system, sans-serif;
    font-size: 13px;
}

#app {
    max-width: 1000px;
    margin: auto;
}

.red-highlight {
    color: #cc0000;
    font-weight: bold;
}

/* ====================================================
    NO PRINT HEADER / TABS
==================================================== */

.header.no-print {
    background: linear-gradient(to left, #007bff, #0056b3);
    padding: 8px 15px;
    border-radius: 8px 8px 0 0;
    box-shadow: 0 4px 6px rgba(0,0,0,.1);
    margin-bottom: 5px;
}

.header .tab-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.tab-button {
    background: transparent;
    border: 2px solid #fff;
    color: #fff;
    padding: 8px 15px;
    font-weight: bold;
    border-radius: 5px;
    cursor: pointer;
    font-size: .9rem;
}

.tab-button.active {
    background: #fff;
    color: #007bff;
}

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ====================================================
    PAGE / CARD (SCREEN)
==================================================== */

.print-card {
    border-radius: 12px;
}

.page-border {
    padding: 20px;
    border: 2px solid #000;
    position: relative;
    overflow: hidden;
    box-sizing: border-box;
}

/* ====================================================
    WATERMARK
==================================================== */

.watermark {
    position: absolute;
    inset: 0;
    opacity: 0.08;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: none;
}

.watermark img {
    max-width: 100%;
}

/* ====================================================
    FORM HEADER
==================================================== */

.form-header {
    border: 2px solid #000;
    padding: 8px 10px;
    margin-bottom: 15px;
}

.logo-img {
    height: 60px;
}

.header-title {
    font-size: 16px;
}

.meta-row {
    border: 1px solid #000;
    padding: 4px 10px;
    margin-top: 10px;
    font-size: 12px;
}

/* ====================================================
    EDITABLE FIELDS
==================================================== */

.field-inline,
.editable-field {
    display: inline-block;
    font-weight: bold;
    min-width: 80px;
    border: none;
    padding: 0 4px;
}

/* ====================================================
    NOTE
==================================================== */

.note-text {
    min-height: 90px;
    padding: 8px;
    font-size: 14px;
    line-height: 1.6;
}

/* ====================================================
    INVENTORY TABLE (SCREEN)
==================================================== */

#itemTable_inv {
    table-layout: fixed;
    width: 100%;
}

#itemTable_inv th:nth-child(1),
#itemTable_inv td:nth-child(1) { width: 10%; }

#itemTable_inv th:nth-child(2),
#itemTable_inv td:nth-child(2) { width: 40%; }

#itemTable_inv th:nth-child(3),
#itemTable_inv td:nth-child(3) { width: 15%; }

#itemTable_inv th:nth-child(4),
#itemTable_inv td:nth-child(4) { width: 35%; }

#itemTable_inv th,
#itemTable_inv td {
    word-wrap: break-word;
}

#itemTable_inv thead tr:first-child th {
    border-bottom: 1px solid #000;
}

/* ====================================================
    RESPECT & SIGNATURE
==================================================== */

.respect-text,
.respect-text-inv {
    font-size: 24px;
    text-align: center;
    margin: 30px 0 15px;
    font-weight: bold;
}

.signature-row-new {
    display: flex;
    justify-content: space-between;
    margin-top: 50px;
    padding: 0 40px;
}

.signature-col {
    width: 48%;
    text-align: center;
}

.signature-col div {
    margin-bottom: 5px;
}

.signature-col .signature,
.signature-line-new {
    border-bottom: 1px solid #000;
    margin-top: 25px;
    margin-bottom: 5px;
}

#adminEmployeeName,
#adminEmployeeName_inv,
#adminEmployeeName_change {
    display: none;
}

/* ====================================================
    PRINT MODE — FINAL & STABLE
==================================================== */

@media print {

    @page {
        size: A4;
        margin: 10mm;
    }

    body {
        background: #fff !important;
        font-size: 10pt;
    }

    .no-print {
        display: none !important;
    }

    .print-card {
        box-shadow: none !important;
        border: none !important;
    }

    .page-border {
        padding: 10px;
        border: 1.5px solid #000;
        border-radius: 6px;
        /* لێرەدا avoid گۆڕدرا بۆ auto بۆ ئەوەی پەرەکە ببێت بە دوو پەرە ئەگەر داتا زۆر بوو */
        page-break-inside: auto !important;
        overflow: visible !important;
    }

    /* CLEAN EDITABLE */
    .field-inline,
    .editable-field,
    *[contenteditable] {
        border: none !important;
        outline: none !important;
        box-shadow: none !important;
        font-weight: normal;
        padding: 0 !important;
        min-width: unset !important;
    }

    /* INVENTORY TABLE PRINT */
    #itemTable_inv {
        table-layout: fixed !important;
        width: 100% !important;
        page-break-inside: auto;
    }
    
    #itemTable_inv tr {
        page-break-inside: avoid;
        page-break-after: auto;
    }

    .table-bordered th,
    .table-bordered td {
        border: 1px solid #000 !important;
        padding: 4px 6px !important;
    }

    .note-text {
        border: 2px solid #000 !important;
        font-size: 10pt !important;
        line-height: 1.4 !important;
    }

    .watermark {
        opacity: 0.12;
    }

    /* ADMIN EMPLOYEE */
    #adminEmployeeSelect,
    #adminEmployeeSelect_inv,
    #adminEmployeeSelect_change {
        display: none !important;
    }

    #adminEmployeeName,
    #adminEmployeeName_inv,
    #adminEmployeeName_change {
        display: block !important;
        font-size: 10pt !important;
        font-weight: bold !important;
        margin-top: 5px !important;
    }

    /* SELECT CLEAN */
    select {
        appearance: none !important;
        border: none !important;
        background: transparent !important;
        font-weight: bold;
    }

    /* FOOTER — چاککراو بۆ ئەوەی گەورە نەبێت */
    .form-footer {
        margin-top: 5mm; /* مەوداکە کەمکرایەوە بۆ ئەوەی فۆتەر گەورە دەرنەکەوێت */
        padding-top: 2mm;
        font-size: 10pt;
        border-top: 1px solid #000;
        text-align: center;
        page-break-inside: avoid;
    }
}

#clearBtn { background: linear-gradient(135deg, #ffcc00, #ff9900); border: none; color: #000; }
#printBtn { background: linear-gradient(135deg, #0d6efd, #084298); border: none; color: white; }

.app-header {
    background: linear-gradient(135deg, #020a28 0%, #0b1f5a 50%, #020a28 100%);
    border: 1px solid rgba(255, 255, 255, 0.15);
    position: relative;
    overflow: hidden;
}

/* Mode Select */
#modeSelect {
    border-radius: 8px;
    border: 1px solid #ddd;
    font-weight: bold;
    cursor: pointer;
}

/* Logo */
.app-header .logo-small {
    height: 48px;
    border-radius: 50%;
    background: #fff;
    padding: 3px;
    box-shadow: 0 0 0 2px #ffd700;
}

/* Title */
.app-header h4 {
    letter-spacing: 0.5px;
}

/* Buttons */
#clearBtn:hover {
    filter: brightness(1.05);
}

#printBtn:hover {
    filter: brightness(1.05);
}

/* No print */
@media print {
    .app-header {
        display: none !important;
    }
}

/* ڕێکخستنی گرووپی دوگمەکان */
.btn-group {
    display: flex;
    gap: 12px;
    align-items: center;
}

.btn-group .btn {
    border-radius: 6px !important;
    transition: all 0.2s ease-in-out;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-group .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    filter: brightness(1.1);
}

#archivePrintBtn {
    background: linear-gradient(135deg, #28a745, #1e7e34);
    color: white;
}