:root {
    /* Brand Colors */
    --primary-green: #047857; /* Emerald 700 */
    --dark-green: #064e3b;   /* Emerald 900 */
    --gold: #f59e0b;         /* Amber 500 */
    --light-gold: #fcd34d;   /* Amber 300 */

    /* Neutral & Text Colors */
    --text-light: #d1fae5;      /* Emerald 100 */
    --text-muted: #a7f3d0;     /* Emerald 200 */
    --text-dark: #064e3b;       /* Emerald 900 */
    --bg-light-contrast: #f0fdfa; /* Emerald 50 */
    --surface-light: #ecfdf5;   /* Emerald 100 with more opacity */
    --border-light: #d1fae5;    /* Emerald 200 */

    /* Tajwid Colors */
    --tajwid-ghunnah: #FF5722; /* Red Orange */
    --tajwid-qalqalah: #2196F3;/* Blue */
    --tajwid-madd: #4CAF50; /* Green */
    --tajwid-ikhfa: #9C27B0; /* Purple */
    --tajwid-idgham: #FF9800; /* Orange */
    --tajwid-iqlab: #00BCD4; /* Cyan */
    --tajwid-hamzah: #F44336; /* Red */
}
body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--dark-green); /* Emerald 900 */
    color: var(--text-light); /* Default text color for the app */
}
.font-amiri {
    font-family: 'Amiri', serif;
}
/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: #065f46;
}
::-webkit-scrollbar-thumb {
    background: var(--gold);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--light-gold);
}
.nav-item.active {
    background-color: var(--gold);
    color: var(--dark-green);
}
/* Compass styling */
/* Style for the Qibla compass (moved from HTML) */
 .compass {
    position: relative;
    width: 200px;
    height: 200px;
    background: url('https://i.imgur.com/J82sV2R.png') no-repeat center center; /* Compass background image */
    background-size: contain;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Adding a subtle shadow to lift it off the background */
    filter: drop-shadow(0 5px 15px rgba(0,0,0,0.3));
 }
 .compass-needle {
    position: absolute;
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-bottom: 80px solid var(--gold); /* Use CSS variable */
    transform-origin: bottom center;
    transition: transform 0.5s ease-out;
    /* Add a drop shadow for depth */
    filter: drop-shadow(0 3px 5px rgba(0,0,0,0.4));
 }
 .compass-center {
    width: 20px;
    height: 20px;
    background-color: #fff;
    border-radius: 50%;
    z-index: 10;
    box-shadow: 0 0 5px rgba(0,0,0,0.5);
 }
/* Map styling */
#map {
    height: 450px;
    border-radius: 0.5rem;
    z-index: 10; /* Ensure map is interactable */
}
/* Leaflet routing machine custom style */
.leaflet-routing-container {
    background-color: rgba(6, 78, 59, 0.8); /* bg-emerald-900 with opacity */
    color: var(--text-light);
    border-radius: 0.5rem;
    backdrop-filter: blur(5px);
}
.leaflet-routing-alt, .leaflet-routing-alt h2 {
    color: var(--light-gold);
}
/* Ayat number styling */
.ayah-number {
    background-color: var(--gold);
    color: var(--dark-green);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    margin-right: 12px;
    flex-shrink: 0;
}
/* Juz tabs styling */
.juz-tab {
    padding: 8px 16px;
    border-radius: 8px;
    background-color: rgba(16, 185, 129, 0.2);
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.3s;
}
.juz-tab:hover {
    background-color: rgba(16, 185, 129, 0.4);
}
.juz-tab.active {
    background-color: var(--gold);
    color: var(--dark-green);
    font-weight: bold;
}
/* Asmaul Husna card styling */
.asmaul-husna-card {
    transition: all 0.3s ease;
}
.asmaul-husna-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.25);
}
/* Audio player styling */
.audio-player {
    background-color: rgba(6, 78, 59, 0.7);
    border-radius: 8px;
    padding: 8px;
    margin-top: 10px;
}
.play-button {
    background-color: var(--gold);
    color: var(--dark-green);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}
