/* ============================================
   Font Face — Vazir
   ============================================ */

@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/2_Vazir_Medium_Font.ttf') format('truetype');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'IranNastaliq';
    src: url('../fonts/IranNastaliq.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}


/* ============================================
   CSS Variables
   ============================================ */

:root {
    /* Transitions */
    --transition: 0.3s ease;
    --transition-slow: 0.5s ease;
}

[data-theme="dark"] {
    --bg-primary: #242425;
    --bg-secondary: #12121a;
    --bg-glass: rgba(255, 255, 255, 0.03);
    --bg-glass-border: rgba(255, 255, 255, 0.06);

    --text-primary: #f0f0f0;
    --text-secondary: #8a8a9a;
    --text-tertiary: #5a5a6a;

    --accent: #2abbdf;
    --accent-light: #2abbdf;
    --accent-glow: rgba(45, 212, 191, 0.08);

    --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
    --shadow-md: 0 8px 30px rgba(0,0,0,0.4);
    --shadow-lg: 0 20px 60px rgba(0,0,0,0.5);
}

[data-theme="light"] {
    --bg-primary: #f8f9fa;
    --bg-secondary: #ffffff;
    --bg-glass: rgba(255, 255, 255, 0.7);
    --bg-glass-border: rgba(0, 0, 0, 0.08);

    --text-primary: #1a1a2e;
    --text-secondary: #64748b;
    --text-tertiary: #94a3b8;

    /* Darker teal for light mode visibility */
    --accent: #2abbdf;
    --accent-light: #2abbdf;
    --accent-glow: rgba(13, 148, 136, 0.1);

    --shadow-sm: 0 2px 8px rgba(0,0,0,0.06);
    --shadow-md: 0 8px 30px rgba(0,0,0,0.08);
    --shadow-lg: 0 20px 60px rgba(0,0,0,0.1);
}

/* ============================================
   Reset & Base
   ============================================ */

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Vazirmatn', 'Segoe UI', Tahoma, Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: background var(--transition), color var(--transition);
    overflow-x: hidden;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    text-decoration: none;
    color: inherit;
}

img {
    max-width: 100%;
    display: block;
}

/* ============================================
   Scrollbar
   ============================================ */

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--text-tertiary);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

/* ============================================
   Selection
   ============================================ */

::selection {
    background: var(--accent);
    color: var(--bg-primary);
}

/* در base.css */

.site-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 140px;
    background: transparent;
    border: none;
    z-index: 1000;
    padding: 20px 0;
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-link {
    display: block;
    height: 120px;
    transition: opacity 0.3s ease;
}

.logo-link:hover {
    opacity: 0.8;
}

.logo-link img {
    height: 100%;
    width: auto;
    display: block;
}

/* نمایش لوگو بر اساس تم */
[data-theme="light"] .logo-dark {
    display: block;
}

[data-theme="light"] .logo-light {
    display: none;
}

[data-theme="dark"] .logo-dark {
    display: none;
}

[data-theme="dark"] .logo-light {
    display: block;
}

/* فیلتر رنگی برای هماهنگی با تم */
[data-theme="dark"] .logo-link img {
    filter: brightness(1.1) saturate(1.2);
}

[data-theme="light"] .logo-link img {
    filter: hue-rotate(-5deg) saturate(1.1);
}

/* ============================================
   Messages (Django messages framework)
   ============================================ */

   .messages {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 400px;
}

.message {
    padding: 14px 20px;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 500;
    background: #ffffff;
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(10px);
    animation: slideInRight 0.4s ease, fadeOut 0.5s ease 3.5s forwards;
    display: flex;
    align-items: center;
    gap: 10px;
}

.message-success {
    color: #059669;
    border: 2px solid #10b981;
}

.message-error {
    color: #dc2626;
    border: 2px solid #ef4444;
}

.message-warning {
    color: #d97706;
    border: 2px solid #f59e0b;
}

.message-info {
    color: #2563eb;
    border: 2px solid #3b82f6;
}

/* Dark theme */
[data-theme="dark"] .message {
    background: rgba(30, 30, 40, 0.95);
}

[data-theme="dark"] .message-success {
    color: #34d399;
}

[data-theme="dark"] .message-error {
    color: #f87171;
}

[data-theme="dark"] .message-warning {
    color: #fbbf24;
}

