@import url('https://fonts.googleapis.com/css2?family=Noto+Nastaliq+Urdu:wght@400;700&family=Vazirmatn:wght@300;400;500;700&family=Amiri:ital,wght@0,400;0,700;1,400;1,700&display=swap');

/* Jameel Noori Nastaliq - Local Font (place JameelNooriNastaliq.ttf in /fonts/ folder) */
@font-face {
    font-family: 'Jameel Noori Nastaliq';
    src: url('fonts/JameelNooriNastaliq.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

:root {
    --primary: #123c30;
    --primary-light: #1c5c49;
    --primary-dark: #092019;
    --secondary: #d4af37;
    --secondary-hover: #bda031;
    --bg-main: #f4f7f5;
    --bg-card: #ffffff;
    --text-main: #1d2a25;
    --text-muted: #576d65;
    --border-color: #dbe5e1;
    --accent-red: #e74c3c;
    --accent-green: #2ecc71;
    --shadow-sm: 0 4px 6px rgba(18, 60, 48, 0.05);
    --shadow-md: 0 10px 20px rgba(18, 60, 48, 0.08);
    --shadow-lg: 0 20px 40px rgba(18, 60, 48, 0.12);
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --font-heading: 'Amiri', 'Noto Nastaliq Urdu', serif;
    --font-body: 'Amiri', serif;
    --font-arabic: 'Amiri', serif;
    --font-urdu: 'Jameel Noori Nastaliq', 'Noto Nastaliq Urdu', 'Urdu Typesetting', serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: var(--font-body);
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 2.0;
    font-size: 1.15rem;
}

header {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    color: #ffffff;
    padding: 24px 0;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 3px solid var(--secondary);
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px;
}

.logo a {
    font-family: var(--font-heading);
    font-size: 2rem;
    line-height: 2;
    color: var(--secondary);
    text-decoration: none;
    font-weight: 700;
    transition: all 0.3s ease;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.logo a:hover {
    color: #ffffff;
    text-shadow: 0 0 10px rgba(212, 175, 55, 0.5);
}

nav ul {
    list-style: none;
    display: flex;
    gap: 12px;
    align-items: center;
}

.nav-list {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: nowrap;
}

nav a {
    color: #ffffff;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
}

nav a:hover,
nav a.active {
    background-color: rgba(255, 255, 255, 0.08);
    color: var(--secondary);
}

.btn-ask {
    background: linear-gradient(135deg, var(--secondary), #f5d156);
    color: var(--primary-dark) !important;
    font-weight: 700;
    border: none;
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.35);
}

.btn-ask:hover {
    background: #ffffff;
    color: var(--primary-dark) !important;
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(255, 255, 255, 0.4);
}

.hero {
    background: linear-gradient(135deg, rgba(9, 32, 25, 0.96), rgba(18, 60, 48, 0.9)), url('https://images.unsplash.com/photo-1564507592333-c60657eea523?q=80&w=1200') no-repeat center center/cover;
    color: #ffffff;
    padding: 100px 24px;
    text-align: center;
    position: relative;
    border-bottom: 1px solid var(--border-color);
}

.hero h1 {
    font-family: var(--font-heading);
    font-size: 3.2rem;
    line-height: 2.5;
    margin-bottom: 24px;
    color: var(--secondary);
    text-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
}

.hero p {
    font-size: 1.35rem;
    max-width: 850px;
    margin: 0 auto 35px;
    color: rgba(255, 255, 255, 0.85);
    font-weight: 300;
}

.container {
    max-width: 1200px;
    margin: 50px auto;
    padding: 0 24px;
}

/* Category Filter Tabs */
.categories-filter {
    display: flex;
    justify-content: center;
    gap: 14px;
    margin-bottom: 50px;
    flex-wrap: wrap;
}

.cat-btn {
    background-color: var(--bg-card);
    border: 1.5px solid var(--border-color);
    padding: 12px 24px;
    border-radius: 30px;
    color: var(--text-main);
    cursor: pointer;
    font-size: 1.05rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
    text-decoration: none;
    box-shadow: var(--shadow-sm);
}

.cat-btn:hover,
.cat-btn.active {
    background-color: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

/* Fatwa Cards Grid */
.fatwas-grid {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.fatwa-card {
    background-color: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    padding: 35px;
    border-top: 6px solid var(--secondary);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}

.fatwa-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, rgba(212, 175, 55, 0.02), transparent);
    pointer-events: none;
}

.fatwa-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
}

.fatwa-meta {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    font-size: 0.95rem;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
}

.fatwa-cat {
    background-color: rgba(18, 60, 48, 0.08);
    color: var(--primary);
    padding: 4px 14px;
    border-radius: 30px;
    font-weight: 700;
    font-size: 0.85rem;
}

.fatwa-q {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--primary-dark);
    line-height: 2.8;
    font-family: var(--font-urdu);
}

.fatwa-a {
    color: var(--text-main);
    background-color: #fafbfc;
    padding: 20px;
    border-radius: var(--radius-sm);
    border-right: 5px solid var(--primary-light);
    font-size: 1.1rem;
    font-family: var(--font-urdu);
    line-height: 3.0;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.01);
}

/* Forms Styling */
.form-card {
    background-color: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 50px;
    max-width: 750px;
    margin: 0 auto;
    border: 1px solid var(--border-color);
}

.form-title {
    font-family: var(--font-heading);
    text-align: center;
    font-size: 2.2rem;
    line-height: 2.5;
    color: var(--primary);
    margin-bottom: 35px;
    border-bottom: 2px dashed var(--border-color);
    padding-bottom: 20px;
}

.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--primary-dark);
    font-size: 1.05rem;
}

.form-control {
    width: 100%;
    padding: 14px 18px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    background-color: #fbfdfc;
    font-size: 1.05rem;
    color: var(--text-main);
    transition: all 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    background-color: #ffffff;
    box-shadow: 0 0 0 4px rgba(18, 60, 48, 0.1);
}

select.form-control {
    height: 55px;
}

textarea.form-control {
    resize: vertical;
    min-height: 150px;
}

.btn-submit {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #ffffff;
    font-size: 1.15rem;
    font-weight: 700;
    padding: 14px 30px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    width: 100%;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(18, 60, 48, 0.2);
}

.btn-submit:hover {
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(18, 60, 48, 0.3);
}

