body {
    background-image: url("../img/bg.jpg");
    background-repeat: repeat;
    background-size: auto; /* This is default for repeat */
    min-height: 100vh;
    position: relative;
}
body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    z-index: -1;
}
.content-wrapper {
    position: relative;
    z-index: 1;
}
.debug-section {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #1a1a1a;
    color: #f8f9fa;
    padding: 10px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 9999;
    font-family: monospace;
    font-size: 12px;
    border-top: 2px solid #dc3545;
    display: none;
}
.debug-toggle {
    position: fixed;
    bottom: 10px;
    right: 10px;
    z-index: 10000;
    padding: 5px 10px;
    font-size: 12px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
}
.debug-section pre {
    margin: 0;
    color: #28a745;
    white-space: pre-wrap;
}
.debug-section .error {
    color: #ff6b6b;
}


@font-face {
    font-family: 'Kitab';
    src: url("//cdn.alquran.cloud/public/fonts/Kitab-Regular.ttf");
}

.font-kitab {
    font-family: 'Kitab';
}

@font-face {
    font-family: 'Kitab Bold';
    src: url("//cdn.alquran.cloud/public/fonts/Kitab-Bold.ttf");
}

.font-kitab-bold {
    font-family: 'Kitab Bold';
}

/* Brand Colors */
:root {
    /* Primary color - Green for a fresh, natural feel */
    --brand-primary: #1e7e34;
    --brand-primary-light: #1e7e34;
    --brand-primary-dark: #1e7e34;
    
    /* Secondary color - Warm beige for a soft, approachable feel */
    --brand-secondary: #f4f1de;
    
    /* Accent colors */
    --brand-success: #3a9e6f;
    --brand-info: #3d7ea6;
    --brand-warning: #e6af2e;
    --brand-danger: #e63946;
    
    /* Neutral colors */
    --brand-light: #f8f9fa;
    --brand-gray: #6c757d;
    --brand-dark: #343a40;
    
    /* Typography */
    --font-family-base: 'Segoe UI', Roboto, -apple-system, BlinkMacSystemFont, Arial, sans-serif;
    
    /* Border radius */
    --border-radius: 8px;
    --border-radius-sm: 4px;
    
    /* Shadows */
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
    --shadow: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
}


/* Global Styles */
body {
    background-color: #f8f9fa;
    font-family: var(--font-family-base);
    font-weight: 400;
    line-height: 1.6;
    color: var(--brand-dark);
    background-color: var(--brand-secondary);
    color: var(--brand-dark);
}

/* Headings */
h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
    font-family: var(--font-family-base);
    font-weight: 500;
    line-height: 1.2;
}

/* Navbar */
.navbar {
    background-color: var(--brand-primary) !important;
    box-shadow: var(--shadow);
    padding: 0.8rem 1rem;
    transition: all 0.3s ease;
}

.navbar-brand {
    font-weight: 600;
    letter-spacing: 0.5px;
}

.navbar-brand,
.navbar-nav .nav-link {
    color: white !important;
    padding: 0.5rem 1rem;
    transition: all 0.2s ease;
}

.navbar-nav .nav-link:hover {
    background-color: var(--brand-primary-dark);
    border-radius: var(--border-radius-sm);
}

.navbar-toggler {
    border-color: rgba(255,255,255,.5);
}

.navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 0.9%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e") !important;
}


/* Navbar specific overrides */
.navbar .btn-outline-primary {
    color: rgba(255, 255, 255, 0.85);
    border-color: rgba(255, 255, 255, 0.5);
}

.navbar .btn-outline-primary:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.75);
    color: white;
}

/* Form controls focus state */
.form-control:focus,
.form-select:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 0.25rem rgba(123, 29, 20, 0.25);
}

/* Dropdown menu */
.dropdown-menu {
    border: none;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.dropdown-item:focus,
.dropdown-item:hover {
    background-color: var(--brand-primary);
    color: white;
}

.dropdown-item.active,
.dropdown-item:active {
    background-color: var(--brand-primary-dark);
    color: white;
}

/* Cards */
.card {
    border: none;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    margin-bottom: 1.5rem;
}

.card-hover:hover {
    background-color: rgba(123, 29, 20, 0.05);
    border-color: rgba(123, 29, 20, 0.2);
}

.card-header {
    background-color: var(--brand-primary);
    color: white;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    font-weight: 500;
    padding: 0.75rem 1.25rem;
}

.card-header.bg-primary {
    background-color: var(--brand-primary) !important;
    border-color: var(--brand-primary) !important;
}

.card-header .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
    opacity: 0.8;
}

