/* ============================
   Root + Basic Reset
============================ */
:root {
    --color-bg: #f4faf6;
    --color-bg-soft: #e9f6ef;
    --color-primary: #16a34a;
    --color-primary-soft: rgba(22, 163, 74, 0.08);
    --color-primary-dark: #15803d;
    --color-accent: #22c55e;
    --color-text-main: #123026;
    --color-text-muted: #64746b;
    --color-border-soft: #d5e3da;
    --shadow-soft: 0 12px 30px rgba(22, 163, 74, 0.12);
    --radius-card: 18px;
    --transition-fast: 0.18s ease-out;
    --transition-med: 0.28s ease;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body.app-body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: radial-gradient(circle at top left, #e5f7ec 0, #f4faf6 45%, #f8fbf9 100%);
    color: var(--color-text-main);
    min-height: 100vh;
}

/* ============================
   Page Loader
============================ */
.loader-overlay {
    position: fixed;
    inset: 0;
    background: rgba(244, 250, 246, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
    backdrop-filter: blur(4px);
}

.loader-inner {
    text-align: center;
}

.loader-circle {
    width: 60px;
    height: 60px;
    border-radius: 999px;
    border: 3px solid rgba(22, 163, 74, 0.2);
    border-top-color: var(--color-primary);
    animation: spin 0.9s linear infinite;
    margin: 0 auto 0.75rem;
}

.loader-text {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ============================
   Header + Nav
============================ */
.app-header {
    background: linear-gradient(120deg, #16a34a, #15803d);
    color: #ffffff;
    padding: 0.65rem 1rem 0.45rem;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.12);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.brand-logo {
    background: radial-gradient(circle at 30% 20%, #ffffff, #e7f7ee);
    color: #166534;
    width: 36px;
    height: 36px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: 700;
    box-shadow: 0 4px 10px rgba(15, 118, 110, 0.25);
}

.brand-text {
    font-weight: 600;
    font-size: 1.05rem;
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.brand-text span:first-child {
    font-size: 0.75rem;
    text-transform: uppercase;
    opacity: 0.85;
    letter-spacing: 0.08em;
}

.brand-text span:last-child {
    font-size: 0.95rem;
}

.menu-toggle {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 10px;
    color: #ffffff;
    padding: 0.3rem 0.65rem;
    font-size: 1.1rem;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    cursor: pointer;
    backdrop-filter: blur(6px);
    transition: background var(--transition-fast), transform var(--transition-fast);
}

.menu-toggle:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-1px);
}

.app-nav {
    display: none;
    flex-direction: column;
    padding-top: 0.35rem;
    padding-bottom: 0.35rem;
}

.app-nav.show {
    display: flex;
    animation: slideDown 0.25s ease-out;
}

.nav-link,
.nav-button {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.1rem;
    color: #e5fdf0;
    text-decoration: none;
    font-size: 0.92rem;
}

.nav-link i,
.nav-button i {
    font-size: 1rem;
}

.nav-link:hover,
.nav-button:hover {
    text-decoration: none;
    color: #ffffff;
}

.nav-form {
    margin: 0;
}

.nav-button {
    background: none;
    border: none;
    cursor: pointer;
}

/* ============================
   Main Layout & Page
============================ */
.app-main {
    padding: 1rem;
    max-width: 900px;
    margin: 0 auto;
}

.page {
    animation: fadeInUp 0.4s ease-out;
}

/* ============================
   Cards
============================ */
.card {
    background: #ffffff;
    border-radius: var(--radius-card);
    padding: 1rem 1rem 1rem;
    box-shadow: var(--shadow-soft);
    margin-bottom: 1rem;
    border: 1px solid rgba(209, 250, 229, 0.8);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 0 -10%, rgba(34, 197, 94, 0.16), transparent 55%);
    opacity: 0.85;
    pointer-events: none;
}

.card-inner {
    position: relative;
    z-index: 1;
}

.card-title {
    margin: 0 0 0.25rem;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--color-primary-dark);
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.card-title i {
    font-size: 1.2rem;
    color: var(--color-primary);
}

.card-subtitle {
    margin: 0 0 0.8rem;
    font-size: 0.9rem;
    color: var(--color-text-muted);
}

.card-section {
    margin-top: 1rem;
}

/* Small Quran ribbon / badge */
.badge-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: var(--color-primary-soft);
    color: var(--color-primary-dark);
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    font-size: 0.78rem;
}

/* ============================
   Stats + Progress
============================ */
.stats-grid {
    display: flex;
    gap: 0.75rem;
    margin: 0.75rem 0;
    flex-wrap: wrap;
}

.stat-box {
    flex: 1;
    min-width: 130px;
    background: var(--color-bg-soft);
    border-radius: 14px;
    padding: 0.75rem;
    text-align: left;
    border: 1px solid rgba(22, 163, 74, 0.12);
    box-shadow: 0 8px 18px rgba(15, 118, 110, 0.12);
    position: relative;
    overflow: hidden;
}

.stat-box::after {
    content: "";
    position: absolute;
    right: -20px;
    top: -20px;
    width: 60px;
    height: 60px;
    border-radius: 999px;
    background: radial-gradient(circle, rgba(34, 197, 94, 0.25), transparent 65%);
}

.stat-label {
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-primary-dark);
    margin-top: 0.25rem;
}

.stat-sub {
    font-size: 0.78rem;
    color: var(--color-text-muted);
    margin-top: 0.15rem;
}

/* Progress bar */
.progress-wrap {
    margin-top: 0.75rem;
}

.progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.78rem;
    color: var(--color-text-muted);
    margin-bottom: 0.2rem;
}

