@font-face {
    font-family: 'Speda';
    src: url('Spayda.ttf');
}

:root {
    --primary: #1e3c72;
    --sidebar-bg: #0f172a;
    --accent: #f59e0b;
    --bg: #f8fafc;
    --white: #ffffff;
}

/* ڕێکخستنی گشتی */
body { margin: 0; background: var(--bg); font-family: 'Speda', sans-serif; color: #1e293b; }
.kurdish-font { font-family: 'Speda', sans-serif !important; }
.num-eng { font-family: 'Segoe UI', Arial !important; direction: ltr; }

/* Dashboard UI */
.app-container { display: flex; height: 100vh; }
.sidebar { width: 300px; background: var(--sidebar-bg); color: var(--white); display: flex; flex-direction: column; box-shadow: 4px 0 15px rgba(0,0,0,0.2); }
.sidebar-header { padding: 25px; text-align: center; border-bottom: 1px solid rgba(255,255,255,0.1); }
.sidebar-header img { width: 70px; margin-bottom: 10px; }
.admin-name { font-size: 15px; color:#b6b5b5; margin: 0; font-weight: bold; }
.sidebar-nav { padding: 15px; }
.nav-item { width: 100%; padding: 12px; background: transparent; border: none; color: white; text-align: right; cursor: pointer; border-radius: 8px; margin-bottom: 8px; font-size: 16px; transition: 0.2s; font-family: 'Speda'; }
.nav-item.active { background: var(--primary); }

.stats-sidebar { flex: 1; padding: 20px; overflow-y: auto; background: rgba(0,0,0,0.2); }
.stats-sidebar h4 { color: #94a3b8; font-size: 15px; border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 10px; margin-bottom: 15px; }
.stat-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,0.05); font-size: 14px; }
.stat-row b { color: var(--accent); }

.main-content { flex: 1; padding: 25px; overflow-y: auto; }
.dashboard-grid { display: grid; grid-template-columns: 1fr 1.3fr; gap: 25px; }
.card { background: var(--white); padding: 25px; border-radius: 12px; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1); }
.input-grid { display: flex; flex-direction: column; gap: 15px; }
.input-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.input-group label { display: block; margin-bottom: 6px; font-weight: bold; font-size: 14px; }
input, select { width: 100%; padding: 10px; border: 1px solid #e2e8f0; border-radius: 8px; font-size: 15px; font-family: 'Speda'; }

.form-actions { margin-top: 25px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn { padding: 12px; border: none; border-radius: 8px; cursor: pointer; font-weight: bold; font-size: 15px; font-family: 'Speda'; }
.btn-primary { background: var(--primary); color: white; }
.btn-secondary { background: #475569; color: white; }
.btn-danger { background: #e11d48; color: white; margin-top: 15px; }

/* Preview Card - تەنها بۆ سەر شاشە */
.preview-card { background: #cbd5e0; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; }
#live-receipt-container { transform: scale(0.6); transform-origin: top center; width: 210mm; }

/* --- Receipt Styling (ستایلی بنەڕەتی وەسڵ) --- */
.receipt { 
    width: 190mm; /* کەمێک بچووکتر لە پانی وەرەقە بۆ ئەوەی لێواری نەبڕێت */
    height: 130mm; /* قەبارەی گونجاو بۆ ئەوەی ٢ دانە جێببێتەوە */
    background: white; 
    border: 1.5px solid #333; 
    padding: 20px; 
    position: relative; 
    box-sizing: border-box; 
    overflow: hidden;
    margin: 0 auto;
}

.receipt::before {

    content: ""; /* نووسینەکە لادەبەین */
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-60%, -50%);
    width: 280px; 
    height: 280px;
    background-image: url('icon/nazcity.png'); /* ناونیشانی لۆگۆکەت */
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    opacity: 0.07; /* زۆر کاڵمان کردووەتەوە تا نووسینەکان تێک نەدات */
    z-index: 0;
    pointer-events: none;
}

/* --- Print Logic (بەشی چاپکردن - زۆر گرنگە) --- */
@media print {
    @page {
        size: A4;
        margin: 5mm; /* پەراوێزی زۆر کەم بۆ ئەوەی هەموو شتێک جێببێتەوە */
    }
    .no-print { display: none !important; }
    #print-area { 
        display: block !important; 
        width: 100%; 
        padding: 0; 
        margin: 0;
    }
    .receipt { 
        border: 1.5px solid #000; 
        height: 135mm; /* بەرزایی ڕێکخراو بۆ چاپ */
        page-break-inside: avoid; 
        margin-bottom: 5mm;
        box-shadow: none;
    }
    .cut-line { 
        border-top: 1px dashed #000 !important; 
        margin: 5mm 0 !important;
        display: block !important;
    }
    body { background: white; padding: 0; }
}

#print-area { display: none; }

/* Archive Modal */
#archive-section { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.8); z-index: 1000; padding: 30px; }
.archive-content { background: white; max-width: 1100px; margin: auto; height: 85vh; border-radius: 15px; padding: 25px; display: flex; flex-direction: column; }
.table-container { flex: 1; overflow-y: auto; }
table { width: 100%; border-collapse: collapse; }
th { background: var(--primary); color: white; padding: 12px; position: sticky; top: 0; }
td { padding: 10px; border-bottom: 1px solid #eee; text-align: center; }


/* زیادکردنی ئەمانە بۆ CSS کەت */
.building-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 10px;
}

.building-item {
    background: #f1f5f9;
    padding: 10px;
    border-radius: 8px;
    text-align: center;
    border: 1px solid #e2e8f0;
}

.building-item i {
    display: block;
    font-size: 20px;
    color: var(--primary);
    margin-bottom: 5px;
}

.building-item b {
    display: block;
    font-size: 14px;
}

.building-item span {
    font-size: 12px;
    color: var(--accent);
    font-weight: bold;
}

.btn-danger-small {
    background: #ef4444;
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
}

/* بۆ خشتەی ناو وەسڵ و زانیاری دانیشتووان */
#residentTable th, #residentTable td {
    padding: 12px;
    border: 1px solid #e2e8f0;
}