.alert-message {
    padding: 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 30px;
    font-weight: 500;
    text-align: center;
    font-size: 1.05rem;
}

.alert-success {
    background-color: rgba(46, 204, 113, 0.12);
    color: #27ae60;
    border: 1.5px solid rgba(46, 204, 113, 0.25);
}

.alert-danger {
    background-color: rgba(231, 76, 60, 0.12);
    color: #c0392b;
    border: 1.5px solid rgba(231, 76, 60, 0.25);
}

/* Dashboard Styles */
.dashboard-body header {
    margin-inline-start: 300px;
    width: calc(100% - 300px);
    transition: margin-inline-start 0.3s ease, width 0.3s ease;
}

.dashboard-body .header-container {
    max-width: none;
    padding: 0 40px;
}

.dashboard-container {
    display: flex;
    min-height: calc(100vh - 90px);
}

.sidebar {
    width: 300px;
    background-color: var(--primary-dark);
    color: #ffffff;
    padding: 40px 24px;
    box-shadow: var(--shadow-md);
    border-left: 2px solid rgba(255, 255, 255, 0.05);
    position: fixed;
    top: 0;
    bottom: 0;
    height: 100vh;
    inset-inline-start: 0;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
    z-index: 110;
}

/* Custom scrollbar for sidebar */
.sidebar::-webkit-scrollbar {
    width: 6px;
}
.sidebar::-webkit-scrollbar-track {
    background: transparent;
}
.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}
.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.user-info {
    text-align: center;
    padding-bottom: 30px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 30px;
}

.user-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--secondary), #f5d156);
    color: var(--primary-dark);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2.2rem;
    margin: 0 auto 18px;
    font-weight: bold;
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.4);
}

.user-name {
    font-size: 1.3rem;
    font-weight: bold;
    color: #ffffff;
    margin-bottom: 5px;
}

.user-role {
    font-size: 0.95rem;
    color: var(--secondary);
    font-weight: 500;
}

.sidebar-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sidebar-menu a {
    color: rgba(255, 255, 255, 0.75);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    transition: all 0.3s ease;
    font-weight: 500;
}

.sidebar-menu a:hover,
.sidebar-menu li.active a {
    background-color: var(--primary);
    color: #ffffff;
    box-shadow: inset 3px 0 0 var(--secondary);
}

.main-content {
    flex: 1;
    padding: 50px;
    background-color: var(--bg-main);
    margin-inline-start: 300px;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 20px;
}

.dashboard-title {
    font-family: var(--font-heading);
    color: var(--primary-dark);
    font-size: 2rem;
    line-height: 2.5;
}

.btn-logout {
    background-color: var(--accent-red);
    color: #ffffff;
    text-decoration: none;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-weight: bold;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.2);
}

.btn-logout:hover {
    background-color: #c0392b;
    transform: translateY(-2px);
}

/* Dashboard List and Action Card styling */
.qa-card {
    background: #ffffff;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    margin-bottom: 35px;
    border-right: 6px solid var(--secondary);
    overflow: hidden;
    transition: all 0.3s ease;
}

.qa-card:hover {
    box-shadow: var(--shadow-lg);
}

.qa-header {
    background-color: #fbfcfa;
    padding: 20px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

.qa-user-info {
    font-size: 1.05rem;
    color: var(--text-muted);
}

.qa-user-info strong {
    color: var(--text-main);
}

.qa-badge {
    padding: 6px 14px;
    border-radius: 30px;
    font-size: 0.9rem;
    font-weight: bold;
}

.badge-pending {
    background-color: rgba(212, 175, 55, 0.12);
    color: #b38f19;
}

.badge-approval {
    background-color: rgba(18, 60, 48, 0.08);
    color: var(--primary);
}

.qa-body {
    padding: 25px;
}

.qa-question {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--primary-dark);
    margin-bottom: 20px;
    line-height: 2.8;
    font-family: var(--font-urdu);
}

.qa-answer-box {
    margin-top: 20px;
    background-color: #f7faf8;
    padding: 20px;
    border-radius: var(--radius-sm);
    border-right: 4px solid var(--primary-light);
    font-size: 1.1rem;
    font-family: var(--font-urdu);
    line-height: 3.0;
}

.qa-actions {
    background-color: #fbfcfa;
    padding: 20px 25px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 20px;
    justify-content: flex-end;
    align-items: center;
    flex-wrap: wrap;
}

.btn-action {
    padding: 10px 24px;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    text-decoration: none;
    text-align: center;
}

.btn-approve {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(18, 60, 48, 0.2);
}

.btn-approve:hover {
    background: var(--primary-light);
    transform: translateY(-2px);
}

.btn-edit {
    background: linear-gradient(135deg, var(--secondary), #f5d156);
    color: var(--primary-dark);
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.25);
}

.btn-edit:hover {
    background: var(--secondary-hover);
    transform: translateY(-2px);
}

.btn-reject {
    background-color: var(--accent-red);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.2);
}

.btn-reject:hover {
    background-color: #c0392b;
    transform: translateY(-2px);
}

/* Action Modal/Form inside list */
.action-form-container {
    background-color: #f5f8f6;
    border-top: 1px solid var(--border-color);
    padding: 25px;
}

.checkbox-container {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    cursor: pointer;
    font-weight: bold;
    color: var(--primary-dark);
    font-size: 1.05rem;
}