.progress-track {
    width: 100%;
    background: #e5f5eb;
    height: 8px;
    border-radius: 999px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #22c55e, #16a34a);
    border-radius: 999px;
    transition: width 0.5s ease-out;
}

/* ============================
   Forms
============================ */
.form {
    margin-top: 0.5rem;
}

.form-group {
    margin-bottom: 0.9rem;
}

.form-group label {
    display: block;
    font-size: 0.9rem;
    margin-bottom: 0.2rem;
    color: #234135;
}

.input,
select.input,
textarea.input {
    width: 100%;
    padding: 0.55rem 0.7rem;
    border-radius: 10px;
    border: 1px solid #cbd5ce;
    font-size: 0.95rem;
    background: #f9fdfb;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}

textarea.input {
    resize: vertical;
}

.input:focus,
select.input:focus,
textarea.input:focus {
    outline: none;
    border-color: rgba(34, 197, 94, 0.7);
    background: #ffffff;
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.15);
}

/* Checkbox inline label */
.checkbox-inline {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.88rem;
}

/* ============================
   Buttons
============================ */
.btn-primary,
.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    text-align: center;
    border-radius: 999px;
    padding: 0.55rem 1.1rem;
    font-size: 0.95rem;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast), color var(--transition-fast);
}

.btn-primary {
    background: linear-gradient(120deg, #16a34a, #22c55e);
    color: #ffffff;
    box-shadow: 0 10px 18px rgba(22, 163, 74, 0.4);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 22px rgba(21, 128, 61, 0.45);
}

.btn-secondary {
    background: #ffffff;
    color: var(--color-primary-dark);
    border: 1px solid rgba(22, 163, 74, 0.35);
}

.btn-secondary:hover {
    background: #ecfdf3;
}

.btn-primary.full-width,
.btn-secondary.full-width {
    width: 100%;
}

/* ============================
   Lists
============================ */
.list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0;
    border-bottom: 1px solid #edf1ee;
}

.list-item:last-child {
    border-bottom: none;
}

.list-item-main {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.list-item-title {
    font-size: 0.95rem;
    font-weight: 600;
}

.list-item-sub {
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

.list-item-note {
    font-size: 0.8rem;
    color: #2e4a3b;
    margin-top: 0.2rem;
}

.empty-text {
    font-size: 0.9rem;
    color: #777;
}

/* ============================
   Info list
============================ */
.info-list {
    list-style: none;
    padding: 0;
    margin: 0.25rem 0;
}

.info-list li {
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

/* ============================
   Tables (Reports)
============================ */
.table-wrap {
    width: 100%;
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
}

.table th,
.table td {
    border: 1px solid #dde5df;
    padding: 0.5rem 0.6rem;
    text-align: left;
}

.table th {
    background: linear-gradient(120deg, #e0f2e9, #f0fdf4);
    color: #234135;
    font-weight: 600;
}

.table tbody tr:nth-child(even) {
    background: #f8faf9;
}

/* ============================
   Alerts
============================ */
.alert {
    padding: 0.7rem 0.9rem;
    border-radius: 10px;
    font-size: 0.85rem;
    margin-bottom: 0.6rem;
}

.alert.success {
    background: #e1f7eb;
    color: #166534;
}

.alert.error {
    background: #fde8e8;
    color: #9b1c1c;
}

/* ============================
   Avatar
============================ */
.avatar-preview img {
    margin-top: 0.4rem;
    width: 60px;
    height: 60px;
    border-radius: 999px;
    object-fit: cover;
}

/* ============================
   Footer
============================ */
.app-footer {
    text-align: center;
    font-size: 0.8rem;
    color: #4d5c54;
    padding: 1rem 0.75rem 1.4rem;
}

/* ============================
   Pagination
============================ */
.pagination {
    display: flex;
    list-style: none;
    gap: 0.25rem;
    padding: 0;
    margin-top: 0.75rem;
    font-size: 0.85rem;
    flex-wrap: wrap;
}

.pagination li a,
.pagination li span {
    display: inline-block;
    padding: 0.3rem 0.55rem;
    border-radius: 999px;
    text-decoration: none;
    border: 1px solid #d2ddd6;
    color: #234135;
    background: #ffffff;
}

.pagination li.active span {
    background: #16a34a;
    border-color: #16a34a;
    color: #ffffff;
}

/* ============================
   Animations
============================ */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================
   Larger screens
============================ */
@media (min-width: 768px) {
    .app-main {
        padding: 1.4rem;
    }

    .app-nav {
        display: flex !important;
        flex-direction: row;
        gap: 1rem;
        margin-top: 0.45rem;
    }

    .menu-toggle {
        display: none;
    }

    .nav-link,
    .nav-button {
        padding: 0.2rem 0;
    }
}
