/* استایل‌های عمومی */
@font-face {
    font-family: 'Ray';
    src: url('../Ray-Bold.ttf') format('truetype');
    font-weight: bold;
    font-style: normal;
}

:root {
    /* Light theme variables - red theme for martyrdom */
    --primary-color: #b30000;
    --secondary-color: #4a4a4a;
    --bg-color: #f9f9f9;
    --header-bg: #8b0000;
    --text-color: #333333;
    --arabic-font: 'Amiri', serif;
    --persian-font: 'Ray', sans-serif;
    --player-bg: #f8f0f0;
    --player-highlight: #cc0000;
    --player-text: #333;
    --player-control: #444;
    --section-bg: white;
    --border-color: #eee;
}

/* Dark theme variables */
[data-theme="dark"] {
    --primary-color: #ff3333;
    --secondary-color: #666666;
    --bg-color: #1a1a1a;
    --header-bg: #660000;
    --text-color: #ffffff;
    --player-bg: #2a2a2a;
    --player-highlight: #ff3333;
    --player-text: #ffffff;
    --player-control: #cccccc;
    --section-bg: #2d2d2d;
    --border-color: #404040;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--persian-font);
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

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

a:hover {
    text-decoration: underline;
}

/* هدر */
header {
    background-color: var(--header-bg);
    color: white;
    padding: 2rem 0;
    text-align: center;
    background-image: linear-gradient(rgba(139, 0, 0, 0.8), rgba(139, 0, 0, 1)), url('../img/header-bg.jpg');
    background-size: cover;
    background-position: center;
    box-shadow: 0 3px 15px rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

header .subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* منوی ناوبری */
nav {
    display: none;
}

/* بخش اصلی */
main {
    padding: 3rem 0;
}

section {
    margin-bottom: 4rem;
    background: var(--section-bg);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

section h2 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
    text-align: center;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 1rem;
}

/* پخش کننده صوتی شخصی‌سازی شده */
.audio-player {
    text-align: center;
    transition: all 0.3s ease;
    padding: 1rem 0;
}

.audio-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 20px;
}

audio {
    display: none;
}

.custom-player {
    background-color: var(--player-bg);
    border-radius: 30px;
    padding: 15px 25px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.08);
    position: relative;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    transition: all 0.3s ease;
    border: 1px solid rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.player-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}

.player-btn {
    background: none;
    border: none;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--player-control);
    transition: all 0.3s ease;
    background-color: rgba(179, 0, 0, 0.05);
    padding: 0;
}

[data-theme="dark"] .player-btn {
    background-color: rgba(255, 51, 51, 0.05);
}

.player-btn:hover {
    color: var(--player-highlight);
    transform: scale(1.1);
    background-color: rgba(179, 0, 0, 0.1);
}

[data-theme="dark"] .player-btn:hover {
    background-color: rgba(255, 51, 51, 0.1);
}

.player-btn svg {
    width: 28px;
    height: 28px;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.1));
}

/* حذف نوار صوت */
.progress-container, .progress-bar, .progress {
    display: none !important;
}

.time-display {
    font-size: 0.9rem;
    color: var(--text-color);
    font-family: 'Ray', monospace;
    opacity: 0.9;
    min-width: 85px;
    text-align: center;
    background-color: rgba(179, 0, 0, 0.05);
    padding: 6px 10px;
    border-radius: 20px;
    letter-spacing: 1px;
}

[data-theme="dark"] .time-display {
    background-color: rgba(255, 51, 51, 0.1);
}

.speed-control {
    position: relative;
    margin-left: 10px;
}

.speed-btn {
    background: rgba(179, 0, 0, 0.05);
    border: none;
    color: var(--text-color);
    opacity: 0.9;
    cursor: pointer;
    font-size: 0.9rem;
    font-family: 'Ray', sans-serif;
    padding: 6px 12px;
    border-radius: 20px;
    transition: all 0.3s ease;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 2px;
}

[data-theme="dark"] .speed-btn {
    background: rgba(255, 51, 51, 0.1);
}

.speed-btn:hover {
    opacity: 1;
    background-color: rgba(179, 0, 0, 0.15);
    transform: scale(1.05);
}

.volume-control {
    display: flex;
    align-items: center;
}

.volume-btn {
    background: none;
    border: none;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--player-control);
    cursor: pointer;
    transition: all 0.3s;
    margin-right: 6px;
}

.volume-btn:hover {
    color: var(--player-highlight);
}

.volume-btn svg {
    width: 20px;
    height: 20px;
}

