:root {
    --primary: #1b5e20;
    --primary-light: #4c8c4a;
    --accent: #d32f2f;
    --bg-light: #f8f9fa;
    --card-bg: #ffffff;
    --text-dark: #212529;
    --border-color: #dee2e6;
}

* {
    box-sizing: border-box;
    font-family: 'Vazirmatn', sans-serif;
    margin: 0;
    padding: 0;
}

body {
    background-color: #eef2f5;
    color: var(--text-dark);
    direction: rtl;
    -webkit-tap-highlight-color: transparent;
}

/* App Navigation / Controls (Hidden when printing) */
.no-print {
    display: block;
}

.header-bar {
    background: linear-gradient(135deg, #1b5e20, #003300);
    color: white;
    padding: 20px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.container {
    max-width: 1200px;
    margin: 20px auto;
    padding: 0 15px;
}

.nav-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    background: white;
    padding: 10px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    flex-wrap: wrap;
}

.tab-btn {
    padding: 12px 20px;
    border: none;
    background: #f1f3f5;
    color: #495057;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tab-btn.active, .tab-btn:hover {
    background: var(--primary);
    color: white;
}

.card {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 15px;
}

label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    color: #333;
}

input[type="text"], textarea, select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    transition: border 0.3s;
    background: #fff;
}

input[type="text"]:focus, textarea:focus, select:focus {
    border-color: var(--primary);
    outline: none;
}

.btn {
    padding: 10px 22px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 0.3s;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-light); }
.btn-danger { background: var(--accent); color: white; }
.btn-success { background: #2e7d32; color: white; }
.btn-secondary { background: #6c757d; color: white; }

.grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-custom {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
    min-width: 500px;
}

.table-custom th, .table-custom td {
    border: 1px solid var(--border-color);
    padding: 10px;
    text-align: center;
}

.table-custom th {
    background: #f8f9fa;
}

/* Official Document Style (A4 Standard) */
.a4-page {
    width: 210mm;
    height: 297mm;
    max-height: 297mm;
    padding: 12mm 16mm;
    margin: 20px auto;
    background: white;
    box-shadow: 0 0 15px rgba(0,0,0,0.1);
    position: relative;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
}

/* Cover Page Unique Layout */
.cover-page {
    padding: 22mm 20mm;
}

/* Faint Watermark Name at bottom right */
.watermark-name {
    position: absolute;
    bottom: 6mm;
    right: 15mm;
    font-size: 11px;
    color: #b5b5b5;
    font-weight: 600;
    letter-spacing: 0.5px;
    direction: ltr;
}

/* Cover Page Title Styling */
.cover-main-title {
    font-size: 68px;
    font-weight: 900;
    line-height: 1.25;
    color: #ff0000;
    -webkit-text-stroke: 2.2px #000;
    text-shadow: 
        -3px -3px 0 #000,  
         3px -3px 0 #000,
        -3px  3px 0 #000,
         3px  3px 0 #000,
         5px  7px 0px rgba(0, 0, 0, 0.4);
    letter-spacing: 2px;
}

/* Document Header matching Official KRG Format */
.doc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #000;
    padding-bottom: 6px;
    margin-bottom: 8px;
}

.doc-header .header-col {
    text-align: center;
    font-size: 11px;
    font-weight: bold;
    line-height: 1.4;
    flex: 1;
}

.doc-header img.logo {
    max-height: 72px;
    max-width: 88px;
    object-fit: contain;
}

.doc-info-bar {
    display: flex;
    justify-content: space-between;
    background-color: #f2f2f2;
    border: 1px solid #000;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: bold;
    margin-bottom: 8px;
}

.doc-title {
    text-align: center;
    margin: 6px 0;
}

.doc-title h2 { font-size: 16px; color: #000; margin-bottom: 3px; }
.doc-title p { font-size: 12px; font-weight: 600; }

.doc-intro {
    font-size: 11px;
    text-align: justify;
    margin-bottom: 8px;
    line-height: 1.5;
}

.committee-title-heading {
    background-color: #e8f5e9;
    border: 1px solid #1b5e20;
    padding: 4px 10px;
    font-size: 13px;
    font-weight: bold;
    color: #1b5e20;
    margin-bottom: 8px;
}

.doc-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 8px;
    font-size: 11px;
}

.doc-table th, .doc-table td {
    border: 1px solid #000;
    padding: 4px 6px;
    text-align: center;
}

.doc-table th {
    background-color: #f2f2f2;
    font-weight: bold;
}

.duties-box {
    font-size: 10px;
    line-height: 1.45;
    margin-top: 4px;
    flex-grow: 1;
}

.duties-box h4 {
    font-size: 11px;
    margin-bottom: 3px;
    text-decoration: underline;
}

.duties-box ol {
    padding-right: 18px;
}

.duties-box li {
    margin-bottom: 2px;
}

.doc-footer {
    margin-top: 8px;
    display: flex;
    justify-content: flex-end;
    text-align: center;
}

.signature-block {
    width: 200px;
    font-size: 12px;
    font-weight: bold;
}

.signature-space {
    height: 25px;
}

/* PWA Install Modal Styling */
.pwa-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    padding: 20px;
}

