:root {
    --primary-color: #064e3b; /* Deep Emerald */
    --accent-color: #d97706;  /* Gold/Amber */
    --bg-dark: #022c22;
    --text-light: #f0fdf4;
    --card-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --font-ui: 'Outfit', sans-serif;
    --font-arabic: 'Amiri', serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    background: radial-gradient(circle at top, #065f46, var(--bg-dark));
    color: var(--text-light);
    font-family: var(--font-ui);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
}

/* Pagination & Highlighting */
.murojaah-page-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    min-height: 60vh;
    justify-content: center;
    position: relative;
    padding: 2rem 0;
}

.ayah-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 2rem;
    gap: 1rem;
}

.nav-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--accent-color);
    color: white;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    cursor: pointer;
    transition: 0.3s;
}

.nav-btn:hover:not(:disabled) {
    background: var(--accent-color);
    transform: translateY(-5px);
}

.nav-btn:disabled {
    opacity: 0.3;
    cursor: default;
}

.progress-container {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    margin-bottom: 2rem;
    overflow: hidden;
}

#progressBar {
    height: 100%;
    background: linear-gradient(to right, var(--primary-color), var(--accent-color));
    width: 0%;
    transition: width 0.3s ease;
}

.wrong-makhraj {
    color: #ef4444 !important;
    text-shadow: 0 0 10px rgba(239, 68, 68, 0.5);
    font-weight: bold;
    border-bottom: 2px solid #ef4444;
}

    --reveal-color: #d97706;
    background: linear-gradient(
        to left,
        var(--reveal-color) var(--reveal-percent),
        rgba(255, 255, 255, 0.05) var(--reveal-percent)
    ) !important;
    -webkit-background-clip: text !important;
    background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    transition: all 0.2s ease;
    display: block;
    width: 100%;
    text-align: right;
    filter: none !important;
    opacity: 1 !important;
}

.ayah-arabic.gradient-reveal.has-error {
    --reveal-color: #ef4444 !important; /* Switch to Red */
    text-shadow: 0 0 15px rgba(239, 68, 68, 0.4);
}

.ayah-arabic.gradient-reveal * {
    color: inherit !important;
    -webkit-text-fill-color: inherit !important;
}

.ayah-arabic.gradient-reveal.revealed {
    background: none !important;
    -webkit-text-fill-color: var(--accent-color) !important;
    transition: 0.5s all ease;
}

/* Modal System */
.ayah-arabic span {
    display: inline-block;
    transition: all 0.4s ease;
    padding: 0 4px;
}

.word-hidden {
    opacity: 0.1;
    filter: blur(5px);
    transform: translateY(10px);
}

.word-revealed {
    opacity: 1;
    filter: blur(0);
    transform: translateY(0);
    color: var(--accent-color);
}

#liveNotify {
    position: fixed;
    top: 100px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3000;
    padding: 0.8rem 1.5rem;
    border-radius: 50px;
    font-weight: bold;
    font-size: 1.1rem;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    opacity: 0;
}

#liveNotify.show {
    opacity: 1;
    top: 120px;
}

.notify-success {
    background: #059669;
    color: white;
    box-shadow: 0 0 20px rgba(5, 150, 105, 0.4);
}

.notify-error {
    background: #dc2626;
    color: white;
    box-shadow: 0 0 20px rgba(220, 38, 38, 0.4);
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.shake {
    animation: shake 0.3s ease-in-out;
}

/* Modal System */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay:not(.hidden) {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    border: 1px solid var(--accent-color);
    border-radius: 25px;
    width: 90%;
    max-width: 500px;
    padding: 2rem;
    color: white;
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.modal-overlay:not(.hidden) .modal-content {
    transform: scale(1);
}

#modalBody {
    line-height: 1.6;
}

.btn-primary {
    background: var(--accent-color);
    border: none;
    color: white;
    padding: 0.8rem 1.5rem;
    border-radius: 50px;
    cursor: pointer;
    font-weight: 600;
    transition: 0.3s;
}

.btn-primary:active {
    transform: scale(0.95);
}

/* Utils */
.hidden { display: none !important; }

/* Header */
header {
    padding: 2rem 0;
    text-align: center;
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--glass-border);
    position: sticky;
    top: 0;
    z-index: 100;
}