.play-button:hover {
    background-color: var(--light-gold);
}
.play-button:active {
    transform: scale(0.95);
}
/* Error message styling */
.error-message {
    background-color: rgba(239, 68, 68, 0.2);
    border-left: 4px solid #ef4444;
    padding: 12px;
    margin: 16px 0;
    border-radius: 4px;
}
.retry-button {
    background-color: var(--gold);
    color: var(--dark-green);
    padding: 8px 16px;
    border-radius: 4px;
    font-weight: bold;
    cursor: pointer;
    margin-top: 8px;
    transition: all 0.2s;
}
.retry-button:hover {
    background-color: var(--light-gold);
}
/* Tajwid styling */
.tajwid-container {
    margin: 10px 0;
    padding: 15px;
    background-color: rgba(6, 78, 59, 0.3);
    border-radius: 8px;
}
.tajwid-toggle {
    background-color: var(--gold);
    color: var(--dark-green);
    padding: 6px 12px;
    border-radius: 4px;
    font-weight: bold;
    cursor: pointer;
    margin-bottom: 10px;
    transition: all 0.2s;
    font-size: 14px;
}
.tajwid-toggle:hover {
    background-color: var(--light-gold);
}
.tajwid-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
    font-size: 12px;
}
.tajwid-legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
}
.tajwid-legend-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}
.tajwid-ghunnah { color: var(--tajwid-ghunnah); }
.tajwid-qalqalah { color: var(--tajwid-qalqalah); }
.tajwid-madd { color: var(--tajwid-madd); }
.tajwid-ikhfa { color: var(--tajwid-ikhfa); }
.tajwid-idgham { color: var(--tajwid-idgham); }
.tajwid-iqlab { color: var(--tajwid-iqlab); }
.tajwid-hamzah { color: var(--tajwid-hamzah); }
/* Mosque list styling */
.mosque-item {
    background-color: rgba(16, 185, 129, 0.2);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s;
}
.mosque-item:hover {
    background-color: rgba(16, 185, 129, 0.4);
}
.mosque-item.active {
    background-color: rgba(245, 158, 11, 0.3);
    border-left: 4px solid var(--gold);
}
.mosque-name {
    font-weight: bold;
    color: var(--light-gold);
    margin-bottom: 4px;
}
.mosque-address {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 4px;
}
.mosque-distance {
    font-size: 12px;
    color: var(--text-muted);
}
.location-permission {
    background-color: rgba(251, 191, 36, 0.2);
    border-left: 4px solid #fbbf24;
    padding: 12px;
    margin: 16px 0;
    border-radius: 4px;
}
.permission-button {
    background-color: var(--gold);
    color: var(--dark-green);
    padding: 8px 16px;
    border-radius: 4px;
    font-weight: bold;
    cursor: pointer;
    margin-top: 8px;
    transition: all 0.2s;
}
.permission-button:hover {
    background-color: var(--light-gold);
}
/* Hijaiyah Canvas Styling */
.hijaiyah-container {
    background-color: var(--bg-light-contrast);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    max-width: 800px;
    margin: 0 auto;
}
.hijaiyah-header {
    text-align: center;
    margin-bottom: 20px;
}
.hijaiyah-title {
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    color: var(--primary-green);
    margin-bottom: 8px;
}
.hijaiyah-subtitle {
    font-family: 'Poppins', sans-serif;
    color: #4b5563; /* Gray 600 */
    font-size: 16px;
}
.hijaiyah-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    background-color: var(--surface-light);
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #d1fae5;
}
.target-letter-container {
    display: flex;
    flex-direction: column;
    align-items: center;
}
.target-label {
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    color: var(--primary-green);
    margin-bottom: 8px;
    font-size: 16px;
}
.target-letter {
    font-family: 'Amiri', serif;
    font-size: clamp(4rem, 10vw, 6rem); /* Responsive font size */
    font-weight: 700;
    color: #0d9488; /* Teal 600 */
    text-shadow: 2px 2px var(--border-light);
    line-height: 1;
}
.control-buttons {
    display: flex;
    gap: 10px;
}
.hijaiyah-button {
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    padding: 10px 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}
.hijaiyah-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 8px rgba(0, 0, 0, 0.15);
}
.next-button {
    background-color: var(--primary-green);
    color: white;
}
.next-button:hover {
    background-color: var(--dark-green);
}
.clear-button {
    background-color: #e11d48; /* Rose 600 */
    color: white;
}
.clear-button:hover {
    background-color: #be123c; /* Rose 700 */
}
.canvas-container {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
    background-color: white;
    border-radius: 8px;
    padding: 10px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.06);
}
#drawingCanvas {
    border: 2px solid #0d9488; /* Teal 600 */
    border-radius: 8px;
    cursor: crosshair;
    touch-action: none;
    width: 100%;
    aspect-ratio: 1 / 1; /* Maintain square aspect ratio */
}
.feedback-container {
    background-color: var(--surface-light);
    border-left: 4px solid #10b981;
    padding: 15px;
    border-radius: 8px;
}
.feedback-title {
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    color: var(--primary-green);
    margin-bottom: 8px;
    font-size: 18px;
}
.feedback-text {
    font-family: 'Poppins', sans-serif;
    color: #374151;
    font-size: 16px;
    line-height: 1.5;
}
.progress-container {
    margin-top: 15px;
    background-color: #e5e7eb;
    border-radius: 9999px;
    height: 8px;
    overflow: hidden;
}
.progress-bar {
    height: 100%;
    background-color: #10b981;
    transition: width 0.3s ease;
}
.score-display {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 14px;
}
.current-score {
    font-weight: 600;
    color: var(--primary-green);
}
.target-score {
    color: #4b5563; /* Gray 600 */
}
.hijaiyah-progress {
    margin-top: 20px;
    background-color: var(--surface-light);
    padding: 15px;
    border-radius: 8px;
    border: 1px solid var(--border-light);
}
.progress-title {
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    color: #047857;
    margin-bottom: 10px;
    font-size: 16px;
}
.letters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
    gap: 8px;
}
.letter-item {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-family: 'Amiri', serif;
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-green);
    background-color: white;
    border: 1px solid var(--border-light);
    transition: all 0.2s;
}
.letter-item.completed {
    background-color: #10b981;
    color: white;
    border-color: #10b981;
}
.letter-item.current {
    background-color: #f59e0b;
    color: white;
    border-color: #f59e0b;
    transform: scale(1.1);
}
/* Responsive adjustments */
@media (max-width: 768px) {
    .hijaiyah-controls {
        flex-direction: column;
        gap: 15px;
    }
    .target-letter {
        font-size: 4rem;
    }
}

