/**
 * PalmServers - Zentrales Modal System Styles
 * 
 * Moderne, responsive und accessible Modal-Styles
 * @version 2.0.0
 */

/* Container für alle Modals */
.palm-modal-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    pointer-events: none;
}

/* Overlay/Backdrop */
.palm-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: all;
    z-index: 10000;
}

.palm-modal-overlay.active {
    opacity: 1;
}

/* Modal Container */
.palm-modal {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 90vw;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: scale(0.9) translateY(-20px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* Modal Größen */
.palm-modal-small {
    width: 400px;
}

.palm-modal-medium {
    width: 600px;
}

.palm-modal-large {
    width: 800px;
}

.palm-modal-xlarge {
    width: 1000px;
}

.palm-modal-fullscreen {
    width: 95vw;
    height: 95vh;
}

/* Header */
.palm-modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 24px 24px 16px 24px;
    border-bottom: 1px solid #e5e7eb;
    position: relative;
}

.palm-modal-icon {
    font-size: 28px;
    line-height: 1;
    flex-shrink: 0;
}

.palm-modal-title {
    flex: 1;
    font-size: 20px;
    font-weight: 600;
    color: #111827;
    margin: 0;
    line-height: 1.3;
}

.palm-modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    color: #6b7280;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.palm-modal-close:hover {
    background: #f3f4f6;
    color: #111827;
}

.palm-modal-close:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Body */
.palm-modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.palm-modal-message {
    font-size: 15px;
    line-height: 1.6;
    color: #374151;
    margin: 0;
}

.palm-modal-content {
    font-size: 15px;
    line-height: 1.6;
    color: #374151;
}

/* Footer */
.palm-modal-footer {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding: 16px 24px 24px 24px;
    border-top: 1px solid #e5e7eb;
}

/* Buttons */
.palm-modal-btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.palm-modal-btn:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.palm-modal-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Button Variants */
.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #f3f4f6;
    color: #374151;
}

.btn-secondary:hover:not(:disabled) {
    background: #e5e7eb;
}

.btn-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.btn-success:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

.btn-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
}

.btn-warning:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
}

/* Modal Types - Color Coding */
.palm-modal-success .palm-modal-header {
    background: transparent;
}

.palm-modal-success .palm-modal-icon {
    color: #10b981;
}

.palm-modal-error .palm-modal-header {
    background: linear-gradient(to right, #fef2f2, #fee2e2);
}

.palm-modal-error .palm-modal-icon {
    color: #ef4444;
}

.palm-modal-warning .palm-modal-header {
    background: transparent;
}

.palm-modal-warning .palm-modal-icon {
    color: #f59e0b;
}

.palm-modal-info .palm-modal-header {
    background: linear-gradient(to right, #eff6ff, #dbeafe);
}

.palm-modal-info .palm-modal-icon {
    color: #3b82f6;
}

/* Loading State */
.palm-modal-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 40px 20px;
}

.palm-modal-loading .spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e5e7eb;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.palm-modal-loading p {
    margin: 0;
    color: #6b7280;
    font-size: 14px;
}

/* Form Elements in Modal */
.palm-modal-body .form-group {
    margin-bottom: 20px;
}

.palm-modal-body .form-group:last-child {
    margin-bottom: 0;
}

.palm-modal-body label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #374151;
    font-size: 14px;
}

.palm-modal-body input,
.palm-modal-body select,
.palm-modal-body textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.2s;
}

.palm-modal-body input:focus,
.palm-modal-body select:focus,
.palm-modal-body textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.palm-modal-body textarea {
    resize: vertical;
    min-height: 100px;
}

/* Responsive */
@media (max-width: 768px) {
    .palm-modal-overlay {
        padding: 10px;
    }
    
    .palm-modal-small,
    .palm-modal-medium,
    .palm-modal-large,
    .palm-modal-xlarge {
        width: 100%;
        max-width: 100%;
    }
    
    .palm-modal-fullscreen {
        width: 100vw;
        height: 100vh;
        border-radius: 0;
    }
    
    .palm-modal-header {
        padding: 20px 20px 12px 20px;
    }
    
    .palm-modal-body {
        padding: 20px;
    }
    
    .palm-modal-footer {
        padding: 12px 20px 20px 20px;
        flex-direction: column;
    }
    
    .palm-modal-btn {
        width: 100%;
        justify-content: center;
    }
    
    .palm-modal-title {
        font-size: 18px;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .palm-modal {
        background: #1f2937;
    }
    
    .palm-modal-header {
        border-bottom-color: #374151;
    }
    
    .palm-modal-title {
        color: #f9fafb;
    }
    
    .palm-modal-message,
    .palm-modal-content {
        color: #d1d5db;
    }
    
    .palm-modal-footer {
        border-top-color: #374151;
    }
    
    .palm-modal-close {
        color: #9ca3af;
    }
    
    .palm-modal-close:hover {
        background: #374151;
        color: #f9fafb;
    }
    
    .btn-secondary {
        background: #374151;
        color: #d1d5db;
    }
    
    .btn-secondary:hover:not(:disabled) {
        background: #4b5563;
    }
    
    .palm-modal-body input,
    .palm-modal-body select,
    .palm-modal-body textarea {
        background: #374151;
        border-color: #4b5563;
        color: #f9fafb;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes scaleIn {
    from {
        transform: scale(0.95);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Accessibility */
.palm-modal-overlay:focus-within .palm-modal {
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.2);
}

/* Print */
@media print {
    .palm-modal-overlay {
        display: none !important;
    }
}
