/* ===================================
   PAGE VIEW - Specific Styles
   =================================== */

/* Body Override for Page View */
body {
    padding-top: 0;
    padding-bottom: 80px;
    padding-left: 20px;
    padding-right: 20px;
    line-height: 2.2;
    direction: rtl;
}

/* Mobile Body Adjustments */
@media (max-width: 768px) {
    body {
        padding-top: 0;
        padding-left: 8px;
        padding-right: 8px;
        line-height: 1.7;
        padding-bottom: 70px;
    }
}

/* Container Override for Page View */
.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 10px;
}

@media (max-width: 768px) {
    .container {
        padding: 5px;
    }
}

/* Page Body */
.page-body {
    background-color: white;
    padding: 5px 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Page Header Info */
.page-header-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    margin-bottom: 15px;
    border-bottom: 1px solid #e0e0e0;
    direction: rtl;
    font-size: 1.1em;
    color: #2c5f2d;
}

.page-header-page {
    flex: 1;
    text-align: right;
    font-weight: normal;
}

.page-header-surah {
    flex: 1;
    text-align: center;
    font-weight: normal;
}

.page-header-juz {
    flex: 1;
    text-align: left;
    font-weight: normal;
}

@media (max-width: 768px) {
    .page-header-info {
        font-size: 0.95em;
        padding: 8px 0;
        margin-bottom: 10px;
    }
}

/* Surah Section */
.surah-section {
    margin-bottom: 20px;
}

.surah-section:last-child {
    margin-bottom: 0;
}

/* Surah Header Override for Page View */
.surah-header {
    margin: 0 0 15px 0;
}

/* Verses Container */
.verses-container {
    direction: rtl;
    text-align: justify;
    text-align-last: center;
    font-size: 2em;
    line-height: 2.5;
    color: #333;
    padding: 10px 0;
}

@media (max-width: 768px) {
    .verses-container {
        line-height: 2.0;
        padding: 5px 0;
    }
}

/* Verse */
.verse {
    display: inline;
    white-space: pre-line;
    padding: 2px 5px;
    border-radius: 3px;
}

/* Basmala line break: forces ﷽ onto its own centered line */
.basmala {
    display: inline-block;
    width: 100%;
    text-align: center;
}

.verse.playing {
    background-color: #e8f5e9;
}

/* Disabled Buttons */
button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Page Navigation */
.page-nav-top,
.page-nav-bottom {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    padding: 10px;
}

.page-nav-top {
    margin-bottom: 5px;
}

.page-nav-bottom {
    margin-bottom: 5px;
}

.page-nav-top .page-number,
.page-nav-bottom .page-number {
    color: #2c5f2d;
    font-size: 1.3em;
    font-weight: bold;
    min-width: 50px;
    text-align: center;
}