header p {
    font-size: 0.9rem;
    opacity: 0.8;
}

.logo-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.app-logo-svg {
    width: 100px;
    height: 100px;
    color: #d97706 !important;
    filter: drop-shadow(0 0 15px rgba(217, 119, 6, 0.4));
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.app-logo-svg:hover {
    transform: scale(1.1) rotate(5deg);
    filter: drop-shadow(0 0 25px rgba(217, 119, 6, 0.6));
}

header h1 {
    font-size: 2.2rem;
    font-weight: 700;
    letter-spacing: 2px;
    background: linear-gradient(135deg, #fff, var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 0;
}

.search-bar {
    margin-top: 1.5rem;
    position: relative;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.search-mode-tabs {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 5px;
}

.search-mode-tabs button {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: white;
    padding: 5px 15px;
    border-radius: 50px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: 0.3s;
}

.search-mode-tabs button.active {
    background: var(--accent-color);
    border-color: var(--accent-color);
    font-weight: 600;
}

.search-input-wrapper {
    position: relative;
    width: 100%;
}

.search-bar input {
    width: 100%;
    padding: 0.8rem 1.5rem;
    padding-right: 6rem;
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 50px;
    color: white;
    font-family: var(--font-ui);
    outline: none;
    transition: all 0.3s ease;
}

.search-bar input:focus {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent-color);
    box-shadow: 0 0 15px rgba(217, 119, 6, 0.3);
}

.btn-search-mic {
    position: absolute;
    right: 3.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    opacity: 0.6;
    transition: 0.3s;
    z-index: 10;
}

.btn-search-mic:hover {
    opacity: 1;
    transform: translateY(-50%) scale(1.1);
}

.btn-search-mic.listening {
    color: #ef4444;
    opacity: 1;
    animation: searchPulse 1s infinite alternate;
}

@keyframes searchPulse {
    from { transform: translateY(-50%) scale(1); opacity: 0.7; }
    to { transform: translateY(-50%) scale(1.3); opacity: 1; }
}

.search-icon {
    position: absolute;
    right: 1.2rem;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.5;
}

/* Loading */
#loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 5rem 0;
}

.loader {
    width: 48px;
    height: 48px;
    border: 5px solid #FFF;
    border-bottom-color: var(--accent-color);
    border-radius: 50%;
    display: inline-block;
    box-sizing: border-box;
    animation: rotation 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes rotation {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Surah Grid */
.surah-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    padding: 2rem 0;
}

.surah-card {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(5px);
    border-radius: 20px;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.surah-card:hover {
    transform: translateY(-10px);
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent-color);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.surah-number {
    width: 50px;
    height: 50px;
    background: rgba(217, 119, 6, 0.2);
    border: 1px solid var(--accent-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--accent-color);
}

.surah-info h3 {
    font-size: 1.2rem;
    margin-bottom: 0.2rem;
}

.surah-info p {
    font-size: 0.8rem;
    opacity: 0.6;
}

.surah-arabic {
    margin-left: auto;
    font-family: var(--font-arabic);
    font-size: 1.5rem;
    color: var(--accent-color);
}

/* Murojaah View */
.murojaah-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 2rem 0;
}

.btn-icon {
    background: none;
    border: 1px solid var(--glass-border);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 10px;
    cursor: pointer;
    transition: 0.3s;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.1);
}

.surah-info-card {
    flex-grow: 1;
}

.surah-info-card h2 {
    font-size: 1.8rem;
    color: var(--accent-color);
}

.murojaah-controls {
    display: flex;
    gap: 2rem;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 15px;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font-size: 0.9rem;
}

/* Switch Styles */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #4b5563;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
}

input:checked + .slider {
    background-color: var(--accent-color);
}

input:checked + .slider:before {
    transform: translateX(26px);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

/* Ayah Container */
.ayah-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding-bottom: 5rem;
}

.ayah-card {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 2rem;
    position: relative;
}

.ayah-number-badge {
    position: absolute;
    top: 1rem;
    left: 1rem;
    font-size: 0.8rem;
    opacity: 0.5;
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 8px;
    border-radius: 50px;
}