.checkbox-container input {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

/* Footer styling */
footer {
    background-color: var(--primary-dark);
    color: rgba(255, 255, 255, 0.65);
    text-align: center;
    padding: 35px 24px;
    margin-top: 80px;
    border-top: 4px solid var(--secondary);
}

footer p {
    font-size: 1rem;
}

/* Responsive */
@media (max-width: 768px) {
    .dashboard-container {
        flex-direction: column;
    }

    .sidebar {
        width: 100% !important;
        padding: 30px 20px !important;
        position: static !important;
        height: auto !important;
        overflow-y: visible !important;
    }

    .main-content {
        padding: 30px 20px;
        margin-inline-start: 0 !important;
    }

    .dashboard-body header {
        margin-inline-start: 0 !important;
        width: 100% !important;
    }

    .hero h1 {
        font-size: 2.2rem;
    }

    .fatwa-view-container {
        flex-direction: column;
    }
}

/* Arabic Typography style */
.arabic {
    font-family: var(--font-arabic);
    font-size: 1.4rem;
    line-height: 1.8;
    color: #1c5c49;
    direction: rtl;
    unicode-bidi: embed;
    display: inline-block;
    padding: 0 4px;
}

.urdu {
    font-family: 'Noto Nastaliq Urdu', serif;
    font-size: 1.3rem;
    line-height: 2.2;
    color: var(--primary-dark);
    direction: rtl;
    unicode-bidi: embed;
    display: inline-block;
    padding: 0 4px;
}

/* Fatwa Layout */
.fatwa-view-container {
    display: flex;
    gap: 30px;
    margin-top: 30px;
}

.fatwa-details-card {
    flex: 2;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    padding: 40px;
    border-top: 6px solid var(--primary);
}

.related-sidebar {
    flex: 1;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    padding: 30px;
    border-top: 6px solid var(--secondary);
    align-self: flex-start;
}

.related-title {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    line-height: 2;
    margin-bottom: 20px;
    color: var(--primary-dark);
    border-bottom: 2px dashed var(--border-color);
    padding-bottom: 10px;
}

.related-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.related-item a {
    color: var(--text-main);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
    display: block;
    line-height: 1.6;
}

.related-item a:hover {
    color: var(--primary-light);
}

.fatwa-ref-no {
    font-weight: bold;
    color: var(--secondary);
    background-color: var(--primary-dark);
    padding: 6px 15px;
    border-radius: 30px;
    font-size: 0.95rem;
}

/* Print CSS */
@media print {

    header,
    footer,
    nav,
    .sidebar,
    .related-sidebar,
    .btn-action,
    .btn-ask,
    .no-print,
    form,
    .categories-filter,
    .hero {
        display: none !important;
    }

    body {
        background-color: #ffffff !important;
        color: #000000 !important;
        font-size: 12pt !important;
        line-height: 1.8 !important;
    }

    .fatwa-view-container {
        display: block !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .fatwa-details-card {
        box-shadow: none !important;
        border: none !important;
        padding: 0 !important;
        margin: 0 !important;
        width: 100% !important;
    }

    .print-certificate-header {
        display: block !important;
        text-align: center !important;
        margin-bottom: 40px !important;
        border-bottom: 3px double #000000 !important;
        padding-bottom: 20px !important;
    }

    .print-certificate-header h1 {
        font-family: 'Noto Nastaliq Urdu', serif !important;
        font-size: 24pt !important;
        color: #000000 !important;
    }

    .fatwa-q,
    .fatwa-a {
        border: 1px solid #ccc !important;
        padding: 15px !important;
        margin-bottom: 20px !important;
        border-radius: 4px !important;
        background: none !important;
    }
}

.print-certificate-header {
    display: none;
}

/* Publications (Nashr-o-Ashayat) Styles */
.publications-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
}

.publication-card {
    background-color: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    padding: 35px;
    border-right: 6px solid var(--secondary);
    transition: all 0.3s ease;
}

.publication-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.publication-title {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    line-height: 2.2;
    color: var(--primary-dark);
    margin-bottom: 15px;
}

.publication-meta {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}

.publication-excerpt {
    font-size: 1.1rem;
    color: var(--text-main);
    margin-bottom: 20px;
}

.btn-read-more {
    display: inline-block;
    color: var(--primary);
    text-decoration: none;
    font-weight: bold;
    border-bottom: 2px solid var(--primary);
    transition: all 0.2s ease;
}

.btn-read-more:hover {
    color: var(--secondary-hover);
    border-color: var(--secondary-hover);
}

.btn-print {
    background: linear-gradient(135deg, var(--secondary), #f5d156);
    color: var(--primary-dark);
    font-weight: bold;
    padding: 10px 24px;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.25);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 1rem;
    transition: all 0.2s ease;
}

.btn-print:hover {
    background: var(--secondary-hover);
    transform: translateY(-2px);
}

/* Language Dropdown Button */
.lang-dropdown {
    position: relative;
    display: inline-block;
    vertical-align: middle;
}

.lang-dropbtn {
    background-color: transparent;
    color: white;
    padding: 6px 12px;
    font-size: 0.95rem;
    font-weight: bold;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 100px;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.lang-dropbtn:hover {
    background-color: rgba(255, 255, 255, 0.08);
    border-color: var(--secondary);
    color: var(--secondary);
}

.lang-dropdown-content {
    display: none;
    position: absolute;
    background-color: var(--primary-dark);
    border: 1px solid var(--border-color);
    min-width: 120px;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    border-radius: var(--radius-sm);
    overflow: hidden;
    left: 0;
}

.lang-dropdown-content a {
    color: white !important;
    padding: 10px 16px;
    text-decoration: none;
    display: block;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.lang-dropdown-content a:last-child {
    border-bottom: none;
}

.lang-dropdown-content a:hover {
    background-color: rgba(255, 255, 255, 0.08);
    color: var(--secondary) !important;
}

.lang-dropdown:hover .lang-dropdown-content {
    display: block;
}

/* Navigation Dropdown styling */
.nav-dropdown {
    position: relative;
    display: inline-block;
}

.nav-dropdown-toggle {
    color: #ffffff;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    white-space: nowrap;
}

.nav-dropdown-toggle:hover,
.nav-dropdown:hover .nav-dropdown-toggle {
    background-color: rgba(255, 255, 255, 0.08);
    color: var(--secondary);
}

.nav-dropdown-content {
    display: none;
    position: absolute;
    background-color: var(--primary-dark);
    border: 1px solid var(--border-color);
    min-width: 220px;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    border-radius: var(--radius-sm);
    overflow: hidden;
    top: 100%;
    right: 0;
}

html[dir="rtl"] .nav-dropdown-content {
    right: auto;
    left: 0;
}

.nav-dropdown-content a {
    color: #ffffff !important;
    padding: 12px 20px;
    text-decoration: none;
    display: block;
    font-size: 1rem;
    transition: background-color 0.2s ease, color 0.2s ease;
    text-align: right;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

html[dir="ltr"] .nav-dropdown-content a {
    text-align: left;
}

.nav-dropdown-content a:last-child {
    border-bottom: none;
}

.nav-dropdown-content a:hover {
    background-color: rgba(255, 255, 255, 0.08);
    color: var(--secondary) !important;
}

.nav-dropdown:hover .nav-dropdown-content {
    display: block;
}


/* Language and direction overrides */
html[dir="rtl"] body {
    direction: rtl;
    text-align: right;
}

html[dir="ltr"] body {
    direction: ltr;
    text-align: left;
}

html[dir="ltr"] {
    --font-heading: 'Vazirmatn', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    --font-body: 'Vazirmatn', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* LTR component overrides */
html[dir="ltr"] .sidebar {
    border-left: none;
    border-right: 2px solid rgba(255, 255, 255, 0.05);
}

html[dir="ltr"] .qa-card {
    border-right: none;
    border-left: 6px solid var(--secondary);
}

html[dir="ltr"] .qa-answer-box {
    border-right: none;
    border-left: 4px solid var(--primary-light);
}

html[dir="ltr"] .fatwa-a {
    border-right: none;
    border-left: 5px solid var(--primary-light);
}

html[dir="ltr"] .publication-card {
    border-right: none;
    border-left: 6px solid var(--secondary);
}

html[dir="ltr"] .btn-read-more {
    border-bottom: 2px solid var(--primary);
}

html[dir="ltr"] .lang-dropdown-content {
    left: auto;
    right: 0;
}

/* Formatting Toolbar Styles */
.formatting-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    background-color: #f5f8f6;
    border: 1.5px solid var(--border-color);
    border-bottom: none;
    padding: 8px 12px;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    align-items: center;
}

.toolbar-btn {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: bold;
    color: var(--primary-dark);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.toolbar-btn:hover {
    background-color: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(18, 60, 48, 0.15);
}

html[dir="ltr"] .lang-dropdown-content {
    left: auto;
    right: 0;
}

.formatting-toolbar+textarea.form-control {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}

/* REDESIGN STYLES */

/* Section Headers */
.section-header {
    text-align: center;
    margin-bottom: 35px;
    position: relative;
}

.section-header h2 {
    font-family: 'Amiri', serif;
    font-size: 1.8rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--primary-dark);
    margin: 0;
    display: inline-block;
    background: var(--bg-main);
    padding: 0 25px;
    position: relative;
    z-index: 2;
    font-weight: 700;
}

.section-header::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    width: 100%;
    height: 2px;
    background: linear-gradient(to right, transparent, var(--border-color) 20%, var(--border-color) 80%, transparent);
    z-index: 1;
}

.section-header .section-subtitle {
    display: block;
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-top: 8px;
    position: relative;
    z-index: 2;
    font-weight: 500;
}

/* Home Layout Grid */
.home-layout {
    display: flex;
    gap: 30px;
    margin-bottom: 40px;
}

.feed-column {
    flex: 2.3;
}

.sidebar-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* Feed Cards */
.new-fatwa-item {
    display: flex;
    align-items: center;
    background-color: var(--bg-card);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 20px 25px;
    margin-bottom: 20px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    color: inherit;
    box-shadow: var(--shadow-sm);
}

.new-fatwa-item:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: var(--secondary);
}

.new-fatwa-item .item-id {
    font-size: 1.2rem;
    font-weight: 700;
    color: #cfd8dc;
    min-width: 45px;
    text-align: left;
    margin-right: 20px;
    flex-shrink: 0;
}

html[dir="rtl"] .new-fatwa-item .item-id {
    margin-right: 0;
    margin-left: 20px;
}

.new-fatwa-item .item-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.new-fatwa-item .item-title {
    font-family: var(--font-heading);
    font-size: 1.45rem;
    line-height: 1.8;
    color: var(--primary-dark);
    font-weight: 700;
}

.new-fatwa-item .item-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}

.new-fatwa-item .meta-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    color: inherit;
    transition: color 0.2s ease;
}

