/* ===== DESIGN TOKENS ===== */
:root {
  --bg-1: #0f1e17;      /* أخضر داكن جدًا (خلفية أساسية) */
  --bg-2: #15271f;      /* درجة أفتح للبطاقات */
  --ink-1: #e8e0c6;     /* نص أساسي (بيج/عاجي) */
  --ink-2: #cbbf95;     /* نص ثانوي */
  --gold-1: #d4af37;    /* ذهبي أساسي */
  --gold-2: #b58e2e;    /* ذهبي داكن للتدرجات */
  --mute:   #2b3b32;    /* حدود/مقسمات باهتة */
  --focus:  #f3d86b;    /* ظل/Feedback */
  --success:#4caf50;
  --danger: #e74c3c;
  --radius-xl: 20px;
  --radius-md: 14px;
  --shadow-1: 0 8px 28px rgba(0,0,0,.35);
  --shadow-2: inset 0 1px 0 rgba(255,255,255,.06), 0 6px 20px rgba(0,0,0,.45);
}

/* ===== RESET & BASE STYLES ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Reem Kufi', 'Cairo', 'Noto Naskh Arabic', serif;
    background: var(--bg-1);
    color: var(--ink-1);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    font-smooth: antialiased;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* تحسين عرض الصورة */
    background-attachment: fixed;
    background-size: cover;
    background-position: center;
}

/* ===== BACKGROUND TEXTURE & VIGNETTE ===== */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -1;
    background:
        /* الصورة الأساسية */
        url('rm194-aew-11.jpg') center center / cover no-repeat,
        /* تأثيرات Vignette إسلامية */
        radial-gradient(1200px 600px at 50% -20%, rgba(255,255,255,.04), transparent 60%),
        radial-gradient(1000px 500px at 100% 120%, rgba(255,255,255,.04), transparent 60%),
        radial-gradient(1000px 500px at 0% 120%, rgba(255,255,255,.04), transparent 60%),
        /* طبقة داكنة لتحسين قراءة النص */
        linear-gradient(180deg, rgba(15,30,23,0.85), rgba(15,30,23,0.7) 30%, rgba(15,30,23,0.9));
    mix-blend-mode: normal;
}

/* ===== UTILITY CLASSES ===== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.25rem;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ===== HEADER STYLES ===== */
.header {
    text-align: center;
    margin-bottom: 2.5rem;
    padding: 2rem 0;
    background: rgba(30, 26, 27, 0.7);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-1);
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(212, 175, 55, 0.25);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.1) 0%, transparent 50%);
    border-radius: var(--radius-xl);
}

/* Header Ornaments */
.header::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: none;
}

.header-content {
    position: relative;
    z-index: 2;
}

.header-content h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--gold-1);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.header-content h1 i {
    font-size: 2rem;
    color: var(--gold-1);
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.header-subtitle {
    font-size: 1.1rem;
    color: var(--ink-2);
    opacity: 0.8;
    margin-top: 0.5rem;
}

/* ===== PLAYER CONTAINER ===== */
.player-container {
    margin-bottom: 2.5rem;
}

.player-card {
    background: rgba(30, 26, 27, 0.7);
    border-radius: var(--radius-xl);
    padding: 2rem;
    box-shadow: var(--shadow-2);
    border: 1px solid rgba(212, 175, 55, 0.25);
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.player-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--gold-1), transparent);
    opacity: 0.6;
}

/* Player Card Ornaments */
.player-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: none;
}

/* ===== PLAYER HEADER ===== */
.player-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
    position: relative;
    z-index: 2;
}

.current-track-info h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--ink-1);
    margin-bottom: 0.25rem;
}

.current-track-info p {
    font-size: 1rem;
    color: var(--ink-2);
    opacity: 0.8;
}

.player-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* ===== CONTROL BUTTONS ===== */
.control-btn {
    width: 3.25rem;
    height: 3.25rem;
    border: none;
    border-radius: 50%;
    background: radial-gradient(circle at center, rgba(42, 42, 42, 0.9) 0%, rgba(30, 26, 27, 0.9) 100%);
    color: var(--gold-1);
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.control-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.18), 0 4px 12px rgba(0, 0, 0, 0.4);
}

.control-btn:active {
    transform: translateY(0);
}

.control-btn:focus {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
}

.control-btn.active {
    background: radial-gradient(circle at center, var(--gold-1) 0%, var(--gold-2) 100%);
    color: var(--bg-1);
    box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.3);
}

.control-btn.focused {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
}

.play-btn {
    width: 3.5rem;
    height: 3.5rem;
    font-size: 1.25rem;
}

