/* ==================================
   المقرأة الموصلية الإلكترونية
   Custom Styles
   ================================== */

:root {
    --primary-color: #1a5632;
    --primary-dark: #0f3d22;
    --primary-light: #2d7a4a;
    --accent-color: #c8a84e;
    --bg-light: #f5f7f9;
}

/* General */
body {
    font-family: 'Tajawal', sans-serif;
    background-color: var(--bg-light);
    min-height: 100vh;
}

html,
body {
    height: 100%;
}

a { color: var(--primary-color); }
a:hover { color: var(--primary-dark); }

/* App Shell + Sidebar */
.app-shell {
    background: #f3f6f4;
}

.app-layout {
    min-height: 100vh;
}

.app-sidebar {
    width: 300px;
    min-width: 300px;
    background: linear-gradient(180deg, #0f3d22 0%, #103f25 45%, #0b2f1a 100%);
    color: #fff;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    box-shadow: -8px 0 22px rgba(0, 0, 0, 0.18);
}

.app-sidebar-brand {
    color: #fff;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 1.2rem 1.2rem 0.75rem;
    font-weight: 800;
    font-size: 1.1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.app-sidebar-brand i {
    font-size: 1.4rem;
    color: #e7c771;
}

.app-sidebar-menu {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.app-user-card {
    padding: 0.8rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.08);
}

.app-nav-section {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: rgba(255, 255, 255, 0.7);
    margin-top: 0.8rem;
    margin-bottom: 0.15rem;
    padding: 0 0.4rem;
}

.app-nav-link {
    color: rgba(255, 255, 255, 0.92);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.62rem 0.75rem;
    border-radius: 10px;
    transition: all 0.2s ease;
}

.app-nav-link i {
    width: 20px;
    text-align: center;
    font-size: 1rem;
}

.app-nav-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.14);
}

.app-nav-link.active {
    color: #0f3d22;
    background: #e7c771;
    font-weight: 700;
}

.app-main {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    width: 100%;
}

.app-content {
    flex: 1;
}

.app-footer {
    background: #122117;
    color: rgba(255, 255, 255, 0.9);
}

.app-mobile-topbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    background: linear-gradient(90deg, #0f3d22, #154d2e);
    padding: 0.65rem 0.9rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
}

.app-mobile-brand {
    text-decoration: none;
    color: #fff;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-weight: 700;
}

.app-mobile-sidebar {
    width: 305px !important;
    background: #103a22;
    color: #fff;
}

.app-mobile-sidebar .offcanvas-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

.app-mobile-sidebar .btn-close {
    filter: invert(1);
}

.app-mobile-sidebar .app-sidebar-menu {
    padding: 1rem;
}

@media (min-width: 992px) {
    .app-layout {
        display: flex;
    }
}

@media (max-width: 991.98px) {
    .app-content {
        padding-top: 1rem !important;
    }
}

/* Navbar */
.navbar {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark)) !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}
.navbar-brand {
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: -0.3px;
}
.navbar .nav-link {
    font-size: 0.9rem;
    padding: 0.5rem 0.75rem !important;
    border-radius: 6px;
    transition: background 0.2s;
}
.navbar .nav-link:hover,
.navbar .nav-link.active {
    background: rgba(255, 255, 255, 0.12);
}

