* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Tahoma", "Segoe UI", sans-serif;
    background: #f4f6f5;
    color: #1f2d24;
}

.navbar {
    background: #1a5f6b;
    color: #fff;
    padding: 14px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.navbar-title {
    font-weight: bold;
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.navbar-logo {
    height: 36px;
    width: 36px;
    object-fit: contain;
}

.navbar-links {
    display: flex;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
}

.navbar-links a {
    color: #fff;
    text-decoration: underline;
}

.subnav {
    background: #0f3f47;
    display: flex;
    gap: 20px;
    padding: 10px 24px;
    flex-wrap: wrap;
}

.subnav a {
    color: #f0d9a8;
    text-decoration: none;
    font-size: 14px;
}

.subnav a:hover {
    color: #fff;
    text-decoration: underline;
}

.container {
    max-width: 900px;
    margin: 32px auto;
    padding: 0 16px;
}

.container-wide {
    max-width: 100%;
    margin: 24px;
    padding: 0 8px;
}

.login-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 80vh;
}

.login-card, .form-card {
    background: #fff;
    padding: 32px;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    width: 100%;
    max-width: 360px;
    display: flex;
    flex-direction: column;
}

.login-logo {
    display: block;
    margin: 0 auto 16px auto;
    height: 100px;
    width: 100px;
    object-fit: contain;
}

.login-card h1, .form-card h1 {
    margin: 0 0 4px 0;
    text-align: center;
}

.subtitle {
    text-align: center;
    color: #6b7a70;
    margin-bottom: 20px;
}

label {
    font-size: 14px;
    margin-bottom: 6px;
    margin-top: 12px;
    font-weight: bold;
}

input[type="text"], input[type="password"], input[type="date"], input[type="time"], textarea {
    padding: 10px 12px;
    border: 1px solid #d3dad6;
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
}

button {
    margin-top: 20px;
    background: #1a5f6b;
    color: #fff;
    border: none;
    padding: 12px;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
}

button:hover {
    background: #103f47;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
}

.header-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.btn {
    background: #1a5f6b;
    color: #fff;
    padding: 10px 16px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 14px;
}

.btn-secondary {
    background: #6b7a70;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
}

.data-table th, .data-table td {
    padding: 12px;
    text-align: right;
    border-bottom: 1px solid #eef1ef;
}

.data-table th {
    background: #e7eef0;
}

.badge {
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
}

.badge-success {
    background: #e2f5e9;
    color: #2e7d4f;
}

.badge-muted {
    background: #eee;
    color: #777;
}

.badge-info {
    background: #e5edff;
    color: #2b4fbd;
}

.link-action {
    color: #1a5f6b;
    text-decoration: underline;
    cursor: pointer;
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

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

.class-card h2 {
    margin-top: 0;
    color: #1a5f6b;
}

.empty-state {
    text-align: center;
    color: #6b7a70;
    padding: 40px;
}

.form-card-wide {
    background: #fff;
    padding: 32px;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    max-width: 480px;
    display: flex;
    flex-direction: column;
}

.form-card-wide select {
    padding: 10px 12px;
    border: 1px solid #d3dad6;
    border-radius: 8px;
    font-size: 15px;
    margin-top: 6px;
}

.enroll-layout {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 24px;
    align-items: start;
}

.enroll-add-form {
    background: #fff;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.enroll-add-form select {
    padding: 10px 12px;
    border: 1px solid #d3dad6;
    border-radius: 8px;
    font-size: 15px;
}

.date-picker-row {
    background: #fff;
    padding: 14px 20px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    max-width: 260px;
}

.date-picker-row label {
    margin: 0;
}

.sheet-wrapper {
    overflow-x: auto;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.sheet-table {
    width: 100%;
    border-collapse: collapse;
    white-space: nowrap;
}

.sheet-table th, .sheet-table td {
    padding: 8px 10px;
    text-align: center;
    border-bottom: 1px solid #eef1ef;
    font-size: 13px;
}

.sheet-table th {
    background: #1a5f6b;
    color: #fff;
    position: sticky;
    top: 0;
}

.sheet-table .student-name-cell {
    text-align: right;
    font-weight: bold;
    white-space: normal;
    min-width: 110px;
}

.sheet-table select {
    padding: 6px;
    border: 1px solid #d3dad6;
    border-radius: 6px;
    font-size: 13px;
    max-width: 110px;
}

.cell-input-narrow {
    width: 55px;
    padding: 6px;
    border: 1px solid #d3dad6;
    border-radius: 6px;
    font-size: 13px;
    text-align: center;
}

.cell-input-wide {
    width: 140px;
    padding: 6px;
    border: 1px solid #d3dad6;
    border-radius: 6px;
    font-size: 13px;
}

.save-sheet-btn {
    margin-top: 16px;
    background: #1a5f6b;
    color: #fff;
    border: none;
    padding: 14px 28px;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
}

.save-sheet-btn:hover {
    background: #103f47;
}

.hint-text {
    margin-top: 12px;
    color: #6b7a70;
    font-size: 13px;
}

.totals-row td {
    background: #e7eef0;
    font-weight: bold;
}

.section-title {
    margin-top: 28px;
    margin-bottom: 12px;
    color: #1a5f6b;
    font-size: 18px;
}

.stat-number {
    font-size: 32px;
    font-weight: bold;
    color: #1a5f6b;
    margin: 0;
}

.balance-card {
    border: 2px solid #1a5f6b;
}

.negative-balance {
    color: #b3261e !important;
}

.request-choices {
    text-align: right;
    min-width: 200px;
}

.request-choices form {
    display: flex;
    flex-direction: column;
}

.gifts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.gift-card {
    background: #fff;
    padding: 16px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.gift-inactive {
    opacity: 0.5;
}

.gift-image {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 8px;
}

.gift-image-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e7eef0;
    font-size: 40px;
}

.gift-name {
    font-weight: bold;
    margin: 4px 0;
}

.gift-price {
    font-size: 13px;
    color: #6b7a70;
    margin: 0;
}

.bar-chart {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    height: 280px;
    padding: 24px 16px 12px 16px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    overflow-x: auto;
    margin-bottom: 20px;
}

.bar-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    height: 100%;
    min-width: 46px;
    flex: 1 0 46px;
}

.bar-value {
    font-size: 12px;
    margin-bottom: 4px;
    font-weight: bold;
    color: #1a5f6b;
}

.bar {
    width: 28px;
    background: #c8862e;
    border-radius: 4px 4px 0 0;
    min-height: 2px;
}

.bar-me {
    background: #b3261e;
}

.bar-label {
    font-size: 11px;
    margin-top: 8px;
    color: #444;
    max-width: 60px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
}

.rank-badge {
    display: inline-block;
    width: 28px;
    height: 28px;
    line-height: 28px;
    border-radius: 50%;
    background: #e7eef0;
    color: #1a5f6b;
    font-weight: bold;
    text-align: center;
}

.rank-badge-gold {
    background: #fff3cd;
    color: #8a6d00;
}
.rank-badge-silver {
    background: #e6e6e6;
    color: #555;
}
.rank-badge-bronze {
    background: #f3ddc8;
    color: #7a4a1e;
}

.my-row {
    background: #e7eef0 !important;
    font-weight: bold;
}

.filter-columns {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    align-items: flex-start;
    margin-bottom: 20px;
}

.checkbox-scroll {
    max-height: 220px;
    overflow-y: auto;
    border: 1px solid #eef1ef;
    border-radius: 8px;
    padding: 8px;
    margin-top: 8px;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: normal;
    padding: 4px 0;
}

.sort-link {
    color: #1a5f6b;
    text-decoration: none;
    font-weight: bold;
}

.sort-link:hover {
    text-decoration: underline;
    color: #0f3f47;
}

.garden-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}

.garden-card {
    background: #fff;
    padding: 16px 10px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    text-align: center;
}

.garden-card-me {
    border: 2px solid #b3261e;
}

.garden-tree {
    font-size: 42px;
    line-height: 1;
    margin-bottom: 8px;
}

.garden-tree img {
    height: 60px;
    width: 60px;
    object-fit: contain;
}

.level-badge-icon {
    display: inline-block;
    vertical-align: middle;
}

.level-badge-icon img {
    height: 22px;
    width: 22px;
    object-fit: contain;
    vertical-align: middle;
}

.garden-title {
    font-size: 12px;
    color: #6b7a70;
    margin: 2px 0 0 0;
}

.flash-messages {
    margin-bottom: 16px;
}

.flash {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 8px;
}

.flash-error {
    background: #fde8e8;
    color: #b3261e;
}

.flash-success {
    background: #e2f5e9;
    color: #2e7d4f;
}

.ajax-loading {
    opacity: 0.4;
    transition: opacity 0.15s ease;
}

.search-box {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.search-box input[type="text"] {
    flex: 1;
    min-width: 220px;
    padding: 10px 12px;
    border: 1px solid #d3dad6;
    border-radius: 8px;
    font-size: 15px;
}

.news-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.news-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    overflow: hidden;
    display: flex;
    flex-wrap: wrap;
}

.news-image {
    width: 220px;
    height: 220px;
    object-fit: cover;
    flex-shrink: 0;
}

.news-body {
    padding: 20px;
    flex: 1;
    min-width: 200px;
}

.news-body h2 {
    margin: 0 0 4px 0;
    color: #1a5f6b;
}

.news-content {
    white-space: pre-line;
    line-height: 1.6;
    margin: 10px 0;
}

.badge-danger {
    background: #fde8e8;
    color: #b3261e;
}

.badge-warning {
    background: #fff3cd;
    color: #8a6d00;
}

/* --- عناصر تظهر بس وقت الطباعة --- */
.print-header {
    display: none;
}

/* --- تنسيق خاص عند الطباعة الفعلية --- */
@media print {
    .navbar, .subnav, .no-print, .flash-messages {
        display: none !important;
    }

    .print-header {
        display: block;
        text-align: center;
        margin-bottom: 20px;
    }

    .print-header h1 {
        margin: 0 0 4px 0;
        font-size: 22px;
    }

    .print-header h2 {
        margin: 0 0 4px 0;
        font-size: 18px;
        color: #1a5f6b;
    }

    .print-header p {
        margin: 0;
        color: #444;
    }

    body {
        background: #fff;
    }

    .container, .container-wide {
        max-width: 100%;
        margin: 0;
        padding: 0;
    }

    .sheet-wrapper {
        overflow: visible;
        box-shadow: none;
    }

    .data-table th {
        background: #eee !important;
        color: #000 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .data-table, .data-table th, .data-table td {
        border: 1px solid #999;
    }

    .totals-row td {
        background: #f2f2f2 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

.cell-input-surah {
    width: 110px;
    padding: 6px;
    border: 1px solid #d3dad6;
    border-radius: 6px;
    font-size: 13px;
}
