/* ===== الخطوط العامة ===== */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600&display=swap');

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Cairo', sans-serif;
    background: #f5f9f6;
    direction: rtl;
    display: flex;
    color: #1b1b1b;
}

/* ===== السايدبار ===== */
.sidebar {
    width: 230px;
    background: #2e7d32;
    color: white;
    min-height: 100vh;
    padding: 20px 0;
    position: fixed;
    right: 0;
    top: 0;
}

.logo {
    text-align: center;
    margin-bottom: 25px;
    font-size: 22px;
    font-weight: 700;
}

.sidebar nav {
    display: flex;
    flex-direction: column;
}

.sidebar a {
    color: #d6e8d7;
    text-decoration: none;
    padding: 12px 20px;
    margin: 4px 10px;
    border-radius: 8px;
    transition: 0.3s;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar a.active,
.sidebar a:hover {
    background: #388e3c;
    color: #fff;
}

/* ===== المحتوى ===== */
.main-content {
    margin-right: 230px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ===== التوب بار ===== */
.topbar {
    background: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 25px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
}

.topbar h1 {
    color: #2e7d32;
    margin: 0;
    font-size: 20px;
}

/* ===== منطقة المحتوى ===== */
.content-area {
    padding: 25px;
    max-width: 1100px;
    margin: auto;
}

/* ===== الكروت العامة (Cards) ===== */
.card {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    padding: 25px;
    margin-bottom: 30px;
}

.card h2 {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #1b5e20;
    margin-bottom: 20px;
    font-size: 20px;
    font-weight: 600;
}

/* ===== الفورمات العامة ===== */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

label {
    font-weight: 600;
    color: #1b5e20;
    margin-bottom: 6px;
}

input, select {
    width: 100%;
    padding: 9px 10px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-family: 'Cairo', sans-serif;
    outline: none;
    transition: border 0.2s ease-in-out;
}

input:focus, select:focus {
    border-color: #2e7d32;
}

.mt-2 {
    margin-top: 15px;
}

.btn-main {
    background: #2e7d32;
    border: none;
    color: white;
    padding: 10px 25px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.3s;
}

.btn-main:hover {
    background: #43a047;
}

/* ===== الجداول ===== */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    font-size: 15px;
}

th, td {
    border: 1px solid #e0e0e0;
    padding: 10px;
    text-align: center;
}

th {
    background: #e8f5e9;
    color: #1b5e20;
    font-weight: 600;
}

/* ===== أزرار الإجراءات ===== */
.actions {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.btn-edit, .btn-delete ,.btn-info{
    border: none;
    color: #fff;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: 0.3s;
    font-size: 16px;
}
.btn-info{
    background: #3d88fc;
}

.btn-edit {
    background: #43a047;
}

.btn-delete {
    background: #e53935;
}

.btn-edit:hover {
    background: #2e7d32;
}

.btn-delete:hover {
    background: #c62828;
}

/* ===== الرسائل العامة ===== */
.alert {
    padding: 12px;
    border-radius: 8px;
    margin-top: 10px;
    font-weight: 500;
}

.alert-success {
    background: #e8f5e9;
    color: #2e7d32;
}

.alert-error {
    background: #ffebee;
    color: #c62828;
}

/* ===== Checkboxes في صفحة توزيع الدعم ===== */
input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #2e7d32;
    cursor: pointer;
}

/* ===== الترتيب في الجداول الصغيرة ===== */
@media (max-width: 768px) {
    .form-grid {
        grid-template-columns: 1fr;
    }

    table, thead, tbody, th, td, tr {
        display: block;
    }

    thead {
        display: none;
    }

    tr {
        margin-bottom: 15px;
        border: 1px solid #e0e0e0;
        border-radius: 8px;
        padding: 10px;
    }

    td {
        border: none;
        text-align: right;
        padding: 5px 0;
    }

    td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #1b5e20;
        display: block;
    }
}


.top-section {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: center;
    margin-bottom: 30px;
}