.new-fatwa-item .meta-link:hover {
    color: var(--primary);
}

.new-fatwa-item .meta-link.unicode {
    color: #00bcd4;
}

.new-fatwa-item .meta-link.unicode:hover {
    color: #00acc1;
}

/* Sidebar Elements */
.sidebar-card {
    background-color: var(--bg-card);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    padding: 30px 25px;
}

.category-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.category-item {
    display: flex;
    align-items: center;
    background-color: #fbfcfa;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s ease;
}

.category-item:hover {
    border-color: var(--secondary);
    background-color: #ffffff;
    transform: translateX(-3px);
    box-shadow: var(--shadow-sm);
}

html[dir="rtl"] .category-item:hover {
    transform: translateX(3px);
}

.category-item .cat-count-box {
    background-color: #eceff1;
    color: var(--text-muted);
    font-weight: 700;
    font-size: 0.9rem;
    padding: 6px 12px;
    border-radius: 4px;
    min-width: 50px;
    text-align: center;
    margin-right: 15px;
    flex-shrink: 0;
}

html[dir="rtl"] .category-item .cat-count-box {
    margin-right: 0;
    margin-left: 15px;
}

.category-item .cat-titles {
    flex-grow: 1;
}

.category-item .cat-title-ur {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: bold;
    color: #16a085;
}

.category-item .cat-title-en {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: block;
    margin-top: 2px;
}

.category-item .cat-icon {
    color: var(--text-muted);
    font-size: 1.1rem;
    flex-shrink: 0;
    margin-left: 10px;
}

html[dir="rtl"] .category-item .cat-icon {
    margin-left: 0;
    margin-right: 10px;
}

/* Topic Selector Widget */
.topic-selector-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.selector-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.selector-group label {
    font-weight: bold;
    font-size: 0.95rem;
    color: var(--primary-dark);
}

.selector-select {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    background-color: #fbfdfc;
    font-size: 1rem;
    transition: all 0.2s ease;
}

.selector-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(18, 60, 48, 0.08);
}

.btn-cyan {
    background: linear-gradient(135deg, #00bcd4, #00acc1);
    color: #ffffff;
    font-size: 1.1rem;
    font-weight: 700;
    padding: 14px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    width: 100%;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 188, 212, 0.25);
    text-align: center;
}

.btn-cyan:hover {
    background: linear-gradient(135deg, #00acc1, #0097a7);
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0, 188, 212, 0.35);
}

/* Random Fatwa Callout Section */
.random-fatwa-section {
    background-color: #f5f8f6;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 45px;
    margin-bottom: 50px;
    position: relative;
    overflow: hidden;
}

.random-fatwa-section::before {
    content: 'Random Fatwa';
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 0.8rem;
    color: #cfd8dc;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: bold;
}

