/* 
 * -------------------------------------------------------------------
 *  1. ОСНОВНОЙ МАКЕТ И ЗАГОЛОВОК
 * -------------------------------------------------------------------
 */

 .playlists-page-container {
    max-width: 1280px;
    margin: 32px auto;
    padding: 24px 32px 48px;
    background-color: #181818;
    border-radius: 12px;
}

.playlists-page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.playlists-page-title {
    font-size: 28px;
    font-weight: 700;
    margin: 0;
}

.playlists-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
}

.playlists-controls .controls-right {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    margin-left: 0;
}

.playlists-controls-wrapper {
    width: 100%;
    margin-bottom: 24px;
    display: flex;
    justify-content: flex-end;
}

.playlists-controls-wrapper > #playlists-filters-form {
    background-color: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
    max-width: 980px;
    width: 100%;
}

.filter-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: #aaa;
    font-size: 14px;
    user-select: none;
}

.filter-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #3ea6ff;
}

.controls-right {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.control-label {
    color: #aaa;
    font-size: 14px;
    margin-right: 6px;
}

.control-select {
    background-color: #1a1a1a;
    border: 1px solid #3a3a3a;
    border-radius: 14px;
    padding: 10px 14px;
    color: #f1f1f1;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
    appearance: none;
    -webkit-appearance: none;
    padding-right: 38px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23f1f1f1' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

.control-select:focus {
    border-color: #3ea6ff;
}

.control-select:hover {
    border-color: #555;
}

.nonempty-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    background-color: #272727;
    border: 1px solid #3f3f3f;
    border-radius: 20px;
    color: #f1f1f1;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 0.2s, border-color 0.2s, transform 0.05s ease;
}

.nonempty-toggle-btn:hover {
    background-color: #3f3f3f;
    border-color: #555;
}

.nonempty-toggle-btn:active {
    transform: translateY(1px);
}

.nonempty-toggle-btn.active {
    background-color: #3ea6ff;
    border-color: #3ea6ff;
    color: #0f0f0f;
}

/* -------------------------------------------------------------------
 *  КАСТОМНЫЙ DROPDOWN (под стилистику subscriptions)
 * ------------------------------------------------------------------- */
.sort-menu-container {
    position: relative;
}

.sort-menu-details {
    margin: 0;
}

.sort-menu-details > summary {
    list-style: none;
}

.sort-menu-details > summary::-webkit-details-marker {
    display: none;
}

.sort-menu-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border-radius: 18px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: background-color 0.2s;
    border: none;
    cursor: pointer;
    background-color: rgba(255, 255, 255, 0.1);
    color: #f1f1f1;
}

.sort-menu-details[open] .sort-menu-button {
    background-color: rgba(255, 255, 255, 0.18);
}

.sort-arrow-icon {
    width: 16px;
    height: 16px;
    filter: invert(1);
    transition: transform 0.2s;
}

.sort-menu-details[open] .sort-arrow-icon {
    transform: rotate(180deg);
}

.sort-menu-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    background-color: #282828;
    border-radius: 12px;
    padding: 8px 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    z-index: 20;
    min-width: 220px;
}

.sort-menu-details[open] .sort-menu-dropdown {
    display: block;
}

.sort-option {
    display: block;
    padding: 12px 16px;
    color: #f1f1f1;
    text-decoration: none;
    font-size: 14px;
    line-height: 1.4;
}

.sort-option:hover {
    background-color: #3f3f3f;
}

.view-toggle,
.shelves-layout-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0;
    background-color: #2a2a2a;
    border: 1px solid #3b3b3b;
    border-radius: 16px;
    padding: 4px;
}

.view-toggle-btn {
    border: none;
    border-radius: 12px;
    padding: 10px 14px;
    color: #e6e6e6;
    background-color: transparent;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: background-color 0.2s, color 0.2s;
    white-space: nowrap;
}

.view-toggle-btn.active {
    background-color: #3ea6ff;
    color: #0f0f0f;
}

.view-toggle-btn:hover {
    background-color: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.view-toggle-btn:focus-visible {
    outline: 2px solid rgba(62, 166, 255, 0.6);
    outline-offset: 2px;
}

.playlists-mobile-toolbar,
.playlists-header-actions--mobile {
    display: none;
}

.nonempty-toggle-btn--desktop {
    display: inline-flex;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.create-playlist-button,
.delete-playlist-main-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 16px;
    background-color: #272727;
    border: 1px solid #3f3f3f;
    border-radius: 20px;
    color: #f1f1f1;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 0.2s, border-color 0.2s;
}

.apply-filters-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    background-color: #272727;
    border: 1px solid #3f3f3f;
    border-radius: 20px;
    color: #f1f1f1;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 0.2s, border-color 0.2s;
}

.apply-filters-button:hover {
    background-color: #3f3f3f;
    border-color: #555;
}

.create-playlist-button:hover,
.delete-playlist-main-button:hover {
    background-color: #3f3f3f;
    border-color: #555;
}

.create-playlist-button img,
.delete-playlist-main-button img {
    width: 20px;
    height: 20px;
    filter: invert(1);
}