.play-btn.playing {
    animation: pulse-gold 2s infinite;
}

@keyframes pulse-gold {
    0%, 100% { box-shadow: 0 0 0 0 rgba(212, 175, 55, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(212, 175, 55, 0); }
}

/* ===== PLAYER BODY ===== */
.player-body {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    position: relative;
    z-index: 2;
}

.progress-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.time-display {
    display: flex;
    justify-content: space-between;
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
    color: var(--ink-2);
}

.progress-bar {
    position: relative;
    height: 0.5rem;
    background: rgba(20, 17, 18, 0.9);
    border-radius: 0.25rem;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--gold-2), var(--gold-1));
    border-radius: 0.25rem;
    transition: width 0.1s ease;
}

.progress-slider {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.progress-slider::-webkit-slider-thumb {
    appearance: none;
    width: 1rem;
    height: 1rem;
    border-radius: 50%;
    background: var(--gold-1);
    border: 2px solid var(--bg-2);
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.progress-slider::-moz-range-thumb {
    width: 1rem;
    height: 1rem;
    border-radius: 50%;
    background: var(--gold-1);
    border: 2px solid var(--bg-2);
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* ===== VOLUME CONTAINER ===== */
.volume-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--gold-1);
}

.volume-btn {
    background: none;
    border: none;
    color: var(--gold-1);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
}

.volume-btn:hover {
    background: var(--bg-1);
    transform: scale(1.05);
}

.volume-btn:focus {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
}

.volume-btn.muted i {
    color: var(--ink-2);
}

.volume-slider {
    flex: 1;
    height: 0.5rem;
    background: rgba(20, 17, 18, 0.9);
    border-radius: 0.25rem;
    outline: none;
    appearance: none;
    /* تعيين القيمة الافتراضية إلى 100% */
    -webkit-appearance: none;
    -moz-appearance: none;
    cursor: pointer;
    /* متغيرات CSS للتعبئة الذهبية */
    --volume-percentage: 100%;
}

.volume-slider::-webkit-slider-thumb {
    appearance: none;
    width: 1.2rem;
    height: 1.2rem;
    border-radius: 50%;
    background: var(--gold-1);
    border: 1px solid rgba(30, 26, 27, 0.9);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    transition: all 0.2s ease;
    opacity: 0.01;
}

.volume-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.volume-slider::-moz-range-thumb {
    width: 1.2rem;
    height: 1.2rem;
    border-radius: 50%;
    background: var(--gold-1);
    border: 2px solid rgba(30, 26, 27, 0.9);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    transition: all 0.2s ease;
}

.volume-slider::-moz-range-thumb:hover {
    transform: scale(1.1);
}

/* إضافة تأثير التعبئة الذهبية للـ volume slider */
.volume-slider::-webkit-slider-runnable-track {
    background: linear-gradient(to left, var(--gold-1) 0%, var(--gold-1) var(--volume-percentage), rgba(20, 17, 18, 0.9) var(--volume-percentage));
    height: 0.5rem;
    border-radius: 0.25rem;
    border: none;
}

.volume-slider::-moz-range-track {
    background: linear-gradient(to left, var(--gold-1) 0%, var(--gold-1) var(--volume-percentage), rgba(20, 17, 18, 0.9) var(--volume-percentage));
    height: 0.5rem;
    border-radius: 0.25rem;
    border: none;
}

/* ===== ADDITIONAL CONTROLS ===== */
.additional-controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.download-btn {
    background: radial-gradient(circle at center, var(--gold-1) 0%, var(--gold-2) 100%);
    color: white;
}

.download-btn:hover {
    background: radial-gradient(circle at center, var(--gold-1) 0%, var(--gold-2) 100%);
}

/* ===== PLAYLIST CONTAINER ===== */
.playlist-container {
    background: rgba(30, 26, 27, 0.7);
    border-radius: var(--radius-xl);
    padding: 2rem;
    box-shadow: var(--shadow-1);
    border: 1px solid rgba(212, 175, 55, 0.25);
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.playlist-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: none;
}

.playlist-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
    position: relative;
    z-index: 2;
}

.playlist-header h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--ink-1);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.playlist-header h2 i {
    color: var(--gold-1);
}

/* ===== SEARCH CONTAINER ===== */
.search-container {
    position: relative;
    flex: 1;
    max-width: 400px;
}

.search-container input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 3rem;
    border: 1px solid var(--mute);
    border-radius: var(--radius-md);
    background: rgba(30, 26, 27, 0.8);
    color: var(--ink-1);
    font-size: 1rem;
    transition: all 0.2s ease;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.search-container input:focus {
    outline: none;
    border-color: var(--gold-1);
    box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.2);
}