#volume {
    width: 80px;
    height: 7px;
    -webkit-appearance: none;
    background-color: #ddd;
    border-radius: 3px;
    outline: none;
}

#volume::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background-color: var(--player-highlight);
    cursor: pointer;
}

#volume::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background-color: var(--player-highlight);
    cursor: pointer;
    border: none;
}

/* متن زیارت */
.ziyarat-text {
    line-height: 2;
}

.arabic-text {
    font-family: var(--arabic-font);
    font-size: 1.5rem;
    margin-bottom: 2rem;
    text-align: justify;
    line-height: 2.2;
    direction: rtl;
    padding: 0 15px;
}

.persian-translation {
    font-family: var(--persian-font);
    background: var(--section-bg);
    border-radius: 8px;
    padding: 2rem;
    margin-top: 2rem;
    width: 100%; /* Full width */
    max-width: 100%; /* Remove max-width restriction */
    margin-left: auto;
    margin-right: auto;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    border: 1px solid var(--border-color);
}

.persian-translation h3 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    font-size: 1.4rem;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
}

.persian-translation p {
    margin-bottom: 1rem;
    text-align: justify;
    line-height: 2;
    text-justify: inter-word;
}

/* بخش درباره */
.about-section p {
    margin-bottom: 1rem;
    text-align: justify;
    font-family: var(--persian-font);
}

/* فوتر */
footer {
    background-color: var(--secondary-color);
    color: white;
    text-align: center;
    padding: 1.5rem 0;
    margin-top: 2rem;
}

/* واکنش‌گرایی */
@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }
    
    .arabic-text {
        font-size: 1.3rem;
    }
    
    .player-controls {
        flex-direction: column;
        gap: 15px;
    }
    
    .progress-container {
        width: 100%;
        margin: 15px 0;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.5rem;
    }
    
    section {
        padding: 1.5rem;
    }
    
    .arabic-text {
        font-size: 1.1rem;
    }
    
    .custom-player {
        padding: 15px 10px;
    }
    
    .player-btn {
        width: 40px;
        height: 40px;
    }
    
    .volume-control {
        margin-top: 10px;
        justify-content: center;
        width: 100%;
    }
}

/* Theme toggle button */
.theme-toggle {
    position: fixed;
    bottom: 20px;
    left: 20px;
    background: var(--player-bg);
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 12px rgba(0,0,0,0.2);
    z-index: 1000;
    color: var(--player-highlight);
    transition: all 0.3s ease;
    border: 1px solid rgba(179, 0, 0, 0.1);
}

[data-theme="dark"] .theme-toggle {
    border: 1px solid rgba(255, 51, 51, 0.1);
}

.theme-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(179, 0, 0, 0.2);
}

[data-theme="dark"] .theme-toggle:hover {
    box-shadow: 0 4px 15px rgba(255, 51, 51, 0.2);
}