html[dir="rtl"] .random-fatwa-section::before {
    right: auto;
    left: 15px;
    content: 'منتخب فتویٰ';
}

.random-fatwa-container {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.random-fatwa-q {
    font-family: var(--font-heading);
    font-size: 1.7rem;
    font-weight: 700;
    color: var(--primary-dark);
    line-height: 1.8;
}

.random-fatwa-cat {
    display: inline-block;
    color: var(--secondary);
    background-color: var(--primary-dark);
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    align-self: center;
}

.random-fatwa-a {
    font-size: 1.2rem;
    line-height: 2.0;
    color: var(--text-main);
}

.random-fatwa-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px dashed var(--border-color);
    padding-top: 15px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* Secondary Grids (Selected & Top Rated) */
.split-grid {
    display: flex;
    gap: 30px;
    margin-bottom: 50px;
}

.split-column {
    flex: 1;
}

.split-column-card {
    background-color: var(--bg-card);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    padding: 30px 25px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.compact-fatwa-item {
    display: flex;
    align-items: center;
    background-color: #fbfcfa;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 16px 20px;
    transition: all 0.2s ease;
    text-decoration: none;
    color: inherit;
}

.compact-fatwa-item:hover {
    border-color: var(--secondary);
    background-color: #ffffff;
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.compact-fatwa-item .item-id {
    font-size: 0.95rem;
    font-weight: 700;
    color: #cfd8dc;
    min-width: 55px;
    text-align: left;
    margin-right: 15px;
    flex-shrink: 0;
}

html[dir="rtl"] .compact-fatwa-item .item-id {
    margin-right: 0;
    margin-left: 15px;
}

.compact-fatwa-item .item-body {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.compact-fatwa-item .item-title {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    line-height: 1.7;
    color: var(--primary-dark);
    font-weight: 700;
}

.compact-fatwa-item .item-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Bottom Quick Action Banner */
.action-banner {
    background-color: #f5f8f6;
    background-image: radial-gradient(var(--border-color) 1.2px, transparent 0), radial-gradient(var(--border-color) 1.2px, transparent 0);
    background-size: 24px 24px;
    background-position: 0 0, 12px 12px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 50px 30px;
    margin-top: 50px;
}

.action-banner-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 25px;
}

.action-banner-card {
    background-color: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(5px);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 30px 20px;
    text-align: center;
    text-decoration: none;
    color: inherit;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.action-banner-card:hover {
    transform: translateY(-5px);
    background-color: #ffffff;
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
}

.action-banner-card .card-lang-title {
    font-size: 0.85rem;
    color: var(--primary);
    font-weight: bold;
    text-transform: uppercase;
}

.action-banner-card .card-ur-title {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-dark);
}

.action-banner-card .card-desc {
    font-size: 0.95rem;
    color: var(--text-muted);
    line-height: 1.6;
}

/* TOP UTILITY BAR (Index Search) */
.top-utility-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #ffffff;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 12px 25px;
    margin-bottom: 40px;
    box-shadow: var(--shadow-sm);
    flex-wrap: wrap;
    gap: 20px;
}

.top-utility-actions {
    display: flex;
    gap: 20px;
    align-items: center;
}

.utility-action-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: bold;
    transition: color 0.2s ease;
}

.utility-action-link:hover {
    color: var(--primary);
}

.utility-action-link .icon {
    font-size: 1.1rem;
    color: var(--primary-light);
}

/* DETAILS PAGE REDESIGN */
.details-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #ffffff;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 12px 20px;
    margin-bottom: 25px;
    box-shadow: var(--shadow-sm);
    flex-wrap: wrap;
    gap: 15px;
}

.toolbar-controls-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.zoom-controls {
    display: inline-flex;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    overflow: hidden;
}

.zoom-btn {
    background-color: #fbfdfc;
    border: none;
    padding: 6px 12px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: bold;
    color: var(--primary-dark);
    transition: background-color 0.2s ease;
}

.zoom-btn:hover {
    background-color: #eceff1;
}

.zoom-btn:first-child {
    border-right: 1px solid var(--border-color);
}

.zoom-btn:last-child {
    border-left: 1px solid var(--border-color);
}

.zoom-btn.display-size {
    cursor: default;
    background-color: #ffffff;
    font-size: 0.9rem;
    padding: 6px 10px;
}

.toolbar-action-btn {
    background-color: #ffffff;
    border: 1px solid var(--border-color);
    padding: 6px 14px;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: bold;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.toolbar-action-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background-color: #f5f8f6;
}

.toolbar-meta-right {
    font-size: 0.95rem;
    color: var(--text-muted);
    font-weight: bold;
}

.breadcrumbs {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 25px;
    display: flex;
    gap: 8px;
    align-items: center;
}

.breadcrumbs a {
    text-decoration: none;
    color: var(--primary-light);
    transition: color 0.2s ease;
}

.breadcrumbs a:hover {
    color: var(--secondary);
}

/* Dynamic Font Sizing classes */
.font-size-sm {
    font-size: 1.1rem !important;
}

.font-size-md {
    font-size: 1.25rem !important;
}

.font-size-lg {
    font-size: 1.45rem !important;
}

.font-size-xl {
    font-size: 1.65rem !important;
}

/* Print Layout Custom Badges */
.print-emblem-container {
    display: none;
    text-align: center;
    margin-bottom: 30px;
    border-bottom: 3px double #333;
    padding-bottom: 20px;
}

.print-emblem-circle {
    width: 100px;
    height: 100px;
    border: 3px solid var(--primary);
    border-radius: 50%;
    margin: 0 auto 15px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2rem;
    color: var(--primary);
}

/* Responsiveness overrides */
@media (max-width: 992px) {
    .home-layout {
        flex-direction: column;
    }

    .split-grid {
        flex-direction: column;
    }
}

/* Media Print updates */
@media print {
    .print-emblem-container {
        display: block !important;
    }

    .print-certificate-header {
        display: none !important;
    }

    body {
        font-size: 12pt !important;
        line-height: 2.0 !important;
    }
}

/* Editor Formatting Toolbar */
.formatting-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    background-color: #f7faf8;
    border: 1.5px solid var(--border-color);
    border-bottom: none;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    padding: 10px 16px;
    align-items: center;
}

.formatting-toolbar+textarea.form-control {
    border-top-left-radius: 0 !important;
    border-top-right-radius: 0 !important;
}