[data-theme="dark"] .message-info {
    color: #60a5fa;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .messages {
        top: 15px;
        right: 15px;
        left: 15px;
        max-width: none;
    }
    
    .message {
        padding: 12px 16px;
        font-size: 0.85rem;
    }
}


.h_iframe-aparat_embed_frame {
    position: relative;
    width: 100%;
    max-width: 100%;
    margin: 24px 0;
    overflow: hidden;
    border-radius: 16px;
    background: #000;
}

.h_iframe-aparat_embed_frame .ratio {
    display: block;
    width: 100%;
    padding-top: 57%;
}

.h_iframe-aparat_embed_frame iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
}

/* audio */
.audio-player {
    --audio-accent: #2abbdf;
    --audio-accent-2: #6ee7f7;
    --audio-accent-deep: #1497b8;
    --audio-bg-light: rgba(255, 255, 255, 0.88);
    --audio-bg-dark: rgba(18, 18, 18, 0.86);
    --audio-text-light: #101418;
    --audio-text-dark: #f5fbff;
    --audio-muted-light: rgba(16, 20, 24, 0.64);
    --audio-muted-dark: rgba(245, 251, 255, 0.70);
    --audio-border-light: rgba(42, 187, 223, 0.18);
    --audio-border-dark: rgba(110, 231, 247, 0.16);
    --audio-shadow-light: 0 14px 38px rgba(25, 150, 190, 0.14);
    --audio-shadow-dark: 0 16px 42px rgba(0, 0, 0, 0.34);
    --audio-track: rgba(42, 187, 223, 0.14);

    position: relative;
    overflow: hidden;
    direction: rtl;
    display: flex;
    flex-direction: column;
    gap: 14px;
    width: 100%;
    max-width: 560px;
    padding: 18px 18px 16px;
    margin: 24px 0;
    border-radius: 24px;
    background:
        radial-gradient(circle at top left, rgba(110, 231, 247, 0.18), transparent 34%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(249, 253, 255, 0.90));
    border: 1px solid var(--audio-border-light);
    box-shadow: var(--audio-shadow-light);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: transform 0.28s ease, box-shadow 0.28s ease, border-color 0.28s ease;
}

.audio-player::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(135deg, rgba(255,255,255,0.18), transparent 45%);
    opacity: 0.9;
}

.audio-player::after {
    content: "";
    position: absolute;
    top: -40px;
    left: -40px;
    width: 120px;
    height: 120px;
    background: radial-gradient(circle, rgba(42, 187, 223, 0.20), transparent 70%);
    pointer-events: none;
}

.audio-player:hover {
    transform: translateY(-3px);
    border-color: rgba(42, 187, 223, 0.28);
    box-shadow: 0 20px 44px rgba(25, 150, 190, 0.18);
}

.audio-player-header {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.audio-title {
    font-size: 1rem;
    font-weight: 800;
    line-height: 1.9;
    color: var(--audio-text-light);
    word-break: break-word;
    letter-spacing: -0.01em;
}

.audio-loading {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--audio-accent-deep);
    opacity: 0.95;
}

.audio-loading::before {
    content: "";
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--audio-accent);
    box-shadow: 0 0 0 0 rgba(42, 187, 223, 0.45);
    animation: audioPulse 1.4s infinite;
}

@keyframes audioPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(42, 187, 223, 0.45);
        transform: scale(0.95);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(42, 187, 223, 0);
        transform: scale(1);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(42, 187, 223, 0);
        transform: scale(0.95);
    }
}

.audio-player-controls {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 14px;
}

.audio-play-btn {
    flex: 0 0 56px;
    width: 56px;
    height: 56px;
    border: 0;
    border-radius: 18px;
    background:
        linear-gradient(135deg, var(--audio-accent-2) 0%, var(--audio-accent) 45%, var(--audio-accent-deep) 100%);
    color: #fff;
    font-size: 1.15rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow:
        0 10px 24px rgba(42, 187, 223, 0.32),
        inset 0 1px 0 rgba(255,255,255,0.30);
    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease,
        opacity 0.2s ease,
        filter 0.2s ease;
}

.audio-play-btn:hover {
    transform: translateY(-1px) scale(1.03);
    box-shadow:
        0 14px 28px rgba(42, 187, 223, 0.40),
        inset 0 1px 0 rgba(255,255,255,0.34);
    filter: saturate(1.08);
}