/* Styles for Settings Modal */
.settings-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    pointer-events: none;
}
.settings-modal.active {
    opacity: 1;
    pointer-events: auto;
}
.settings-modal-content {
    background: linear-gradient(145deg, #065f46, #0c4a6e); /* from-emerald-800 to-sky-900 */
    padding: 2rem;
    border-radius: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 15px 30px rgba(0,0,0,0.4);
    max-width: 90%;
    width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.95);
    transition: transform 0.3s ease-in-out;
}
.settings-modal.active .settings-modal-content {
    transform: scale(1);
}

/* Improved button style inside modal */
.settings-modal .nav-item {
    background-color: rgba(16, 185, 129, 0.15); /* bg-emerald-700 with opacity */
    border: 1px solid rgba(16, 185, 129, 0.3);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-weight: 600;
    min-height: 90px;
    transition: all 0.2s ease-in-out;
}

.settings-modal .nav-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 15px rgba(0,0,0,0.2);
    background-color: rgba(245, 158, 11, 0.8); /* hover:bg-amber-500 */
    color: #064e3b; /* hover:text-emerald-900 */
}

.settings-modal .nav-item .icon {
    font-size: 1.75rem; /* text-3xl */
    line-height: 1;
}

/* --- Calculator UI Styles --- */
.calculator-body {
    background: linear-gradient(145deg, var(--dark-green), #053a2c);
    border: 1px solid rgba(16, 185, 129, 0.3);
    box-shadow: 0 10px 30px rgba(0,0,0,0.4);
}

#calc-display {
    background-color: #0c382b;
    box-shadow: inset 0 4px 8px rgba(0,0,0,0.4);
    color: #fef3c7; /* Amber 100 */
    text-shadow: 0 0 5px var(--gold);
    font-size: clamp(2rem, 8vw, 3rem); /* Responsive font size */
    padding: 2rem 1.5rem;
}

.calc-btn {
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    font-size: 1.25rem;
    color: #e0f2f1;
    background-color: rgba(16, 185, 129, 0.2);
    border: 1px solid rgba(16, 185, 129, 0.4);
    border-radius: 0.75rem;
    padding: 1rem 0;
    cursor: pointer;
    transition: all 0.1s ease-out;
    box-shadow: 0 4px 6px rgba(0,0,0,0.2), inset 0 1px 1px rgba(255,255,255,0.1);
}

.calc-btn:hover {
    background-color: rgba(16, 185, 129, 0.4);
    transform: translateY(-2px);
}

.calc-btn:active {
    transform: translateY(1px);
    box-shadow: 0 1px 2px rgba(0,0,0,0.3), inset 0 2px 4px rgba(0,0,0,0.3);
}

.calc-btn-operator {
    background-color: rgba(5, 150, 105, 0.4); /* Emerald 600 */
    color: var(--light-gold);
}

.calc-btn-action {
    background-color: rgba(153, 27, 27, 0.5); /* Red 800 */
    color: #fecaca; /* Red 200 */
}

.calc-btn-equal {
    background-color: var(--gold);
    color: var(--dark-green);
    font-size: 1.75rem;
    grid-row: span 2; /* Make equals button taller */
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
