/* Settings Change Dialog Modal Styles */

/* Dialog Element Styling */
.settings-change-modal {
    border: none;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    padding: 0;
    max-width: 450px;
    background: white;
    animation: modalSlideIn 0.3s ease-out;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    z-index: 999999;
    position: fixed;
}

.settings-change-modal[open] {
    display: flex;
    flex-direction: column;
}

/* Ensure modal is visible */
.settings-change-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    margin: 0 !important;
}

/* Dialog Backdrop (Overlay) */
.settings-change-modal::backdrop {
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.3s ease-out;
    z-index: 999998;
}

@keyframes modalSlideIn {
    from {
        transform: scale(0.95) translateY(-20px);
        opacity: 0;
    }
    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Modal Header */
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 25px 25px 15px;
    border-bottom: 2px solid #f0f0f0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px 12px 0 0;
}

.modal-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s ease;
    opacity: 0.8;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
    opacity: 1;
    transform: scale(1.1);
}

.modal-close:active {
    transform: scale(0.95);
}

/* Modal Body */
.modal-body {
    padding: 25px 25px 20px;
    color: #333;
    line-height: 1.6;
    font-size: 15px;
}

.modal-body p {
    margin: 0 0 12px 0;
}

.modal-body p:first-child {
    font-weight: 500;
    color: #2d3748;
    margin-bottom: 15px;
}

.modal-body strong {
    color: #667eea;
    font-weight: 600;
}

.modal-body small {
    color: #999;
    display: block;
}

/* Modal Buttons */
.modal-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding: 20px 25px;
    border-top: 1px solid #f0f0f0;
    background: #f9f9f9;
    border-radius: 0 0 12px 12px;
}

.modal-btn {
    padding: 12px 20px;
    border: 2px solid;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    white-space: nowrap;
}

/* Reload Button */
.modal-btn-reload {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.modal-btn-reload:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
    background: linear-gradient(135deg, #7a8ff8 0%, #8a5bb8 100%);
}

.modal-btn-reload:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

/* Cancel Button */
.modal-btn-cancel {
    background: #f0f0f0;
    color: #666;
    border-color: #ddd;
    transition: all 0.3s ease;
}

.modal-btn-cancel:hover {
    background: #e8e8e8;
    border-color: #bbb;
    transform: translateY(-2px);
}

.modal-btn-cancel:active {
    transform: translateY(0);
}

/* Animation für Dialog Closing */
.settings-change-modal[open] {
    animation: modalSlideIn 0.3s ease-out;
}

/* Responsive Design */
@media (max-width: 600px) {
    .settings-change-modal {
        max-width: 90vw;
        max-height: 90vh;
    }
    
    .modal-header h2 {
        font-size: 18px;
    }
    
    .modal-body {
        padding: 20px;
        font-size: 14px;
    }
    
    .modal-buttons {
        grid-template-columns: 1fr;
        gap: 10px;
        padding: 15px 20px;
    }
    
    .modal-btn {
        padding: 14px 16px;
        font-size: 13px;
    }
}

/* Fallback für Browser ohne ::backdrop Support */
.settings-change-modal[open] ~ * {
    pointer-events: none;
}

/* Stelle sicher dass modal über allen Elementen liegt */
dialog {
    z-index: 999999;
}

dialog::backdrop {
    z-index: 999998;
}

/* Mobile - Stack buttons vertically */
@media (max-width: 400px) {
    .modal-header {
        padding: 20px 15px 10px;
    }
    
    .modal-body {
        padding: 15px;
    }
    
    .modal-buttons {
        padding: 12px 15px;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .settings-change-modal {
        background: #2d3748;
        color: #e2e8f0;
    }
    
    .modal-header {
        border-bottom-color: #4a5568;
    }
    
    .modal-body {
        color: #e2e8f0;
    }
    
    .modal-body p:first-child {
        color: #e2e8f0;
    }
    
    .modal-body small {
        color: #a0aec0;
    }
    
    .modal-buttons {
        border-top-color: #4a5568;
        background: #1a202c;
    }
    
    .modal-btn-cancel {
        background: #4a5568;
        color: #e2e8f0;
        border-color: #718096;
    }
    
    .modal-btn-cancel:hover {
        background: #5a6a78;
        border-color: #8a9ab0;
    }
}

/* Accessibility - Focus Styles */
.modal-btn:focus,
.modal-close:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* Disable button during reload */
.modal-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* Print Styles - Don't print dialog */
@media print {
    .settings-change-modal {
        display: none !important;
    }
    
    .settings-change-modal::backdrop {
        display: none !important;
    }
}