.ayah-arabic {
    font-family: 'Scheherazade New', serif;
    font-size: 2.2rem;
    text-align: right;
    margin-bottom: 1.5rem;
    line-height: 2.5;
    transition: all 0.5s ease;
    user-select: none;
}

/* Masked Mode */
.ayah-card.masked .ayah-arabic {
    filter: blur(20px) !important;
    opacity: 0.05 !important;
    transform: scale(0.98);
}

.ayah-card.revealed .ayah-arabic {
    filter: blur(0);
    opacity: 1;
    transform: scale(1);
}

.ayah-latin {
    font-size: 0.95rem;
    color: var(--accent-color);
    margin-bottom: 0.8rem;
    font-style: italic;
    opacity: 0.9;
}

.ayah-translation {
    font-size: 0.9rem;
    opacity: 0.7;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 0.8rem;
}

.ayah-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 1rem;
}

.btn-play, .btn-mic {
    background: var(--accent-color);
    border: none;
    color: white;
    padding: 0.4rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: 0.3s;
}

.btn-mic {
    background: #3b82f6; /* Blue for Voice */
}

.btn-mic.listening {
    background: #ef4444;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* Feedback Status */
.ayah-card.correct {
    border-color: #10b981;
    background: rgba(16, 185, 129, 0.05);
}

.ayah-card.wrong {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.05);
}

.voice-feedback {
    margin-top: 1rem;
    padding: 0.8rem;
    border-radius: 10px;
    font-size: 0.85rem;
}

.voice-feedback.success {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.voice-feedback.error {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.transcript-label {
    font-weight: 600;
    margin-right: 5px;
}

/* Audio Player */
.audio-panel {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(20px);
    border: 1px solid var(--accent-color);
    padding: 1rem 2rem;
    border-radius: 100px;
    display: flex;
    align-items: center;
    gap: 2rem;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    transition: 0.5s;
}

.player-info {
    display: flex;
    flex-direction: column;
}

#playerTitle {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--accent-color);
}

#playerSub {
    font-size: 0.7rem;
    opacity: 0.6;
}

audio {
    height: 30px;
}

#closePlayer {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
}

/* Tajweed Colors (Quran.com standards) */
.tajweed-text .ham_wasl { color: #aaaaaa; font-size: 0.9em; }
.tajweed-text .allah_laam { color: #007200; font-weight: bold; }
.tajweed-text .madda_normal { color: #ff0000; }
.tajweed-text .madda_mandatory { color: #ff0000; font-weight: bold; }
.tajweed-text .ghunnah { color: #00aa00; }
.tajweed-text .ikhfa { color: #ffaa00; }
.tajweed-text .idgham { color: #aaaaaa; }
.tajweed-text .qalqalah { color: #0000ff; }
.tajweed-text .iqlab { color: #00aa00; text-decoration: underline; }

/* Makhraj Guide Panel */
.makhraj-guide {
    margin-top: 1rem;
    padding: 1.5rem;
    background: rgba(217, 119, 6, 0.1);
    border: 1px dashed var(--accent-color);
    border-radius: 15px;
    font-size: 0.9rem;
}

.makhraj-guide h4 {
    color: var(--accent-color);
    margin-bottom: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.makhraj-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
}

.makhraj-item {
    background: rgba(255, 255, 255, 0.05);
    padding: 0.8rem;
    border-radius: 10px;
}

.makhraj-item span {
    display: block;
    font-family: var(--font-arabic);
    font-size: 1.2rem;
    color: var(--accent-color);
}

.makhraj-item small {
    display: block;
    margin-top: 5px;
    font-size: 0.75rem;
    opacity: 0.8;
}

.murojaah-actions-top {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 1rem;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--glass-border);
    color: white;
    padding: 0.4rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.8rem;
}

/* Responsive */
@media (max-width: 768px) {
    header h1 { font-size: 1.8rem; }
    .ayah-arabic { font-size: 1.8rem; }
    .audio-panel { 
        width: 95%; 
        padding: 0.8rem;
        gap: 1rem;
        bottom: 1rem;
        flex-direction: column;
        border-radius: 20px;
    }
}

footer {
    padding: 3rem 0;
    text-align: center;
    opacity: 0.5;
    font-size: 0.8rem;
}