.toolbar-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background-color: #ffffff;
    border: 1.5px solid var(--border-color);
    border-radius: 6px;
    padding: 8px 14px;
    font-size: 0.95rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 600;
}

.toolbar-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background-color: #f5f8f6;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(18, 60, 48, 0.05);
}

.toolbar-btn i {
    color: var(--primary-light);
    font-size: 0.95rem;
}

.toolbar-btn:hover i {
    color: var(--primary);
}

/* Sidebar Icon Alignment */
.sidebar-menu a i {
    width: 20px;
    text-align: center;
    font-size: 1.15rem;
    color: var(--secondary);
    transition: transform 0.3s ease;
}

.sidebar-menu a:hover i,
.sidebar-menu li.active a i {
    color: #ffffff;
    transform: scale(1.1);
}

/* Brand Logo & Calligraphy Tagline Header Styles */
.logo-brand {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.brand-logo {
    height: 52px;
    width: auto;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.15));
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.logo-brand a {
    display: flex;
    align-items: center;
    gap: 15px;
    text-decoration: none;
}

.logo-brand a:hover .brand-logo {
    transform: scale(1.06) rotate(-2deg);
}

.brand-tagline {
    height: 35px;
    width: auto;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.25));
    mix-blend-mode: screen;
}

/* Advanced Formatting Toolbar Groups */
.toolbar-group {
    display: inline-flex;
    background-color: #ffffff;
    border: 1.5px solid var(--border-color);
    border-radius: 6px;
    padding: 3px;
    gap: 3px;
    box-shadow: var(--shadow-sm);
    margin-right: 5px;
}

html[dir="rtl"] .toolbar-group {
    margin-right: 0;
    margin-left: 5px;
}

.toolbar-group .toolbar-btn {
    background-color: transparent !important;
    border: none !important;
    border-radius: 4px !important;
    padding: 6px 12px !important;
    font-size: 0.9rem !important;
    font-weight: 600 !important;
    box-shadow: none !important;
    transform: none !important;
    margin: 0 !important;
    color: var(--text-muted) !important;
    transition: all 0.15s ease !important;
}

.toolbar-group .toolbar-btn:hover {
    background-color: rgba(18, 60, 48, 0.06) !important;
    color: var(--primary) !important;
}

.toolbar-group .toolbar-btn i {
    color: var(--primary-light) !important;
}

.toolbar-group .toolbar-btn:hover i {
    color: var(--primary) !important;
}

.toolbar-group .toolbar-btn.btn-clear {
    color: var(--accent-red) !important;
}

.toolbar-group .toolbar-btn.btn-clear i {
    color: var(--accent-red) !important;
}

.toolbar-group .toolbar-btn.btn-clear:hover {
    background-color: rgba(231, 76, 60, 0.08) !important;
    color: var(--accent-red) !important;
}

.toolbar-group .toolbar-btn.btn-clear:hover i {
    color: var(--accent-red) !important;
}


/* =====================================================================
   PROFESSIONAL RESPONSIVE LAYER  ·  RTL/LTR aware  ·  all devices
   ===================================================================== */

/* Guard against full-bleed sections causing horizontal scroll */
html,
body {
    overflow-x: hidden;
}

img {
    max-width: 100%;
    height: auto;
}

/* Mobile hamburger toggle — hidden on desktop, shown on collapse */
.nav-toggle-checkbox {
    display: none;
}

.nav-toggle-label {
    display: none;
    width: 46px;
    height: 42px;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: rgba(255, 255, 255, 0.05);
    transition: background 0.2s ease;
}

.nav-toggle-label span {
    display: block;
    width: 24px;
    height: 2.5px;
    background: var(--secondary);
    border-radius: 3px;
    transition: transform 0.3s ease, opacity 0.2s ease;
}

.nav-toggle-label:hover {
    background: rgba(255, 255, 255, 0.12);
}

/* ---------- TABLET (≤ 992px) ---------- */
@media (max-width: 992px) {
    body {
        font-size: 1.08rem;
        line-height: 1.9;
    }

    .container {
        margin: 35px auto;
        padding: 0 18px;
    }

    .feed-column .item-title {
        font-size: 1.3rem;
    }

    .random-fatwa-section {
        padding: 35px 25px;
    }

    .fatwa-view-container {
        flex-direction: column;
    }

    .fatwa-details-card {
        padding: 30px;
    }

    .related-sidebar {
        width: 100%;
    }
}