.audio-play-btn:active {
    transform: scale(0.96);
}

.audio-play-btn:disabled {
    opacity: 0.64;
    cursor: not-allowed;
    box-shadow:
        0 6px 14px rgba(42, 187, 223, 0.18),
        inset 0 1px 0 rgba(255,255,255,0.18);
}

.audio-progress-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
}

.audio-progress {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 8px;
    border: none;
    border-radius: 999px;
    outline: none;
    cursor: pointer;

    /* direction: ltr !important; */
    transform: scaleX(-1);
    transform-origin: center;

    background: linear-gradient(90deg, rgba(42, 187, 223, 0.18), rgba(42, 187, 223, 0.08));
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.08);
}


/* Chrome / Edge / Safari */
.audio-progress::-webkit-slider-runnable-track {
    height: 8px;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(42, 187, 223, 0.18), rgba(42, 187, 223, 0.08));
}

.audio-progress::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    margin-top: -5px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background:
        radial-gradient(circle at 30% 30%, #ffffff 0%, #dff9ff 18%, var(--audio-accent) 58%, var(--audio-accent-deep) 100%);
    border: 2px solid #fff;
    box-shadow:
        0 3px 12px rgba(42, 187, 223, 0.34),
        0 0 0 4px rgba(42, 187, 223, 0.10);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.audio-progress:hover::-webkit-slider-thumb {
    transform: scale(1.06);
    box-shadow:
        0 4px 16px rgba(42, 187, 223, 0.42),
        0 0 0 5px rgba(42, 187, 223, 0.12);
}

/* Firefox */
.audio-progress::-moz-range-track {
    height: 8px;
    border: none;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(42, 187, 223, 0.18), rgba(42, 187, 223, 0.08));
}

.audio-progress::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border: 2px solid #fff;
    border-radius: 50%;
    background:
        radial-gradient(circle at 30% 30%, #ffffff 0%, #dff9ff 18%, var(--audio-accent) 58%, var(--audio-accent-deep) 100%);
    box-shadow:
        0 3px 12px rgba(42, 187, 223, 0.34),
        0 0 0 4px rgba(42, 187, 223, 0.10);
}

.audio-time {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--audio-muted-light);
    letter-spacing: 0.01em;
}

.audio-current-time,
.audio-duration {
    font-variant-numeric: tabular-nums;
}

.audio-time-sep {
    opacity: 0.48;
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
    .audio-player {
        background:
            radial-gradient(circle at top left, rgba(42, 187, 223, 0.14), transparent 34%),
            linear-gradient(180deg, rgba(23, 23, 23, 0.95), rgba(16, 16, 16, 0.88));
        border: 1px solid var(--audio-border-dark);
        box-shadow: var(--audio-shadow-dark);
    }

    .audio-player::before {
        background: linear-gradient(135deg, rgba(255,255,255,0.06), transparent 45%);
    }

    .audio-title {
        color: var(--audio-text-dark);
    }

    .audio-loading {
        color: #8defff;
    }

    .audio-time {
        color: var(--audio-muted-dark);
    }

    .audio-progress {
        background: linear-gradient(90deg, rgba(255,255,255,0.18), rgba(255,255,255,0.08));
        box-shadow: inset 0 1px 3px rgba(255,255,255,0.04);
    }

    .audio-progress::-webkit-slider-runnable-track {
        background: linear-gradient(90deg, rgba(255,255,255,0.18), rgba(255,255,255,0.08));
    }

    .audio-progress::-moz-range-track {
        background: linear-gradient(90deg, rgba(255,255,255,0.18), rgba(255,255,255,0.08));
    }

    .audio-progress::-webkit-slider-thumb,
    .audio-progress::-moz-range-thumb {
        border-color: #101010;
    }
}

/* Mobile */
@media (max-width: 640px) {
    .audio-player {
        padding: 16px;
        border-radius: 20px;
        gap: 12px;
    }

    .audio-player-controls {
        gap: 12px;
    }

    .audio-play-btn {
        flex: 0 0 50px;
        width: 50px;
        height: 50px;
        border-radius: 16px;
        font-size: 1.05rem;
    }

    .audio-title {
        font-size: 0.95rem;
        line-height: 1.8;
    }

    .audio-time {
        font-size: 0.8rem;
    }
}