/* 
 * -------------------------------------------------------------------
 *  2. СЕТКА ПЛЕЙЛИСТОВ
 * -------------------------------------------------------------------
 */

.playlists-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}

.playlists-grid.is-shelves {
    display: block;
}

.playlists-grid.is-shelves-one .playlist-shelf-row {
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-x: visible;
    padding: 0;
}

.playlists-grid.is-shelves-two .playlist-shelf-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    padding: 0;
}

.playlist-shelf-row {
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-x: visible;
    padding: 0;
    scroll-snap-type: none;
}

.playlist-shelf-row .playlist-card-link {
    flex: 0 0 auto;
    width: 100%;
}

.playlists-grid.is-shelves-two .playlist-shelf-row .playlist-card-link {
    flex: 0 0 auto;
    width: 100%;
}

.playlists-grid.is-shelves .playlist-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 16px;
    background-color: #171717;
    border: 1px solid #242424;
}

.playlists-grid.is-shelves .playlist-thumbnail-container {
    width: 220px;
    flex-shrink: 0;
    margin-bottom: 0;
    border-radius: 10px;
}

.playlists-grid.is-shelves-two .playlists-grid.is-shelves .playlist-thumbnail-container {
    width: 200px;
}

.playlists-grid.is-shelves .playlist-info h3 {
    font-size: 16px;
    margin: 0;
}

.playlists-grid.is-shelves .playlist-info {
    margin-top: 0;
}

.playlists-grid.is-shelves .playlist-info h3 {
    margin-bottom: 6px;
}

.playlists-empty-filtered {
    text-align: center;
    color: #aaa;
    padding: 40px 16px;
    border: 2px dashed #3f3f3f;
    border-radius: 12px;
    width: 100%;
    grid-column: 1 / -1;
}

.playlist-card-link {
    text-decoration: none;
    color: inherit;
    display: block; 
}

.view-playlist-text {
    display: inline-block;
    margin-top: 10px;
    font-size: 13px;
    font-weight: 500;
    color: #aaa; 
    text-decoration: none;
}

.playlist-card {
    background-color: #121212;
    border-radius: 12px;
    padding: 16px;
    transition: background-color 0.2s;
}

.playlist-card:hover {
    background-color: #272727;
}

.playlist-thumbnail-link {
    display: block;
    margin-bottom: 12px;
}

.playlist-thumbnail-container {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 8px;
    overflow: hidden;
    background-color: #000;
}

.playlist-thumbnail-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.playlist-thumbnail-placeholder {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    background-color: #3f3f3f;
}

.playlist-thumbnail-placeholder img {
    width: auto;
    height: 50%;
    max-width: 80%;
    opacity: 0.6;
    filter: invert(1);
}

.playlist-overlay {
    position: absolute;
    bottom: 0;
    right: 0;
    left: 0;
    height: 40%;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
    display: flex;
    justify-content: flex-end;
    align-items: flex-end;
    padding: 8px;
    color: #fff;
    font-weight: 500;
    font-size: 14px;
}

.playlist-overlay img {
    width: 20px;
    height: 20px;
    margin-right: 6px;
    filter: invert(1);
}

.playlist-info {
    margin-top: 16px;
}

.playlist-info h3 {
    font-size: 18px;
    font-weight: 500;
    margin: 0 0 8px 0;
    color: #f1f1f1;
    line-height: 1.4; 
}

.playlist-info .playlist-meta {
    font-size: 13px;
    color: #aaa;
    margin: 0 0 4px 0;
}

.playlist-info .view-playlist-link {
    display: inline-block;
    margin-top: 8px;
    font-size: 13px;
    font-weight: 500;
    color: #3ea6ff;
    text-decoration: none;
}

/* 
 * -------------------------------------------------------------------
 *  3. ЗАГЛУШКИ
 * -------------------------------------------------------------------
 */
 .playlist-deleted-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    width: 100%;
    box-sizing: border-box;
    padding: 24px;
    min-height: 270px;
    border: 2px dashed #3f3f3f;
    border-radius: 12px; 
    background-color: #202020; 
    color: #aaa;
    font-size: 14px;
    font-weight: 500;
}
/* 
 * ===================================================================
 *  4. СТИЛИ ДЛЯ МОДАЛЬНЫХ ОКОН
 * ===================================================================
 */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 5000;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
}

.modal-content {
    background-color: #212121;
    padding: 24px 32px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    width: 90%;
    max-width: 480px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.5);
    transform: scale(0.95);
    transition: transform 0.2s ease;
    max-height: min(85vh, 720px);
    overflow: auto;
}

.modal-overlay.active .modal-content {
    transform: scale(1);
}

.modal-content h2 {
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 28px 0;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 32px;
}

.modal-button {
    border: none;
    border-radius: 20px;
    padding: 10px 24px;
    font-weight: 500;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s;
}

.modal-button.cancel {
    background-color: rgba(255, 255, 255, 0.1);
    color: #f1f1f1;
}

.modal-button.cancel:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    font-size: 14px;
    color: #aaa;
    margin-bottom: 12px;
}