.half-card {
    flex: 1;
    min-width: 450px;
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

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

.info-grid .full {
    grid-column: 1 / -1;
}

/* 💫 الكروت */
.top-section {
    display: flex;
    flex-wrap: wrap;
    gap: 25px;
    justify-content: center;
}

.card {
    background: #fff;
    border-radius: 14px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

.half-card {
    flex: 1;
    min-width: 460px;
    max-width: 680px;
}

.wide-card {
    max-width: 1000px;
    margin: 25px auto;
}

/* 💫 الجدول */
.table-wrapper {
    width: 100%;
    overflow-x: auto;
    border-radius: 8px;
    background: #fafcfb;
}

.family-table {
    width: 100%;
    border-collapse: collapse;
    text-align: center;
    font-size: 14px;
}

.family-table th {
    background-color: #e8f3ea;
    color: #215d35;
    font-weight: 600;
    padding: 10px;
    border-bottom: 2px solid #cde5d2;
    white-space: nowrap;
}

.family-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #ddd;
}

.family-table tr:nth-child(even) {
    background-color: #f9fdfb;
}

/* 💫 الشبكة لعرض بيانات ولي الأمر */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px 20px;
    line-height: 1.6;
}

.info-grid .full {
    grid-column: 1 / -1;
}


/* ===== صفحة توزيع الدعم - تحسينات إضافية دون تعارض ===== */

/* 🔸 عداد عدد المستفيدين */
#countDisplay {
    font-size: 14px;
    color: #555;
    background: #f0f5f1;
    padding: 4px 10px;
    border-radius: 6px;
    margin-right: 8px;
}

/* 🔸 زر تعديل الحالة */
.btn-edit-status {
    background-color: #e8f0ec;
    border: 1px solid #7cb342;
    padding: 6px 10px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    color: #2e7d32;
    font-weight: 600;
    transition: all 0.2s ease-in-out;
}

.btn-edit-status:hover {
    background-color: #c5e1a5;
    color: #1b5e20;
}

/* 🔸 صف العائلة المستفيدة مسبقاً */
tr.received-row {
    background-color: #f1f8e9 !important;
    transition: 0.3s ease;
}

tr.received-row:hover {
    background-color: #e0f2f1 !important;
}

/* 🔸 الرسالة عند النجاح أو الخطأ */
.alert.success {
    background: #e8f5e9;
    border: 1px solid #a5d6a7;
    color: #2e7d32;
    padding: 12px 18px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-weight: 500;
}

.alert.error {
    background: #ffebee;
    border: 1px solid #ef9a9a;
    color: #c62828;
    padding: 12px 18px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-weight: 500;
}

/* ✅ زر تعديل الحالة */
.btn-edit-status {
    background-color: #e8f0ec;
    border: 1px solid #7cb342;
    padding: 6px 10px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    color: #2e7d32;
    font-weight: 600;
    transition: all 0.2s ease-in-out;
}

.btn-edit-status:hover {
    background-color: #c5e1a5;
    color: #1b5e20;
}

/* ✅ صف العائلة المستفيدة مسبقًا */
tr.received-row {
    background-color: #f1f8e9 !important;
}


.btn-main {
    background: #2e7d32;
    color: white;
    border: none;
    padding: 10px 18px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.3s;
}

.btn-main:hover {
    background: #43a047;
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        right: 0;
        top: 0;
        height: 100vh;
        width: 230px;
        transform: translateX(100%);
        transition: transform 0.3s ease-in-out;
        z-index: 2000;
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .menu-toggle {
        display: block;
        font-size: 26px;
        color: #2e7d32;
        background: none;
        border: none;
        cursor: pointer;
    }

    .overlay {
        display: none;
        position: fixed;
        top: 0;
        right: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0, 0, 0, 0.4);
        z-index: 1000;
    }

    .overlay.active {
        display: block;
    }

    .main-content {
        margin-right: 0;
    }
}