/* ---------- NAV COLLAPSE + PHONE (≤ 880px) ---------- */
@media (max-width: 880px) {
    header {
        padding: 14px 0;
    }

    .header-container {
        flex-wrap: wrap;
        padding: 0 16px;
    }

    .logo-brand {
        order: 1;
    }

    .nav-toggle-label {
        display: flex;
        order: 2;
        margin-inline-start: auto;
    }

    nav {
        order: 3;
        flex-basis: 100%;
        width: 100%;
    }

    /* collapsed menu panel */
    .nav-list {
        display: none;
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
        width: 100%;
        margin-top: 14px;
        padding-top: 12px;
        border-top: 1px solid rgba(255, 255, 255, 0.12);
    }

    .nav-toggle-checkbox:checked~nav .nav-list {
        display: flex;
        max-height: calc(100vh - 90px);
        overflow-y: auto;
    }

    /* hamburger → X animation */
    .nav-toggle-checkbox:checked~.nav-toggle-label span:nth-child(1) {
        transform: translateY(7.5px) rotate(45deg);
    }

    .nav-toggle-checkbox:checked~.nav-toggle-label span:nth-child(2) {
        opacity: 0;
    }

    .nav-toggle-checkbox:checked~.nav-toggle-label span:nth-child(3) {
        transform: translateY(-7.5px) rotate(-45deg);
    }

    .nav-list>li {
        width: 100%;
    }

    nav a,
    .nav-dropdown-toggle {
        display: block;
        width: 100%;
        padding: 12px 14px;
        font-size: 1.02rem;
        text-align: start;
        border-radius: var(--radius-sm);
    }

    .btn-ask {
        text-align: center;
        margin-top: 4px;
    }

    /* dropdowns become tap-to-open accordions (no hover dependence) */
    .nav-dropdown,
    .lang-dropdown {
        width: 100%;
        display: block;
        position: static;
    }

    .nav-dropdown-content,
    .lang-dropdown-content {
        position: static;
        display: none;
        width: 100%;
        min-width: 0;
        box-shadow: none;
        border: none;
        background: rgba(0, 0, 0, 0.18);
        border-radius: var(--radius-sm);
        margin: 4px 0;
    }

    .nav-dropdown:focus-within .nav-dropdown-content,
    .lang-dropdown:focus-within .lang-dropdown-content {
        display: block;
    }

    .nav-dropdown-content a,
    .lang-dropdown-content a {
        text-align: start;
        padding-inline-start: 28px;
    }

    .lang-dropdown {
        margin-top: 4px;
    }

    .lang-dropbtn {
        width: 100%;
        min-width: 0;
        justify-content: flex-start;
    }

    /* Hero (overrides index.php inline styles) */
    .hero-section {
        padding: 48px 16px !important;
        gap: 14px !important;
    }

    .hero-section img[alt="Jamia Tahfeez-ul-Quran"] {
        height: auto !important;
        max-height: 90px;
    }

    .hero-section h1 {
        font-size: 1.7rem !important;
        line-height: 1.6 !important;
    }

    .hero-section p {
        font-size: 1.02rem !important;
        line-height: 1.7 !important;
    }

    /* Top utility bar (overrides inline gap/padding) */
    .top-utility-bar {
        padding: 14px 16px !important;
        border-radius: var(--radius-md) !important;
        margin-top: -28px !important;
    }

    .top-utility-actions {
        gap: 18px !important;
        flex-wrap: wrap;
    }

    .utility-action-link {
        font-size: 0.92rem !important;
    }

    /* Section headers + callouts */
    .section-header h2 {
        font-size: 1.4rem;
        padding: 0 14px;
    }

    .random-fatwa-q {
        font-size: 1.35rem;
    }

    .random-fatwa-a {
        font-size: 1.05rem;
        line-height: 1.8;
    }

    /* Dashboard stacked */
    .dashboard-container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        padding: 24px 18px;
    }

    .sidebar-menu {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 8px;
    }

    .sidebar-menu a {
        padding: 10px 14px;
    }

    .main-content {
        padding: 24px 16px;
    }

    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    /* Forms */
    .form-card {
        padding: 30px 20px;
    }

    .form-title {
        font-size: 1.7rem;
    }

    /* Wide dashboard tables scroll horizontally instead of clipping */
    .main-content table {
        display: block;
        width: 100%;
        overflow-x: auto;
        white-space: nowrap;
    }
}

/* ---------- SMALL PHONE (≤ 600px) ---------- */
@media (max-width: 600px) {
    body {
        font-size: 1rem;
    }

    .brand-logo {
        height: 42px;
    }

    .brand-tagline {
        height: 26px;
    }

    .hero-section h1 {
        font-size: 1.45rem !important;
    }

    .hero-section p {
        font-size: 0.95rem !important;
    }

    .new-fatwa-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        padding: 16px 18px;
    }

    .new-fatwa-item .item-id {
        margin: 0 !important;
    }

    .new-fatwa-item .item-title {
        font-size: 1.2rem;
    }

    .new-fatwa-item .item-meta {
        gap: 12px;
    }

    .compact-fatwa-item .item-title {
        font-size: 1.1rem;
    }

    .random-fatwa-section {
        padding: 28px 18px;
    }

    .random-fatwa-footer {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }

    .action-banner {
        padding: 30px 18px;
    }

    .action-banner-grid {
        grid-template-columns: 1fr;
    }

    .fatwa-details-card {
        padding: 22px 18px;
    }

    .fatwa-details-card h1 {
        font-size: 1.5rem !important;
        line-height: 1.8 !important;
    }

    .fatwa-a {
        padding: 20px !important;
    }

    .dream-form-card {
        padding: 24px 18px !important;
    }

    .guidelines-box {
        flex-direction: column !important;
        gap: 12px !important;
    }

    .form-card {
        padding: 24px 16px;
    }

    .section-header h2 {
        font-size: 1.2rem;
        letter-spacing: 0;
    }

    .section-header .section-subtitle {
        font-size: 0.85rem;
    }

    .details-toolbar {
        gap: 12px;
    }

    footer {
        padding: 28px 18px;
        margin-top: 50px;
    }
}

/* ---------- TINY PHONE (≤ 380px) ---------- */
@media (max-width: 380px) {
    .brand-tagline {
        display: none;
    }

    .hero-section h1 {
        font-size: 1.25rem !important;
    }

    .top-utility-actions {
        gap: 12px !important;
    }

    .utility-action-link span:not(.icon) {
        font-size: 0.85rem;
    }

    .nav-toggle-label {
        width: 42px;
        height: 38px;
    }
}

/* =====================================================================
   FORMS  ·  professional polish + responsive  ·  RTL/LTR aware
   ===================================================================== */

/* Consistent field sizing & comfortable touch targets */
.form-control,
.selector-select {
    min-height: 52px;
    line-height: 1.6;
}

textarea.form-control {
    min-height: 150px;
    line-height: 1.9;
}

.form-control::placeholder {
    color: #9aa8a2;
    opacity: 1;
}

/* Custom select caret (native arrow removed) — base = RTL (caret on left) */
select.form-control,
.selector-select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23576d65' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 16px center;
    padding-left: 42px;
    cursor: pointer;
}

html[dir="ltr"] select.form-control,
html[dir="ltr"] .selector-select {
    background-position: right 16px center;
    padding-left: 18px;
    padding-right: 42px;
}

select.form-control:disabled,
.selector-select:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background-color: #eef2f0;
}

/* Submit buttons: subtle press feedback */
.btn-submit:active,
.btn-cyan:active,
.btn-action:active {
    transform: translateY(0);
}

/* ---------- FORMS · TABLET / PHONE (≤ 880px) ---------- */
@media (max-width: 880px) {

    /* Dashboard review card header stacks */
    .qa-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .qa-user-info {
        word-break: break-word;
        line-height: 1.7;
    }

    .qa-badge {
        align-self: flex-start;
    }

    /* Inline grid forms (create user / category) breathe */
    .form-card form[style*="grid"] {
        gap: 16px !important;
    }
}