.search-container input::placeholder {
    color: var(--ink-2);
    opacity: 0.6;
}

.search-container i {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gold-1);
    pointer-events: none;
}

.upload-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, var(--gold-1), var(--gold-2));
    color: var(--bg-1);
    text-decoration: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.upload-link:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.upload-link:focus {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
}

/* ===== PLAYLIST ITEMS ===== */
.playlist {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    position: relative;
    z-index: 2;
}

.playlist-item {
    display: flex;
    align-items: center;
    padding: 1rem;
    background: rgba(30, 26, 27, 0.8);
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    transition: all 0.2s ease;
    cursor: pointer;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.playlist-item:hover {
    background: rgba(30, 26, 27, 0.85);
    border-bottom: 2px solid var(--gold-1);
    transform: translateY(-1px);
}

.playlist-item.active {
    background: rgba(30, 26, 27, 0.9);
    border: 1px solid var(--gold-1);
    box-shadow: inset 0 0 0 1px rgba(212, 175, 55, 0.2);
}

.playlist-item-info {
    flex: 1;
    margin-left: 1rem;
}

.playlist-item-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--ink-1);
    margin-bottom: 0.25rem;
}

.playlist-item-artist {
    font-size: 0.9rem;
    color: var(--ink-2);
    margin-bottom: 0.25rem;
}

.playlist-item-duration {
    font-size: 0.875rem;
    color: var(--ink-2);
    font-family: 'Courier New', monospace;
}

.playlist-item-controls {
    display: flex;
    gap: 0.5rem;
    margin-right: 1rem;
}

.playlist-item-btn {
    padding: 0.5rem;
    border: none;
    border-radius: 50%;
    background: radial-gradient(circle at center, rgba(42, 42, 42, 0.9) 0%, rgba(30, 26, 27, 0.9) 100%);
    color: var(--gold-1);
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(5px);
}

.playlist-item-btn:hover {
    background: var(--gold-1);
    color: var(--bg-1);
    transform: scale(1.05);
}

.playlist-item-btn:focus {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
}

/* ===== LOADING PLACEHOLDER ===== */
.loading-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    color: var(--ink-2);
    gap: 1rem;
}

.loading-placeholder i {
    font-size: 2rem;
    color: var(--gold-1);
    animation: spin 1s linear infinite;
}

.loading-placeholder span {
    font-size: 1rem;
    color: var(--ink-2);
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    .header-content h1 {
        font-size: 2rem;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .player-header {
        flex-direction: column;
        text-align: center;
    }
    
    .playlist-header {
        flex-direction: column;
        text-align: center;
    }
    
    .search-container {
        max-width: 100%;
    }
    
    .player-controls {
        justify-content: center;
    }
    
    .additional-controls {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .header-content h1 {
        font-size: 1.75rem;
    }
    
    .player-card {
        padding: 1.5rem;
    }
    
    .control-btn {
        width: 2.75rem;
        height: 2.75rem;
        font-size: 1rem;
    }
    
    .play-btn {
        width: 3rem;
        height: 3rem;
        font-size: 1.1rem;
    }
    
    .playlist-item {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }
    
    .playlist-item-info {
        margin-left: 0;
        text-align: center;
    }
    
    .playlist-item-controls {
        margin-right: 0;
        justify-content: center;
    }
}

/* ===== ACCESSIBILITY IMPROVEMENTS ===== */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ===== FOCUS VISIBILITY ===== */
*:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
}

/* ===== HIGH CONTRAST MODE SUPPORT ===== */
@media (prefers-contrast: high) {
    :root {
        --bg-1: #000000;
        --bg-2: #1a1a1a;
        --ink-1: #ffffff;
        --ink-2: #cccccc;
        --gold-1: #ffff00;
        --gold-2: #cccc00;
        --mute: #666666;
        --focus: #ffff00;
    }
}

/* ===== MESSAGE STYLES ===== */
.success-message,
.error-message,
.info-message {
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    text-align: center;
    font-weight: 600;
    border: 1px solid;
    animation: slideInDown 0.3s ease-out;
}

.success-message {
    background: color-mix(in srgb, var(--success) 20%, transparent);
    color: var(--success);
    border-color: var(--success);
}

.error-message {
    background: color-mix(in srgb, var(--danger) 20%, transparent);
    color: var(--danger);
    border-color: var(--danger);
}

.info-message {
    background: color-mix(in srgb, var(--gold-1) 20%, transparent);
    color: var(--gold-1);
    border-color: var(--gold-1);
}

@keyframes slideInDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}
