/*
 * MODALS - Модальные окна в glassmorphism стиле
 */

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

.modal.active {
    display: flex;
    opacity: 1;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
}

.modal-content {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    padding: 35px;
    width: 90%;
    max-width: 580px;
    max-height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    transform: scale(0.9) translateY(20px);
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
    color: white;
    box-shadow:
        0 25px 80px rgba(0, 0, 0, 0.8),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    box-sizing: border-box;
}

.modal-content * {
    box-sizing: border-box;
}

.modal.active .modal-content {
    transform: scale(1) translateY(0);
    opacity: 1;
}

.modal-content h2 {
    margin-bottom: 25px;
    font-size: 1.85rem;
    font-weight: 700;
    text-align: center;
    padding-bottom: 20px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
    background: linear-gradient(135deg, rgba(123, 97, 255, 0.2), rgba(99, 77, 230, 0.1));
    margin: -35px -35px 25px -35px;
    padding: 25px 35px 20px 35px;
    border-radius: 20px 20px 0 0;
}

.modal-description {
    margin-bottom: 28px;
    opacity: 0.9;
    font-size: 1rem;
    line-height: 1.7;
    text-align: center;
    padding: 18px 20px;
    background: linear-gradient(135deg, rgba(123, 97, 255, 0.15), rgba(99, 77, 230, 0.1));
    border-radius: 12px;
    border: 1px solid rgba(123, 97, 255, 0.3);
    box-shadow: 0 0 20px rgba(123, 97, 255, 0.1);
}

/* DJ Status */
.dj-status-warning {
    margin-bottom: 20px;
    padding: 15px 20px;
    background: rgba(255, 193, 7, 0.15);
    border: 2px solid rgba(255, 193, 7, 0.4);
    border-radius: 12px;
    color: #ffc107;
    font-weight: 600;
    text-align: center;
}

.dj-status-ok {
    margin-bottom: 20px;
    padding: 15px 20px;
    background: rgba(76, 175, 80, 0.15);
    border: 2px solid rgba(76, 175, 80, 0.4);
    border-radius: 12px;
    color: #4caf50;
    font-weight: 600;
    text-align: center;
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-round);
    width: 35px;
    height: 35px;
    font-size: 1.5rem;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.close-modal:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

/* Form styles */
.form-group {
    margin-bottom: 28px;
    position: relative;
}

.form-group label {
    display: block;
    margin-bottom: 12px;
    font-weight: 600;
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.95);
    letter-spacing: 0.3px;
}

.form-group small {
    display: block;
    margin-top: 10px;
    font-size: 0.9rem;
    opacity: 0.7;
    line-height: 1.5;
}

.field-hint {
    display: block;
    margin-top: 8px;
    font-size: 0.85rem;
    opacity: 0.7;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.7);
}

.field-hint svg {
    vertical-align: middle;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    max-width: 100%;
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.06);
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    color: white;
    font-family: var(--font-primary);
    font-size: 1.05rem;
    transition: all var(--transition-fast);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-sizing: border-box;
}

/* Стили для select */
.form-group select {
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23ffffff' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
    padding-right: 45px;
}