/* ---------- FORMS · PHONE (≤ 600px) ---------- */
@media (max-width: 600px) {

    /* Prevent iOS zoom-on-focus: keep inputs ≥ 16px */
    .form-control,
    .selector-select {
        font-size: 16px;
    }

    .qa-body {
        padding: 18px;
    }

    .qa-answer-box {
        padding: 16px;
    }

    .action-form-container {
        padding: 18px;
    }

    /* Action buttons stack full-width and easy to tap */
    .qa-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding: 18px;
    }

    .qa-actions>form {
        width: 100%;
        display: flex !important;
        flex-wrap: wrap;
        gap: 12px;
        align-items: center;
    }

    .qa-actions .btn-action {
        width: 100%;
    }

    /* Make the auto-width submit buttons full-width on phones */
    .qa-body .btn-submit,
    .action-form-container .btn-submit {
        width: 100% !important;
    }

    .checkbox-container {
        flex-wrap: wrap;
        font-size: 1rem;
    }

    /* Editor toolbar tightens but stays usable */
    .formatting-toolbar {
        gap: 6px;
        padding: 8px 10px;
    }

    .toolbar-group {
        margin: 0 !important;
    }

    .toolbar-group .toolbar-btn {
        padding: 6px 9px !important;
        font-size: 0.82rem !important;
    }
}

/* =====================================================================
   PRINT / PDF  ·  professional certificate letterhead (logo + tagline)
   ===================================================================== */
.print-letterhead,
.print-fineprint {
    display: none;
}

@media print {
    @page {
        size: A4;
        margin: 0;
    }

    body {
        background: #ffffff !important;
        color: #1a1a1a !important;
        font-size: 12.5pt;
        line-height: 1.9;
        padding: 16mm 14mm;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    /* Hide all on-screen chrome that isn't part of the document */
    .breadcrumbs,
    .details-toolbar,
    .related-sidebar,
    form {
        display: none !important;
    }

    /* ---- Letterhead ---- */
    .print-letterhead {
        display: block !important;
        text-align: center;
        margin-bottom: 22px;
        padding-bottom: 14px;
        border-bottom: 3px double var(--primary);
    }

    .print-lh-logo {
        height: 95px;
        width: auto;
        margin: 0 auto 8px;
        display: block;
    }

    .print-lh-name {
        font-family: 'Noto Nastaliq Urdu', 'Amiri', serif;
        font-size: 19pt;
        font-weight: 700;
        color: var(--primary-dark);
        margin: 2px 0 0;
        line-height: 1.6;
    }

    .print-lh-tagline {
        height: 24px;
        width: auto;
        max-width: 70%;
        margin: 9px auto 0;
        display: block;
        mix-blend-mode: normal;
        filter: invert(1);
        /* white calligraphy -> dark ink for paper */
    }

    .print-lh-meta {
        display: flex;
        justify-content: space-between;
        font-size: 10.5pt;
        color: #3a3a3a;
        font-weight: 600;
        margin-top: 14px;
    }

    /* ---- Document body ---- */
    .fatwa-view-container {
        display: block !important;
    }

    .fatwa-details-card {
        display: block !important;
        box-shadow: none !important;
        border: none !important;
        padding: 0 !important;
        margin: 0 !important;
        width: 100% !important;
    }

    .fatwa-details-card h1,
    .publication-title {
        color: #111111 !important;
    }

    .fatwa-q,
    .fatwa-a {
        border: 1px solid #cfcfcf !important;
        background: #ffffff !important;
        padding: 16px 18px !important;
        margin-bottom: 18px !important;
        border-radius: 4px !important;
        box-shadow: none !important;
        page-break-inside: auto !important;
        break-inside: auto !important;
    }

    .arabic {
        color: #000000 !important;
    }

    /* ---- Verification fine print (footer) ---- */
    .print-fineprint {
        display: block !important;
        margin-top: 26px;
        padding-top: 10px;
        border-top: 1px solid #bbbbbb;
        text-align: center;
        font-size: 9.5pt;
        color: #555555;
        line-height: 1.8;
    }

    .print-fineprint .verify-url {
        direction: ltr;
        unicode-bidi: embed;
        font-weight: 600;
        color: #000000;
    }
}

/* Dashboard Tabbed Layout Styles */
.tab-content-section {
    display: none;
    animation: fadeInTab 0.35s ease;
}

.tab-content-section.active-tab-content {
    display: block !important;
}

@keyframes fadeInTab {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.sidebar-menu li.menu-item.active-menu-item a {
    background-color: var(--primary);
    color: #ffffff;
    box-shadow: inset 3px 0 0 var(--secondary);
}

.stat-card {
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md) !important;
}

/* Collapse dashboard sidebar & header margin on screen widths where header items might overlap */
@media (max-width: 1200px) {
    .dashboard-body header {
        margin-inline-start: 0 !important;
        width: 100% !important;
    }

    .dashboard-container {
        flex-direction: column;
    }

    .sidebar {
        width: 100% !important;
        padding: 30px 20px !important;
        position: static !important;
        height: auto !important;
        overflow-y: visible !important;
    }

    .sidebar-menu {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 8px;
    }

    .main-content {
        padding: 30px 20px;
        margin-inline-start: 0 !important;
    }
}

/* Sidebar Toggle Button & Header Layout */
.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.sidebar-toggle-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #ffffff;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 1.15rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
    z-index: 105;
}

.sidebar-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: var(--secondary);
    border-color: var(--secondary);
}

/* Sidebar Collapsed Transformations */
body.sidebar-collapsed .sidebar {
    transform: translateX(-100%) !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    transition: transform 0.3s ease, opacity 0.3s ease, visibility 0.3s ease;
}

html[dir="rtl"] body.sidebar-collapsed .sidebar {
    transform: translateX(100%) !important;
}

body.sidebar-collapsed header,
body.sidebar-collapsed .dashboard-body header,
.dashboard-body.sidebar-collapsed header {
    margin-inline-start: 0 !important;
    width: 100% !important;
    transition: margin-inline-start 0.3s ease, width 0.3s ease;
}

body.sidebar-collapsed .main-content,
.dashboard-body.sidebar-collapsed .main-content {
    margin-inline-start: 0 !important;
    transition: margin-inline-start 0.3s ease;
}

/* Compact Navigation for Dashboard Header */
.dashboard-body header nav .nav-list {
    gap: 6px;
}

.dashboard-body header nav a,
.dashboard-body header .nav-dropdown-toggle {
    padding: 6px 10px;
    font-size: 0.88rem;
}