.card-header .btn-close:hover {
    opacity: 1;
}

/* Text */

.text-primary {
    color: var(--brand-primary) !important;    
}

/* Background */

.bg-primary {
    --bs-bg-opacity: 1;
    background-color: #198754 !important; /* Bootstrap success green */
}

.bg-glass {
    background: rgba(255, 255, 255, 0.15) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.bg-glass * {
    opacity: 1 !important;
}

.bg-vector {
    background-image: url('/static/img/bg-profile.png') !important;
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
    position: relative;
}

.bg-vector::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.85);
    z-index: 1;
}

.bg-vector * {
    position: relative;
    z-index: 2;
}


.card-glass {
    background: rgba(255, 255, 255, 0.1) !important; 
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 0.75rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

/* nav-link */

.nav-link {
    color: var(--brand-primary);
}


/* Forms */
.form-control:focus {
    border-color: var(--brand-primary-light);
    box-shadow: 0 0 0 0.2rem rgba(123, 29, 20, 0.25);
}

/* Links */
/* Clean up Bootstrap focus states */
.btn:focus, .form-control:focus, .form-select:focus, .form-check-input:focus {
    border-color: var(--brand-primary) !important;
    box-shadow: 0 0 0 0.25rem rgba(var(--brand-primary-rgb), 0.25) !important;
}

/* Select2 Focus Styles */
.select2-container--bootstrap-5 .select2-selection {
    min-height: 38px;
    border: 1px solid #ced4da;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.select2-container--bootstrap-5.select2-container--focus .select2-selection,
.select2-container--bootstrap-5.select2-container--open .select2-selection {
    border-color: var(--brand-primary) !important;
    box-shadow: 0 0 0 0.25rem rgba(var(--brand-primary-rgb), 0.25) !important;
}

/* Dropdown styles */
.select2-container--bootstrap-5 .select2-selection--single {
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    line-height: 1.5;
    background-color: #fff;
    background-clip: padding-box;
    border: 1px solid #ced4da;
    border-radius: 0.25rem;
}

.select2-dropdown {
    border: 1px solid var(--brand-primary) !important;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

/* Selected item in dropdown */
.select2-results__option--highlighted {
    background-color: var(--brand-primary) !important;
    color: white !important;
}

/* Focus state for the search input inside select2 */
.select2-search__field:focus {
    border-color: var(--brand-primary) !important;
    box-shadow: 0 0 0 0.25rem rgba(var(--brand-primary-rgb), 0.25) !important;
}

/* Focus state for select2 when it has the is-invalid class */
.was-validated .select2-container--bootstrap-5:invalid + .select2-container--bootstrap-5 .select2-selection,
.select2-container--bootstrap-5.is-invalid .select2-selection {
    border-color: #dc3545 !important;
}

/* Focus state for select2 when it has the is-valid class */
.was-validated .select2-container--bootstrap-5:valid + .select2-container--bootstrap-5 .select2-selection,
.select2-container--bootstrap-5.is-valid .select2-selection {
    border-color: #198754 !important;
}

/* Make sure the select2 container takes full width */
.select2-container {
    width: 100% !important;
}

a {
    color: var(--brand-primary);
}

a:hover {
    color: var(--brand-primary-dark);
    text-decoration: none;
}

/* Alerts */
.alert-primary {
    background-color: rgba(123, 29, 20, 0.1);
    border-color: rgba(123, 29, 20, 0.2);
    color: var(--brand-primary-dark);
}

/* Custom utility classes */
.bg-brand {
    background-color: var(--brand-primary) !important;
}

.text-brand {
    color: var(--brand-primary) !important;
}

/* Table */
.table thead th {
    background-color: var(--brand-primary);
    color: white;
    border-color: var(--brand-primary-dark);
}

.table td, .table th {
    transition: none !important;
}

.table-hover tbody tr:hover {
    background-color: rgba(123, 29, 20, 0.05);
}

/* Pagination */
.page-item.active .page-link {
    background-color: var(--brand-primary);
    border-color: var(--brand-primary);
}

.page-link {
    color: var(--brand-primary);
}

.page-link:hover {
    color: var(--brand-primary-dark);
}

/* Buttons */

.btn-primary {
    background-color: var(--brand-primary);
    border-color: var(--brand-primary);
}

.btn-primary:hover {
    background-color: var(--brand-primary-dark);
    border-color: var(--brand-primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.btn-outline-primary {
    background-color: transparent;
    border-color: var(--brand-primary);
    color: var(--brand-primary);
}

.btn-outline-primary:hover {
    background-color: var(--brand-primary-dark);
    border-color: var(--brand-primary-dark);
    color: white;
    box-shadow: var(--shadow);
}

.btn-warning {
    background-color: var(--brand-warning);
    border-color: var(--brand-warning);
    color: var(--brand-dark);
}

.btn-warning:hover {
    background-color: #d4a027;
    border-color: #d4a027;
    color: var(--brand-dark);    
    box-shadow: var(--shadow);
}

.btn-check:checked+.btn, .btn.active, .btn.show, .btn:first-child:active, :not(.btn-check)+.btn:active {
    color: var(--bs-btn-active-color);
    background-color: var(--bs-btn-active-bg);
    border-color: var(--bs-btn-active-border-color);
}

/* Button active state */
.btn-check:checked+.btn-outline-primary, .btn-outline-primary.active, .btn-outline-primary.show {
    color: white;
    background-color: var(--brand-primary-dark);
    border-color: var(--brand-primary-dark);
}

/* Button active state for all variants */
.btn-check:checked+.btn, .btn.active, .btn.show, .btn:first-child:active, :not(.btn-check)+.btn:active,
.btn-check:checked+.btn-outline-primary, .btn-outline-primary.active, .btn-outline-primary.show {
    color: white;
    background-color: var(--brand-primary-dark);
    border-color: var(--brand-primary-dark);
}


/* Info Cards for Profile Section */
.info-card {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 1rem;
    transition: all 0.3s ease;
    height: 100%;
}

.info-card:hover {
    background: #fff;
    border-color: var(--brand-primary);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

/* Avatar Styles */
.avatar-container {
    position: relative;
    display: inline-block;
}

.avatar-img {
    transition: all 0.3s ease;
}

.avatar-img:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(0,0,0,0.2);
}

/* Profile Section Enhancements */
.profile-header {
    background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-primary-dark) 100%);
    color: white;
    padding: 2rem 0;
    margin: -1rem -1rem 1rem -1rem;
    border-radius: 0.5rem 0.5rem 0 0;
}

/* Badge Enhancements */
.badge.rounded-pill {
    font-weight: 500;
    font-size: 0.875rem;
}

/* Table Responsive Enhancement */
.table-responsive {
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.table-hover tbody tr:hover {
    background-color: rgba(123, 29, 20, 0.05);
}

/* Alert Styling */
.alert-light {
    border: 1px solid #e9ecef;
    background: #f8f9fa;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: var(--brand-primary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--brand-primary-dark);
}

/* Form Check Input Styling */
.form-check-input:checked {
    background-color: var(--brand-primary);
    border-color: var(--brand-primary);
}

.form-check-input:focus {
    border-color: #d1a6a2;
    box-shadow: 0 0 0 0.25rem rgba(123, 29, 20, 0.25);
}

.form-check-input:checked:focus {
    background-color: var(--brand-primary);
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 0.25rem rgba(123, 29, 20, 0.25);
}

/* Switch Styling */
.form-switch .form-check-input:checked {
    background-color: var(--brand-primary);
    border-color: var(--brand-primary);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23fff'/%3e%3c/svg%3e");
}

.form-switch .form-check-input:focus {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23d1a6a2'/%3e%3c/svg%3e");
    border-color: #d1a6a2;
}

/* Hover state for better interactivity */
.form-check-input:hover:not(:disabled):not(:checked) {
    border-color: #c0a5a0;
}

/* Disabled state */
.form-check-input:disabled {
    background-color: #e9ecef;
    border-color: #dee2e6;
}

/* For dark mode compatibility */
[data-bs-theme="dark"] .form-check-input:not(:checked) {
    border-color: #6c757d;
    background-color: #2b3035;
}

[data-bs-theme="dark"] .form-check-input:checked {
    background-color: var(--brand-primary);
    border-color: var(--brand-primary);
}

[data-bs-theme="dark"] .form-check-input:focus {
    border-color: #d1a6a2;
    box-shadow: 0 0 0 0.25rem rgba(123, 29, 20, 0.25);
}

/* Amiri Font */
@font-face {
    font-family: 'Amiri';
    src: url('../fonts/amiri/Amiri-Regular.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Amiri';
    src: url('../fonts/amiri/Amiri-Bold.ttf') format('truetype');
    font-weight: bold;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Amiri';
    src: url('../fonts/amiri/Amiri-Italic.ttf') format('truetype');
    font-weight: normal;
    font-style: italic;
    font-display: swap;
}

/* Base Arabic text styling */
.arabic-text {
    font-family: 'Kitab';
    font-size: 1.5rem;
    line-height: 2.5rem;
    direction: rtl;
    text-align: right;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* Optimize Arabic text rendering */
    text-rendering: optimizeLegibility;
    /* Specific Ziyadah character support */
    text-justify: inter-character;
    text-align-last: right;
    /* Ensure proper spacing for Ziyadah */
    letter-spacing: 0.02em;
}

.quran-text {
    font-family: 'Kitab', serif;
    font-size: 2.2rem !important;
    font-weight: 500 !important;
    line-height: 5rem !important;
    text-align: right;
    direction: rtl;
    color: #2c3e50 !important;
    letter-spacing: 0.5px;
    padding: 2rem;
    margin: 0.5rem 0;
    position: relative;
    border-radius: 0.75rem;
    background: #ffffff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    border-left: 4px solid var(--brand-primary);
    
    /* Text rendering optimizations */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    text-justify: inter-word;
    text-align-last: right;
    font-feature-settings: 'calt' 1, 'liga' 1, 'kern' 1, 'rlig' 1, 'ccmp' 1, 'mark' 1, 'mkmk' 1;
    -webkit-font-kerning: normal;
    font-kerning: normal;
    font-variant-ligatures: common-ligatures contextual;
    
    /* Vendor prefixes */
    -moz-font-feature-settings: 'liga' 1, 'calt' 1, 'kern' 1;
    -ms-font-feature-settings: 'liga' 1, 'calt' 1, 'kern' 1;
    -webkit-font-feature-settings: 'liga' 1, 'calt' 1, 'kern' 1;
}

/* For the translation text below Arabic */
.quran-translation {
    font-family: var(--font-family-base);
    font-size: 1rem !important;
    color: #555;
    margin: 0.5rem 0 0 0;
    padding: 1rem 1.5rem;
    background-color: #f8f9fa;
    border-radius: 0 0 0.5rem 0.5rem;
    border-top: 1px solid #eee;
}

.quran-text:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
}

/* Style for the quote icon */
.quran-text .fa-quote-right {
    position: absolute;
    top: 1rem;
    right: 1rem;
    color: #e9ecef;
    font-size: 2.5rem !important;
    opacity: 0.7;
}

/* Enhanced Input Styling */
.nilai-input {
    font-size: 1.25rem !important;
    font-weight: 600 !important;
    text-align: center;
    border: 2px solid #e9ecef;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
    background-color: #fff;
}

.nilai-input:focus {
    border-color: #7B1D14;
    box-shadow: 0 0 0 0.25rem rgba(123, 29, 20, 0.15);
}

/* Enhanced Textarea Styling */
textarea[name^="catatan_"] {
    min-height: 100px !important;
    border: 2px solid #e9ecef !important;
    border-radius: 0.5rem !important;
    padding: 1rem !important;
    font-size: 1rem !important;
    line-height: 1.6 !important;
    transition: all 0.3s ease !important;
    background-color: #fff !important;
}

textarea[name^="catatan_"]:focus {
    border-color: var(--brand-primary) !important;
    box-shadow: 0 0 0 0.25rem rgba(123, 29, 20, 0.15) !important;
}


/* Card-like containers */
.ayat-container {
    background: #fff;
    border-radius: 0.75rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    overflow: hidden;
}

.ayat-container:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Section Headers */
.section-header {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6c757d;
    margin-bottom: 0.75rem;
    display: block;
}


footer.bg-primary {
    background-color: var(--brand-primary) !important;
    box-shadow: 0 2px 4px rgba(0,0,0,.1);
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .quran-text {
        font-size: 1.8rem !important;
        line-height: 3rem !important;
        padding: 1.25rem 1.5rem;
    }
    
    .nilai-input {
        font-size: 1.1rem !important;
        padding: 0.5rem 0.75rem;
    }
}