.form-group select option {
    background: rgba(30, 30, 40, 0.95);
    color: white;
    padding: 10px;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(123, 97, 255, 0.8);
    box-shadow:
        0 0 25px rgba(123, 97, 255, 0.5),
        inset 0 0 10px rgba(123, 97, 255, 0.1);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.checkbox-group input[type="checkbox"] {
    width: auto;
    min-width: 20px;
    height: 20px;
    margin: 0;
    cursor: pointer;
    accent-color: rgba(123, 97, 255, 1);
}

.checkbox-group label {
    margin: 0 !important;
    cursor: pointer;
    user-select: none;
}

.submit-button {
    width: 100%;
    padding: 18px 28px;
    margin-top: 15px;
    background: linear-gradient(135deg, rgba(123, 97, 255, 1), rgba(99, 77, 230, 1));
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    color: white;
    font-family: var(--font-primary);
    font-weight: 700;
    font-size: 1.15rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    backdrop-filter: blur(10px);
    box-shadow:
        0 8px 25px rgba(123, 97, 255, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.submit-button:hover {
    background: linear-gradient(135deg, rgba(123, 97, 255, 1), rgba(80, 60, 220, 1));
    transform: translateY(-3px);
    box-shadow:
        0 12px 35px rgba(123, 97, 255, 0.7),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.submit-button:active {
    transform: translateY(0);
}

.submit-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Rules button */
.rules-button {
    width: 100%;
    padding: 14px 20px;
    margin-bottom: 28px;
    background: rgba(255, 255, 255, 0.06);
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    color: white;
    font-family: var(--font-primary);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.rules-button:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

/* Rules content */
.rules-content {
    margin-bottom: var(--spacing-md);
    line-height: 1.6;
}

.rules-content ul,
.rules-content ol {
    padding-left: 25px;
    margin: var(--spacing-md) 0;
}

.rules-content li {
    margin-bottom: 8px;
}

.warning-box {
    background: rgba(255, 193, 7, 0.15);
    border-left: 3px solid #ffc107;
    padding: var(--spacing-md);
    margin: var(--spacing-md) 0;
    border-radius: var(--radius-sm);
}

.warning-box strong {
    display: block;
    margin-bottom: 8px;
    color: #ffc107;
}

.warning-box ul {
    margin-top: 8px;
}

/* Autocomplete dropdown */
.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 300px;
    overflow-y: auto;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-top: none;
    border-radius: 0 0 12px 12px;
    z-index: 100;
    margin-top: -2px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.autocomplete-item {
    padding: 14px 18px;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    transition: background var(--transition-fast);
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover {
    background: rgba(123, 97, 255, 0.2);
}

.autocomplete-item-title {
    font-weight: 600;
    margin-bottom: 5px;
    font-size: 1rem;
}

.autocomplete-item-artist {
    font-size: 0.9rem;
    opacity: 0.7;
}

.autocomplete-item-duration {
    font-size: 0.85rem;
    opacity: 0.5;
    margin-top: 4px;
}

.autocomplete-loading,
.autocomplete-empty {
    padding: 14px 18px;
    text-align: center;
    opacity: 0.7;
    font-size: 0.95rem;
}

.autocomplete-dropdown::-webkit-scrollbar {
    width: 8px;
}

.autocomplete-dropdown::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 0 0 12px 0;
}

.autocomplete-dropdown::-webkit-scrollbar-thumb {
    background: rgba(123, 97, 255, 0.5);
    border-radius: 4px;
}

.autocomplete-dropdown::-webkit-scrollbar-thumb:hover {
    background: rgba(123, 97, 255, 0.7);
}

/* History list */
.history-list {
    overflow-y: auto;
}

.history-item {
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    margin-bottom: var(--spacing-sm);
    transition: background var(--transition-fast);
}

.history-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.history-item-title {
    font-weight: 600;
    margin-bottom: 4px;
}

.history-item-artist {
    font-size: 0.9rem;
    opacity: 0.7;
}

.history-item-time {
    font-size: 0.8rem;
    opacity: 0.5;
    margin-top: 4px;
}

/* Lyrics (текст песни) */
.lyrics-info {
    margin-bottom: var(--spacing-md);
    padding-bottom: var(--spacing-md);
    border-bottom: 1px solid var(--glass-border);
}

.lyrics-track-info {
    display: flex;
    gap: 15px;
    align-items: center;
}

.lyrics-track-info img {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-sm);
    object-fit: cover;
}

.lyrics-title {
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 4px;
}

.lyrics-artist {
    font-size: 0.9rem;
    opacity: 0.7;
}

.lyrics-text {
    max-height: 400px;
    overflow-y: auto;
    padding: var(--spacing-md);
    background: rgba(0, 0, 0, 0.3);
    border-radius: var(--radius-sm);
    line-height: 1.8;
    white-space: pre-wrap;
    font-size: 0.95rem;
}

.lyrics-text p {
    margin: 0;
}

.lyrics-text.loading {
    text-align: center;
    opacity: 0.7;
    font-style: italic;
}

.lyrics-text.empty {
    text-align: center;
    opacity: 0.5;
}

/* Modal info link (кнопка правил внизу формы) */
.modal-info-link {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
}

.info-link-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 8px;
}

.info-link-btn:hover {
    color: rgba(123, 97, 255, 1);
    background: rgba(123, 97, 255, 0.1);
}

.info-link-btn svg {
    flex-shrink: 0;
}

/* Instruction modal styles */
.instruction-modal {
    max-width: 600px;
    max-height: 85vh;
}

.instruction-content {
    padding: 20px 0;
}

.instruction-step {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    border-left: 4px solid rgba(123, 97, 255, 1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.instruction-step:hover {
    transform: translateX(5px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.step-number {
    position: relative;
    flex-shrink: 0;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, rgba(123, 97, 255, 1), rgba(99, 77, 230, 1));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 1.5em;
}

.step-number svg {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0.2;
    width: 40px;
    height: 40px;
}

.step-number span {
    position: relative;
    z-index: 1;
}

.step-content {
    flex: 1;
}

.step-content h4 {
    margin: 0 0 10px 0;
    font-size: 1.2em;
    color: white;
    font-weight: 700;
}

.step-content p {
    margin: 0 0 12px 0;
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.6;
}

.discord-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: #5865F2;
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.2s;
    margin-top: 8px;
}

.discord-link:hover {
    background: #4752C4;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(88, 101, 242, 0.4);
}

.discord-link svg {
    flex-shrink: 0;
}

.instruction-warning {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), rgba(217, 119, 6, 0.15));
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 12px;
    margin-top: 20px;
}

.instruction-warning svg {
    flex-shrink: 0;
    color: #f59e0b;
    margin-top: 2px;
}

.instruction-warning p {
    margin: 0;
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.6;
}

.instruction-warning strong {
    color: #f59e0b;
}

.instruction-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 20px;
}

.secondary-button {
    padding: 12px 24px;
    background: rgba(255, 255, 255, 0.06);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.secondary-button:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

/* Mobile adaptations */
@media screen and (max-width: 767px) {
    .instruction-modal {
        max-height: 90vh;
    }

    .instruction-step {
        flex-direction: column;
        gap: 15px;
    }

    .step-number {
        width: 50px;
        height: 50px;
        font-size: 1.3em;
    }

    .instruction-actions {
        flex-direction: column;
    }

    .secondary-button,
    .submit-button {
        width: 100%;
    }
}

/* ==================== TOAST NOTIFICATIONS ==================== */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 400px;
}

.toast {
    background: var(--glass-bg);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 16px 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    animation: slideIn 0.3s ease-out;
    transition: opacity 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast.success {
    border-left: 4px solid #4caf50;
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.15), rgba(56, 142, 60, 0.1));
}

.toast.error {
    border-left: 4px solid #f44336;
    background: linear-gradient(135deg, rgba(244, 67, 54, 0.15), rgba(211, 47, 47, 0.1));
}

.toast-title {
    font-weight: 700;
    font-size: 1rem;
    color: white;
    margin-bottom: 6px;
}

.toast-message {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.4;
}

/* Mobile */
@media screen and (max-width: 767px) {
    #toast-container {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
}

.lyrics-text::-webkit-scrollbar {
    width: 6px;
}

.lyrics-text::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

/* Toast notifications */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000; /* Поверх модалок */
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.toast {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 15px 20px;
    min-width: 250px;
    max-width: 350px;
    color: white;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease;
}

.toast.success {
    border-left: 3px solid #10b981;
}

.toast.error {
    border-left: 3px solid #ef4444;
}

.toast-title {
    font-weight: 700;
    margin-bottom: 4px;
}

.toast-message {
    font-size: 0.9rem;
    opacity: 0.9;
}

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

/* Responsive */
@media (max-width: 991px) {
    .modal-content {
        width: 95%;
        padding: 25px 20px;
        max-height: 90vh;
    }

    .modal-content h2 {
        font-size: 1.3rem;
        margin-bottom: 20px;
    }

    .close-modal {
        width: 32px;
        height: 32px;
        font-size: 1.3rem;
        top: 12px;
        right: 12px;
    }

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

    .form-group label {
        font-size: 0.9rem;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 16px; /* Предотвращает зум на iOS */
        padding: 12px 15px;
    }

    .submit-button {
        font-size: 0.95rem;
        padding: 14px 25px;
    }

    .modal-info-link {
        margin-top: 15px;
        padding-top: 15px;
    }

    .info-link-btn {
        font-size: 0.85rem;
        padding: 8px 15px;
    }

    /* Инструкции на мобильных */
    .instruction-step {
        flex-direction: column;
        gap: 12px;
        padding: 15px;
    }

    .step-number {
        width: 50px;
        height: 50px;
        font-size: 1.3rem;
    }

    .step-content h4 {
        font-size: 1.1rem;
    }

    .step-content p {
        font-size: 0.9rem;
    }

    .discord-link {
        font-size: 0.9rem;
        padding: 8px 14px;
    }

    .instruction-actions {
        flex-direction: column;
        gap: 10px;
    }

    .secondary-button,
    .instruction-actions .submit-button {
        width: 100%;
        padding: 12px 20px;
    }

    #toast-container {
        top: 10px;
        left: 10px;
        right: 10px;
        max-width: none;
    }

    .toast {
        padding: 12px 15px;
    }

    .toast-title {
        font-size: 0.95rem;
    }

    .toast-message {
        font-size: 0.85rem;
    }

    /* История и текст на мобильных */
    .history-item {
        padding: 12px;
    }

    .history-item-title {
        font-size: 0.95rem;
    }

    .history-item-artist {
        font-size: 0.85rem;
    }

    .lyrics-text {
        font-size: 0.9rem;
        line-height: 1.6;
    }
}

/* Для маленьких экранов */
@media (max-width: 480px) {
    .modal-content {
        width: 98%;
        padding: 20px 15px;
    }

    .modal-content h2 {
        font-size: 1.2rem;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 16px;
        padding: 10px 12px;
    }

    .submit-button {
        font-size: 0.9rem;
        padding: 12px 20px;
    }

    .step-number {
        width: 45px;
        height: 45px;
        font-size: 1.2rem;
    }

    .step-content h4 {
        font-size: 1rem;
    }

    .step-content p {
        font-size: 0.85rem;
    }
}