.page-nav-btn {
    border: 1px solid #b0c8b0;
    color: #2c5f2d;
    padding: 3px 5px;
    border-radius: 5px;
    font-size: 1.5em;
    font-weight: bold;
    text-decoration: none;
    transition: all 0.3s;
    min-width: 60px;
    text-align: center;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.page-nav-btn:hover:not(.disabled) {
    background-color: #e8f5e9;
    transform: scale(1.05);
}

.page-nav-btn.disabled {
    opacity: 0.3;
    cursor: not-allowed;
    color: #999;
}

@media (max-width: 768px) {
    .page-nav-btn {
        min-width: 40px;
        padding: 2px 4px;
        font-size: 1.2em;
    }

    .page-nav-top,
    .page-nav-bottom {
        gap: 10px;
        padding: 8px;
    }

    .page-nav-top .page-number,
    .page-nav-bottom .page-number {
        font-size: 1.1em;
        min-width: 35px;
    }
}

/* Continuous Player */
.continuous-player {
    background: transparent;
    padding: 0;
    margin: 0;
}

.continuous-player h3 {
    color: white;
    text-align: center;
    margin: 0 0 10px 0;
    font-size: 1.1em;
}

.player-controls {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.player-buttons {
    display: flex;
    align-items: center;
    gap: 15px;
    direction: ltr;
}

@media (max-width: 768px) {
    .player-buttons {
        gap: 8px;
    }
}

.play-all-btn {
    background-color: #fff;
    color: #2c5f2d;
    border: none;
    padding: 10px 16px;
    border-radius: 5px;
    font-size: 1.3em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    min-width: 50px;
}

@media (max-width: 768px) {
    .play-all-btn {
        padding: 6px 10px;
        font-size: 1em;
        min-width: 38px;
        border-radius: 4px;
    }
}

.play-all-btn:hover {
    background-color: #e8f5e9;
    transform: scale(1.05);
}

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

.play-all-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Timeline */
.timeline-container {
    width: 100%;
    direction: ltr;
}

.timeline-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}

@media (max-width: 768px) {
    .timeline-wrapper {
        gap: 6px;
    }
}

.timeline {
    flex: 1;
    height: 8px;
    background-color: rgba(255,255,255,0.3);
    border-radius: 4px;
    cursor: pointer;
    position: relative;
}

.timeline-progress {
    height: 100%;
    background-color: white;
    border-radius: 4px;
    width: 0%;
    transition: width 0.1s linear;
}

.timeline-time-left,
.timeline-time-right {
    color: white;
    font-size: 0.9em;
    opacity: 0.9;
    min-width: 40px;
    text-align: center;
}

@media (max-width: 768px) {
    .timeline-time-left,
    .timeline-time-right {
        font-size: 0.75em;
        min-width: 32px;
    }
}

/* Loading Indicator */
.loading-indicator {
    color: white;
    text-align: center;
    padding: 10px;
    font-size: 1em;
}

.loading-bar {
    width: 100%;
    height: 4px;
    background-color: rgba(255,255,255,0.3);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 10px;
}

.loading-bar-progress {
    height: 100%;
    background-color: white;
    width: 0%;
    transition: width 0.3s;
}


/* Static Checkbox for Progress Page */
.progress-checkbox-static {
    font-size: 1.3em;
    color: #2c5f2d;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* CSS Custom Highlights API - preserves Arabic text connections */
::highlight(lafzatullah) {
    color: #e74c3c;
}

::highlight(highlight-yellow) {
    background-color: rgba(255, 235, 59, 0.5);
}

::highlight(highlight-green) {
    background-color: rgba(139, 195, 74, 0.5);
}

::highlight(highlight-blue) {
    background-color: rgba(100, 181, 246, 0.5);
}

::highlight(highlight-invalid) {
    background-color: rgba(255, 107, 107, 0.5);
}

/* Fallback for browsers without CSS Highlights API */
mark.highlight-yellow {
    background-color: rgba(255, 235, 59, 0.4);
    padding: 0;
    margin: 0;
    border: none;
    display: inline;
    font: inherit;
    text-rendering: optimizeLegibility;
    -webkit-font-feature-settings: normal;
    font-feature-settings: normal;
}

mark.highlight-green {
    background-color: rgba(139, 195, 74, 0.4);
    padding: 0;
    margin: 0;
    border: none;
    display: inline;
    font: inherit;
    text-rendering: optimizeLegibility;
    -webkit-font-feature-settings: normal;
    font-feature-settings: normal;
}

mark.highlight-blue {
    background-color: rgba(100, 181, 246, 0.4);
    padding: 0;
    margin: 0;
    border: none;
    display: inline;
    font: inherit;
    text-rendering: optimizeLegibility;
    -webkit-font-feature-settings: normal;
    font-feature-settings: normal;
}

mark.highlight-invalid {
    background-color: rgba(255, 107, 107, 0.4);
    padding: 0;
    margin: 0;
    border: none;
    display: inline;
    font: inherit;
    text-rendering: optimizeLegibility;
    -webkit-font-feature-settings: normal;
    font-feature-settings: normal;
}

/* Adjust verse highlighting to not conflict with text highlights */
.verse.playing mark {
    background-color: inherit;
    box-shadow: 0 0 0 3px #e8f5e9;
}

/* Page Disclaimer */
.page-disclaimer {
    margin: 20px 0 15px 0;
    padding: 0;
    font-size: 0.75em;
    color: #999;
    text-align: center;
    direction: ltr;
}

@media (max-width: 768px) {
    .page-disclaimer {
        margin: 15px 0 10px 0;
        font-size: 0.7em;
    }
}
