/* ============================= */
/* 🌐 Base Styles */
/* ============================= */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 16px;
    font-family: 'IRANSans', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f3f4f6;
    display: flex;
    justify-content: center;
    min-height: 100vh;
    direction: rtl;
}

/* ============================= */
/* 🧱 Container & Typography */
/* ============================= */
.container {
    background-color: #fff;
    max-width: 640px;
    width: 100%;
    padding: 24px 20px;
    border-radius: 24px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    gap: 24px;
    margin: auto;
}

h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: #1e293b;
    text-align: center;
    margin-bottom: 16px;
}

@media (min-width: 640px) {
    h1 {
        font-size: 2.25rem;
    }
}

/* ============================= */
/* 🎯 Button */
/* ============================= */
button#openModal {
    background-color: #2563eb;
    color: white;
    border: none;
    border-radius: 16px;
    padding: 12px 0;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
    width: 100%;
    max-width: 280px;
    margin: 0 auto;
    display: block;
}

button#openModal:hover {
    background-color: #1d4ed8;
}

/* ============================= */
/* 🎵 Audio Player & Info */
/* ============================= */
audio#player {
    width: 100%;
    border-radius: 12px;
    outline: none;
}

#track-info {
    text-align: center;
    color: #475569;
    margin-top: 12px;
}

#track-title,
#track-artist {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0;
}

#track-title {
    font-weight: 600;
    font-size: 1.125rem;
}

#track-artist {
    font-size: 0.875rem;
    color: #64748b;
    margin-top: 2px;
}

@media (min-width: 640px) {
    #track-title {
        font-size: 1.25rem;
    }

    #track-artist {
        font-size: 1rem;
    }
}

/* ============================= */
/* 📜 Playlist */
/* ============================= */
#playlist-container {
    margin-top: 16px;
    max-height: 260px;
    overflow-y: auto;
    border-top: 2px solid #e2e8f0;
    padding-top: 12px;
}

#playlist-container h3 {
    font-weight: 700;
    text-align: center;
    color: #1e293b;
    margin-bottom: 12px;
    font-size: 1rem;
}

@media (min-width: 640px) {
    #playlist-container {
        max-height: 380px;
    }

    #playlist-container h3 {
        font-size: 1.125rem;
    }
}

#playlist {
    list-style: none;
    padding: 0;
    margin: 0;
    text-align: center;
}

#playlist li {
    padding: 10px 16px;
    border-radius: 12px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    font-size: 0.875rem;
    color: #475569;
    user-select: none;
    word-break: break-word;
}

#playlist li:hover {
    background-color: #e2e8f0;
}

#playlist li.active {
    background-color: #bfdbfe;
    font-weight: 600;
    color: #1e40af;
}

/* ============================= */
/* 🪟 Modal */
/* ============================= */
#tagModal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    animation: fadeIn 0.3s ease forwards;
}

#tagModal .modal-content {
    background: white;
    padding: 2rem;
    border-radius: 16px;
    max-width: 500px;
    width: 90%;
    animation: scaleIn 0.3s ease forwards;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    text-align: center;
    direction: rtl;
}

#tagModal h2 {
    margin-bottom: 1.25rem;
    font-weight: 700;
    font-size: 1.25rem;
    color: #1e293b;
    text-align: center;
}

#tagsContainer {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.tag-card {
    padding: 12px;
    border: 1.5px solid #cbd5e1;
    border-radius: 16px;
    text-align: center;
    cursor: pointer;
    user-select: none;
    transition: all 0.3s ease;
    color: #475569;
    font-weight: 500;
    background-color: white;
}

.tag-card:hover {
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.4);
}

.tag-card.selected {
    background-color: #3b82f6;
    border-color: #2563eb;
    color: white;
    font-weight: 700;
}

.modal-buttons {
    display: flex;
    justify-content: space-between;
    margin-top: 1rem;
    gap: 1rem;
}

.modal-buttons button {
    flex: 1;
    padding: 0.7rem 1rem;
    border: none;
    border-radius: 12px;
    background-color: #009688;
    color: white;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s ease;
}

.modal-buttons button:hover {
    background-color: #00796b;
}

.modal-buttons button#applyTags {
    background-color: #2563eb;
}

.modal-buttons button#applyTags:hover {
    background-color: #1d4ed8;
}

/* ============================= */
/* 📱 Mobile Responsive */
/* ============================= */
@media (max-width: 480px) {
    body {
        padding: 12px 8px;
    }

    .container {
        padding: 16px 12px;
    }

    button#openModal {
        max-width: 100%;
        font-size: 0.95rem;
        padding: 10px 0;
    }

    #track-title {
        font-size: 1rem;
    }

    #track-artist {
        font-size: 0.75rem;
    }

    #tagsContainer {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
        gap: 12px;
    }

    #playlist-container {
        max-height: 240px;
    }

    #playlist li {
        font-size: 0.8rem;
        padding: 8px 12px;
    }

    audio#player {
        height: 40px;
    }

    .plyr {
        font-size: 14px !important;
    }

    .plyr__volume {
        display: none;
    }
}

/* ============================= */
/* 🎞️ Animations */
/* ============================= */
@keyframes fadeIn {
    from {
        opacity: 0
    }

    to {
        opacity: 1
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

button,
input {
    font-family: inherit;
}