/* Auth Pages */
.auth-body {
    position: relative;
    overflow-x: hidden;
    overflow-y: scroll !important;
    -webkit-overflow-scrolling: touch;
    background:
        radial-gradient(circle at 18% 12%, rgba(218, 184, 88, 0.24) 0, rgba(218, 184, 88, 0) 38%),
        radial-gradient(circle at 82% 88%, rgba(245, 230, 181, 0.14) 0, rgba(245, 230, 181, 0) 46%),
        linear-gradient(140deg, #133f27 0%, #0d301d 52%, #082115 100%);
    min-height: 100dvh;
    display: block;
    padding: 2rem 0 3rem;
}

.auth-body::before,
.auth-body::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

/* شبكة هندسية مستوحاة من الزخارف الإسلامية */
.auth-body::before {
    opacity: 0.24;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cg transform='translate(60 60)' fill='none' stroke='%23d9b767' stroke-width='2.2' stroke-linejoin='round'%3E%3Ccircle r='47'/%3E%3Ccircle r='38'/%3E%3Ccircle r='9'/%3E%3Cpath d='M0 -52 L11 -33 L0 -14 L-11 -33 Z'/%3E%3Cpath d='M0 -52 L11 -33 L0 -14 L-11 -33 Z' transform='rotate(45)'/%3E%3Cpath d='M0 -52 L11 -33 L0 -14 L-11 -33 Z' transform='rotate(90)'/%3E%3Cpath d='M0 -52 L11 -33 L0 -14 L-11 -33 Z' transform='rotate(135)'/%3E%3Cpath d='M0 -52 L11 -33 L0 -14 L-11 -33 Z' transform='rotate(180)'/%3E%3Cpath d='M0 -52 L11 -33 L0 -14 L-11 -33 Z' transform='rotate(225)'/%3E%3Cpath d='M0 -52 L11 -33 L0 -14 L-11 -33 Z' transform='rotate(270)'/%3E%3Cpath d='M0 -52 L11 -33 L0 -14 L-11 -33 Z' transform='rotate(315)'/%3E%3Cpath d='M0 -61 L7 -51 L0 -41 L-7 -51 Z'/%3E%3Cpath d='M0 -61 L7 -51 L0 -41 L-7 -51 Z' transform='rotate(45)'/%3E%3Cpath d='M0 -61 L7 -51 L0 -41 L-7 -51 Z' transform='rotate(90)'/%3E%3Cpath d='M0 -61 L7 -51 L0 -41 L-7 -51 Z' transform='rotate(135)'/%3E%3Cpath d='M0 -61 L7 -51 L0 -41 L-7 -51 Z' transform='rotate(180)'/%3E%3Cpath d='M0 -61 L7 -51 L0 -41 L-7 -51 Z' transform='rotate(225)'/%3E%3Cpath d='M0 -61 L7 -51 L0 -41 L-7 -51 Z' transform='rotate(270)'/%3E%3Cpath d='M0 -61 L7 -51 L0 -41 L-7 -51 Z' transform='rotate(315)'/%3E%3C/g%3E%3C/svg%3E");
    background-size: 170px 170px;
    background-position: 0 0;
}

/* طبقة زخرفة ناعمة تعطي إحساس المخطوطات */
.auth-body::after {
    opacity: 0.25;
    background:
        radial-gradient(circle at 12% 18%, rgba(255, 255, 255, 0.12) 0 3px, transparent 4px),
        radial-gradient(circle at 88% 76%, rgba(255, 255, 255, 0.1) 0 3px, transparent 4px),
        linear-gradient(90deg, rgba(218, 184, 88, 0.08) 1px, transparent 1px),
        linear-gradient(0deg, rgba(218, 184, 88, 0.08) 1px, transparent 1px);
    background-size: auto, auto, 34px 34px, 34px 34px;
    mix-blend-mode: screen;
}

.auth-body .container {
    position: relative;
    z-index: auto;
}

.auth-card {
    position: relative;
    z-index: 1;
    border: none;
    border-radius: 18px;
    box-shadow: 0 14px 45px rgba(0, 0, 0, 0.28);
    backdrop-filter: blur(2px);
    overflow: hidden;
}

.remember-me-wrap {
    direction: rtl;
}

.remember-me-wrap .form-check-input {
    margin-right: 0;
}
.auth-logo {
    width: 80px;
    height: 80px;
    background: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    color: #fff;
    font-size: 2rem;
}

/* Stat Cards */
.stat-card {
    border-radius: 12px;
    transition: transform 0.2s, box-shadow 0.2s;
    border-width: 2px;
}
.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
}
.stat-card h3 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

/* Cards */
.card {
    border-radius: 10px;
    border: 1px solid rgba(0, 0, 0, 0.08);
}
.card-header {
    border-radius: 10px 10px 0 0 !important;
}

/* Tables */
.table th {
    font-weight: 600;
    font-size: 0.88rem;
    white-space: nowrap;
}
.table td {
    vertical-align: middle;
    font-size: 0.9rem;
}

/* Buttons */
.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}
.btn-primary:hover, .btn-primary:focus {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
}
.btn-outline-primary {
    color: var(--primary-color);
    border-color: var(--primary-color);
}
.btn-outline-primary:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* Reports Card */
.report-card {
    transition: transform 0.2s, box-shadow 0.2s;
    border-radius: 12px;
}
.report-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
}

/* Progress bars */
.progress {
    border-radius: 8px;
    overflow: hidden;
}

/* Hifz Grid */
.hifz-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 6px;
}
.hifz-cell {
    text-align: center;
    padding: 6px 4px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: default;
}
.hifz-cell.completed { background: #d1e7dd; color: #0f5132; }
.hifz-cell.in-progress { background: #fff3cd; color: #664d03; }
.hifz-cell.not-started { background: #f8f9fa; color: #6c757d; }

/* RTL Adjustments */
.me-1 { margin-left: 0.25rem !important; }
.me-2 { margin-left: 0.5rem !important; }

/* Sidebar for reports */
.list-group-item.active {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* Badge tweaks */
.badge { font-weight: 500; }

/* Form */
.form-label {
    font-weight: 500;
    font-size: 0.9rem;
    margin-bottom: 0.35rem;
}

/* Flash messages */
.alert-dismissible {
    border-radius: 8px;
}

/* Responsive */
@media (max-width: 768px) {
    .hifz-grid {
        grid-template-columns: repeat(5, 1fr);
    }
    .stat-card h3 {
        font-size: 1.5rem;
    }
    .navbar-brand {
        font-size: 1rem;
    }
}

@media (max-width: 576px) {
    .hifz-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Print */
@media print {
    .navbar, .btn, form, .no-print { display: none !important; }
    .card { border: 1px solid #ddd; box-shadow: none; }
}
