/* Стили для модальных окон */

#modal-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    pointer-events: none;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: auto;
    z-index: 10000;
}

.modal-overlay.modal-show {
    opacity: 1;
}

.modal-overlay.modal-hide {
    opacity: 0;
}

.modal-box {
    background: white;
    border-radius: 12px;
    padding: 30px;
    min-width: 320px;
    max-width: 500px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    transform: scale(0.9) translateY(-20px);
    transition: transform 0.3s ease;
    position: relative;
}

.modal-show .modal-box {
    transform: scale(1) translateY(0);
}

.modal-hide .modal-box {
    transform: scale(0.9) translateY(-20px);
}

.modal-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 20px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-icon svg {
    width: 32px;
    height: 32px;
}

/* Стили для типа INFO */
.modal-info .modal-icon {
    background-color: #e3f2fd;
    color: #2196f3;
}

.modal-info .modal-title {
    color: #2196f3;
}

.modal-info .modal-btn-primary {
    background-color: #2196f3;
    border-color: #2196f3;
}

.modal-info .modal-btn-primary:hover {
    background-color: #1976d2;
    border-color: #1976d2;
}

/* Стили для типа WARNING */
.modal-warning .modal-icon {
    background-color: #fff3e0;
    color: #ff9800;
}

.modal-warning .modal-title {
    color: #ff9800;
}

.modal-warning .modal-btn-primary {
    background-color: #ff9800;
    border-color: #ff9800;
}

.modal-warning .modal-btn-primary:hover {
    background-color: #f57c00;
    border-color: #f57c00;
}

/* Стили для типа ERROR */
.modal-error .modal-icon {
    background-color: #ffebee;
    color: #f44336;
}

.modal-error .modal-title {
    color: #f44336;
}

.modal-error .modal-btn-primary {
    background-color: #f44336;
    border-color: #f44336;
}

.modal-error .modal-btn-primary:hover {
    background-color: #d32f2f;
    border-color: #d32f2f;
}

.modal-title {
    font-size: 22px;
    font-weight: 600;
    text-align: center;
    margin-bottom: 15px;
}

.modal-message {
    font-size: 16px;
    color: #666;
    text-align: center;
    margin-bottom: 25px;
    line-height: 1.5;
}

.modal-input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 15px;
    margin-bottom: 20px;
    outline: none;
    transition: border-color 0.2s ease;
    font-family: inherit;
}

.modal-input:focus {
    border-color: #2196f3;
}

.modal-info .modal-input:focus {
    border-color: #2196f3;
}

.modal-warning .modal-input:focus {
    border-color: #ff9800;
}

.modal-error .modal-input:focus {
    border-color: #f44336;
}

.modal-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 20px;
}

.modal-btn,
.modal-button {
    padding: 10px 24px;
    border: 2px solid transparent;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 100px;
    outline: none;
}

.modal-btn-primary {
    color: white;
}

.modal-btn-secondary {
    background-color: white;
    color: #666;
    border-color: #ddd;
}

.modal-btn-secondary:hover {
    background-color: #f5f5f5;
    border-color: #ccc;
}

.modal-btn:active {
    transform: scale(0.97);
}

/* Адаптивность */
@media (max-width: 600px) {
    .modal-box {
        min-width: 280px;
        max-width: 90%;
        padding: 25px 20px;
    }

    .modal-title {
        font-size: 20px;
    }

    .modal-message {
        font-size: 14px;
    }

    .modal-buttons {
        flex-direction: column;
    }

    .modal-btn {
        width: 100%;
    }
}

/* Анимация пульсации для иконки */
@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

.modal-show .modal-icon {
    animation: pulse 0.6s ease-in-out;
}

/* ============================================
   СТИЛИ ДЛЯ ДИНАМИЧЕСКИХ МОДАЛЬНЫХ ОКОН
   ============================================ */

.modal-dynamic-overlay {
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

.modal-box.modal-dynamic {
    min-width: 500px;
    max-width: 90vw;
    max-height: 90vh;
    padding: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-dynamic-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #e0e0e0;
    flex-shrink: 0;
}

.modal-dynamic-title {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #333;
}

.modal-dynamic-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #666;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
    line-height: 1;
}

.modal-dynamic-close:hover {
    background: #f0f0f0;
    color: #333;
}

.modal-dynamic-body {
    padding: 24px;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
}

/* Индикатор загрузки */
.modal-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
}

.modal-loading .spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #f0f0f0;
    border-top-color: #2196f3;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.modal-loading p {
    margin-top: 16px;
    color: #666;
    font-size: 15px;
}

/* Ошибка загрузки */
.modal-dynamic-body .modal-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.modal-dynamic-body .modal-error p {
    margin: 16px 0 24px;
    color: #666;
    font-size: 15px;
}

/* Адаптивность для динамических окон */
@media (max-width: 768px) {
    .modal-box.modal-dynamic {
        min-width: 320px;
        max-width: 95vw;
        max-height: 95vh;
    }

    .modal-dynamic-header {
        padding: 16px 20px;
    }

    .modal-dynamic-title {
        font-size: 18px;
    }

    .modal-dynamic-body {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .modal-box.modal-dynamic {
        min-width: 300px;
        max-width: 100vw;
        max-height: 100vh;
        border-radius: 0;
    }

    .modal-dynamic-header {
        padding: 12px 16px;
    }

    .modal-dynamic-body {
        padding: 16px;
    }
}

/* Стили для toast-уведомлений (WebSocket) */
.toast-notifications-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 10001;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

.toast-notification {
    background: white;
    border-radius: 8px;
    padding: 16px 20px;
    min-width: 320px;
    max-width: 400px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    transform: translateX(calc(100% + 40px));
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: auto;
    cursor: pointer;
}

.toast-notification.toast-show {
    transform: translateX(0);
    opacity: 1;
}

.toast-notification.toast-hide {
    transform: translateX(calc(100% + 40px));
    opacity: 0;
}

.toast-notification-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toast-notification-icon.info {
    color: #3b82f6;
}

.toast-notification-icon.success {
    color: #10b981;
}

.toast-notification-icon.warning {
    color: #f59e0b;
}

.toast-notification-icon.error {
    color: #ef4444;
}

.toast-notification-content {
    flex: 1;
    min-width: 0;
}

.toast-notification-title {
    font-weight: 600;
    font-size: 14px;
    color: #111827;
    margin-bottom: 4px;
}

.toast-notification-message {
    font-size: 13px;
    color: #6b7280;
    line-height: 1.4;
    word-break: break-word;
}

/* Стиль для важных уведомлений (отмена отправки и т.п.) */
.toast-notification-message .toast-important {
    font-weight: 600;
    font-size: 15px;
    color: #374151;
}

.toast-notification-close {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
    cursor: pointer;
    transition: color 0.2s;
}

.toast-notification-close:hover {
    color: #4b5563;
}

.toast-notification:hover {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(0, 0, 0, 0.05);
}

@media (max-width: 768px) {
    .toast-notifications-container {
        left: 20px;
        right: 20px;
    }

    .toast-notification {
        min-width: 0;
        max-width: 100%;
    }
}