.form-group input[type="text"],
.form-group textarea {
    box-sizing: border-box;
    width: 100%;
    padding: 14px 16px;
    background-color: #121212;
    border: 1px solid #3f3f3f;
    border-radius: 8px;
    color: #f1f1f1;
    font-size: 16px;
    outline: none;
    font-family: inherit;
    transition: border-color 0.2s;
}

.form-group textarea {
    resize: none;
    overflow: hidden;
}

.form-group input[type="text"]:focus,
.form-group textarea:focus {
    border-color: #3ea6ff;
}

.input-wrapper {
    position: relative;
}
.form-group input[type="text"].input-error {
    border-color: #ff5252;
}
.form-group input[type="text"].input-error:focus {
    border-color: #ff5252;
}
.input-error-message {
    position: absolute;
    bottom: -20px; 
    left: 5px;
    color: #ff8a80;
    font-size: 13px;
    text-align: left;
    opacity: 0;
    transform: translateY(-5px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
}
.input-error-message.visible {
    opacity: 1;
    transform: translateY(0);
}

#char-counter-container {
    text-align: right;
    margin-top: 8px;
}

#char-counter {
    font-size: 13px;
    color: #aaa;
}

.visibility-options {
    background-color: #121212;
    border: 1px solid #3f3f3f;
    border-radius: 8px;
    padding: 6px;
}

.visibility-options label {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    margin: 0;
    cursor: pointer;
    border-radius: 6px;
    transition: background-color 0.2s;
}

.visibility-options label:hover {
    background-color: #272727;
}

.visibility-options input[type="radio"] {
    display: none;
}

.visibility-options .visibility-icon {
    width: 20px;
    height: 20px;
    filter: invert(1);
    opacity: 0.7;
    transition: opacity 0.2s;
}

.visibility-options span {
    color: #aaa;
    font-size: 16px;
    transition: color 0.2s;
}

.visibility-options input[type="radio"]:checked + .visibility-icon {
    opacity: 1;
}

.visibility-options input[type="radio"]:checked + .visibility-icon + span {
    color: #fff;
    font-weight: 500;
}

.modal-button.create {
    background-color: #3ea6ff;
    color: #0f0f0f;
}

.modal-button.create:hover {
    background-color: #65b8ff;
}

.modal-content .modal-description {
    color: #aaa;
    font-size: 14px;
    margin: -16px 0 24px 0;
}

.playlist-delete-list {
    max-height: 250px;
    overflow-y: auto;
    margin: 0 -10px;
    padding: 0 10px;
}

.playlist-delete-item {
    padding: 12px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.2s;
}

.playlist-delete-item:hover {
    background-color: #3f3f3f;
}

.playlist-delete-item.selected {
    background-color: #3ea6ff;
    color: #0f0f0f;
}

.modal-button.delete {
    background-color: #c62828;
    color: #fff;
}

.modal-button.delete:hover {
    background-color: #e53935;
}

.modal-button.delete:disabled {
    background-color: rgba(255, 255, 255, 0.1);
    color: #717171;
    cursor: not-allowed;
}

.modal-content.confirmation {
    max-width: 420px;
    padding: 24px;
    text-align: center;
}

.modal-content.confirmation h3 {
    font-size: 20px;
    margin: 0 0 8px 0;
}

.modal-content.confirmation p {
    color: #aaa;
    margin: 0 0 24px 0;
    line-height: 1.5;
}

.modal-content.confirmation .modal-footer {
    justify-content: center;
}

.modal-button.confirm-cancel {
    background-color: #3f3f3f;
    color: #f1f1f1;
}

.modal-button.confirm-cancel:hover {
    background-color: #555;
}

.modal-button.confirm-ok {
    background-color: #3ea6ff;
    color: #0f0f0f;
}

.modal-button.confirm-ok:hover {
    background-color: #d9d9d9;
}

/* 
 * ===================================================================
 *  5. ВСПЛЫВАЮЩИЕ УВЕДОМЛЕНИЯ 
 * ===================================================================
 */

.toast-notification {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(150%);
    padding: 12px 24px;
    background-color: #282828;
    border: 1px solid #3f3f3f;
    color: #f1f1f1;
    border-radius: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    z-index: 9999;
    opacity: 0;
    transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.5s ease;
}

.toast-notification.visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast-notification.error {
    background-color: #c62828;
    border-color: #e53935;
    color: #fff;
}

/* 
 * ===================================================================
 *  6. АДАПТИВНОСТЬ 
 * ===================================================================
 */

@media (max-width: 600px) {
    .playlists-page-container {
        padding: 16px;
        margin: 16px 8px;
    }
    .playlists-page-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    .playlists-grid {
        grid-template-columns: 1fr;
    }
    .modal-content {
        padding: 24px 16px;
    }
    .modal-footer {
        flex-direction: column-reverse;
        gap: 12px;
    }
    .modal-button {
        width: 100%;
        box-sizing: border-box;
    }
    .toast-notification {
        width: calc(100% - 32px);
        bottom: 16px;
    }
}