.pwa-modal-card {
    background: #fff;
    max-width: 420px;
    width: 100%;
    border-radius: 16px;
    padding: 30px 25px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    animation: popIn 0.3s ease;
}

@keyframes popIn {
    from { transform: scale(0.85); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.pwa-modal-card .pwa-logo {
    width: 80px;
    height: 80px;
    object-fit: contain;
    margin-bottom: 15px;
}

.pwa-modal-card h3 {
    font-size: 20px;
    color: var(--primary);
    margin-bottom: 10px;
}

.pwa-modal-card p {
    font-size: 14px;
    color: #555;
    line-height: 1.7;
    margin-bottom: 20px;
}

.pwa-modal-btns {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.developer-footer {
    text-align: center;
    padding: 22px 15px;
    margin-top: 40px;
    background: #ffffff;
    border-top: 1px solid #dee2e6;
    color: #555;
    font-size: 14px;
}

.developer-footer a {
    color: var(--primary);
    font-weight: 700;
    text-decoration: none;
    margin-right: 5px;
}

/* RESPONSIVE MEDIA QUERIES (Mobile, Tablet, iPad Screen View) */
@media screen and (max-width: 900px) {
    .container {
        padding: 0 10px;
        margin: 10px auto;
    }

    .card {
        padding: 15px;
    }

    .header-bar h1 {
        font-size: 20px;
    }

    .nav-tabs {
        flex-direction: column;
        gap: 6px;
    }

    .tab-btn {
        width: 100%;
        justify-content: center;
    }

    .preview-scroll-wrapper {
        overflow-x: auto;
        padding: 10px 0;
        -webkit-overflow-scrolling: touch;
    }

    .a4-page {
        margin: 10px auto;
        box-shadow: 0 0 10px rgba(0,0,0,0.15);
    }
}

/* STRICT PRINT & PDF MEDIA STYLES (1 Page Per Sheet) */
@page {
    size: A4 portrait;
    margin: 0;
}

@media print {
    html, body {
        width: 210mm !important;
        height: 297mm !important;
        margin: 0 !important;
        padding: 0 !important;
        background: white !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

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

    .a4-page {
        box-shadow: none !important;
        margin: 0 !important;
        width: 210mm !important;
        height: 297mm !important;
        max-height: 297mm !important;
        padding: 10mm 15mm 8mm 15mm !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
        page-break-after: always !important;
        break-after: page !important;
        overflow: hidden !important;
        box-sizing: border-box !important;
        position: relative !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: space-between !important;
    }

    .cover-page {
        padding: 20mm 18mm 16mm 18mm !important;
    }

    .cover-main-title {
        font-size: 64px !important;
        line-height: 1.22 !important;
    }
}