/* Fixed audio player when scrolling */
.audio-player.fixed {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: var(--section-bg);
    padding: 8px;
    box-shadow: 0 3px 12px rgba(0,0,0,0.15);
    border-bottom: 1px solid rgba(179, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

[data-theme="dark"] .audio-player.fixed {
    border-bottom: 1px solid rgba(255, 51, 51, 0.2);
}

.audio-player.fixed .custom-player {
    max-width: 800px;
    margin: 0 auto;
    padding: 10px 20px;
    border-radius: 20px;
    box-shadow: 0 4px 12px rgba(179, 0, 0, 0.1);
}

[data-theme="dark"] .audio-player.fixed .custom-player {
    box-shadow: 0 4px 12px rgba(255, 51, 51, 0.1);
}

.audio-player.fixed h2 {
    display: none;
}

/* Placeholder element to prevent content jump */
.audio-player-placeholder {
    display: none;
    height: 0;
    transition: height 0.3s ease;
}

.audio-player-placeholder.active {
    display: block;
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .audio-player.fixed .custom-player {
        border-radius: 0;
        padding: 8px 12px;
        max-width: 95%;
    }

    .audio-player.fixed .progress-container {
        display: none; /* Hide progress bar when fixed in header */
    }

    .audio-player:not(.fixed) .progress-container {
        display: flex; /* Show progress bar in normal mode */
    }

    .audio-player.fixed .player-controls {
        flex-direction: row;
        gap: 10px;
        justify-content: space-between;
    }
    
    /* Controls layout - all in one row */
    .player-control-row {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
    }
    
    .time-display {
        order: 2;
        text-align: center;
        min-width: 75px;
    }
    
    .player-btn {
        width: 32px;
        height: 32px;
        order: 1;
    }
    
    .player-btn svg {
        width: 20px;
        height: 20px;
    }
    
    .speed-control {
        order: 3;
    }
    
    .speed-btn {
        font-size: 0.75rem;
        padding: 2px 6px;
    }
}

@media (max-width: 480px) {
    .custom-player {
        padding: 12px 8px;
        max-width: 90%; /* Even smaller on very small screens */
        margin: 0 auto;
    }
    
    .audio-player.fixed .custom-player {
        max-width: 100%;
        border-radius: 0;
    }
    
    /* Make progress bar even more prominent */
    .progress-bar {
        height: 6px;
    }
    
    .progress-bar:hover {
        height: 8px;
    }
    
    .time-display {
        font-size: 0.7rem;
        min-width: 65px;
    }
    
    .player-btn {
        width: 30px;
        height: 30px;
    }
    
    .player-btn svg {
        width: 18px;
        height: 18px;
    }
}

/* استایل برای هایلایت کردن متن در حال پخش */
.highlight-text {
    background-color: rgba(0, 100, 0, 0.1);
    padding: 2px 5px;
    border-radius: 4px;
    transition: background-color 0.5s ease;
}

[data-theme="dark"] .highlight-text {
    background-color: rgba(0, 200, 0, 0.15);
}

.player-control-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 5px 10px;
    background-color: rgba(179, 0, 0, 0.03);
    border-radius: 25px;
}

[data-theme="dark"] .player-control-row {
    background-color: rgba(255, 51, 51, 0.03);
}

/* Override player-control-row on desktop to restore proper layout */
@media (min-width: 769px) {
    .player-control-row {
        display: flex !important;
        width: 100% !important;
        padding: 5px 15px !important;
        background: rgba(179, 0, 0, 0.03) !important;
        border-radius: 25px !important;
        justify-content: space-between !important;
        align-items: center !important;
    }

    .progress-container {
        width: 100%;
        margin-bottom: 10px;
    }

    .player-controls {
        flex-direction: row;
        width: 100%;
    }

    .time-display {
        order: 1;
    }

    .player-btn {
        order: 2;
    }

    .speed-control {
        order: 3;
    }
}

/* Speed button Persian numbers */
.speed-btn {
    background: rgba(179, 0, 0, 0.05);
    border: none;
    color: var(--text-color);
    opacity: 0.9;
    cursor: pointer;
    font-size: 0.9rem;
    font-family: 'Ray', sans-serif;
    padding: 6px 12px;
    border-radius: 20px;
    transition: all 0.3s ease;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 2px;
}

[data-theme="dark"] .speed-btn {
    background: rgba(255, 51, 51, 0.1);
}

.speed-btn:hover {
    opacity: 1;
    background-color: rgba(179, 0, 0, 0.15);
    transform: scale(1.05);
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .audio-player.fixed .custom-player {
        border-radius: 0;
        padding: 8px 12px;
        max-width: 95%;
    }

    .audio-player.fixed .progress-container {
        display: none; /* Hide progress bar when fixed in header */
    }

    .audio-player:not(.fixed) .progress-container {
        display: flex; /* Show progress bar in normal mode */
    }

    .audio-player.fixed .player-controls {
        flex-direction: row;
        gap: 10px;
        justify-content: space-between;
    }
    
    /* Controls layout - all in one row */
    .player-control-row {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
    }
    
    .time-display {
        order: 2;
        text-align: center;
        min-width: 75px;
    }
    
    .player-btn {
        width: 32px;
        height: 32px;
        order: 1;
    }
    
    .player-btn svg {
        width: 20px;
        height: 20px;
    }
    
    .speed-control {
        order: 3;
    }
    
    .speed-btn {
        font-size: 0.75rem;
        padding: 2px 6px;
    }
}

/* Speed values in Persian */
.speed-btn[data-speed="0.75"]::before { content: "۰٫۷۵×"; }
.speed-btn[data-speed="1"]::before { content: "۱٫۰×"; }
.speed-btn[data-speed="1.25"]::before { content: "۱٫۲۵×"; }
.speed-btn[data-speed="1.5"]::before { content: "۱٫۵×"; }
.speed-btn[data-speed="1.75"]::before { content: "۱٫۷۵×"; }
.speed-btn[data-speed="2"]::before { content: "۲٫۰×"; }

/* Hide original speed text */
.speed-btn span {
    display: none;
}