/**
 * Modal System - v1.0.0
 * Custom Confirm/Alert Dialogs im Portal-Style
 */

/* ============================================================================
   OVERLAY
   ============================================================================ */

.portal-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
}

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

/* ============================================================================
   MODAL CONTAINER
   ============================================================================ */

.portal-modal {
    background: var(--bg-primary);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    max-width: 480px;
    width: 90%;
    margin: 20px;
    transform: scale(0.9) translateY(-20px);
    transition: transform 0.2s ease-out;
}

.portal-modal-overlay.portal-modal-active .portal-modal {
    transform: scale(1) translateY(0);
}

/* Confirm-Dialog (klein und kompakt) */
.portal-modal-confirm {
    max-width: 420px;
}

/* Alert-Dialog (etwas breiter) */
.portal-modal-alert {
    max-width: 460px;
}

/* ============================================================================
   HEADER
   ============================================================================ */

.portal-modal-header {
    padding: 24px 24px 16px;
    display: flex;
    align-items: center;
    gap: 16px;
    border-bottom: 1px solid var(--border-color);
}

.portal-modal-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border-radius: 50%;
    flex-shrink: 0;
}

.portal-modal-icon span[data-icon] {
    font-size: 24px;
}

.portal-modal-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* ============================================================================
   BODY
   ============================================================================ */

.portal-modal-body {
    padding: 20px 24px;
}

.portal-modal-message {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-secondary);
}

/* ============================================================================
   FOOTER (Buttons)
   ============================================================================ */

.portal-modal-footer {
    padding: 16px 24px;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    border-top: 1px solid var(--border-color);
}

/* ============================================================================
   BUTTONS
   ============================================================================ */

.portal-modal-btn {
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 90px;
}

/* Cancel Button (Secondary) */
.portal-modal-btn-cancel {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.portal-modal-btn-cancel:hover {
    background: var(--bg-tertiary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.portal-modal-btn-cancel:active {
    transform: translateY(0);
}

/* Confirm Button (basierend auf type) */
.portal-modal-btn-confirm {
    background: var(--primary-color, #de0c15) !important; /* Default: Portal-Rot */
    color: white !important;
    font-weight: 600;
}

.portal-modal-btn-confirm:hover {
    background: var(--primary-hover, #b80a11) !important;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.portal-modal-btn-confirm:active {
    transform: translateY(0);
}

/* Type-spezifische Farben überschreiben Default */
.portal-modal-btn-confirm.portal-modal-btn-warning {
    background: #f59f00 !important; /* Orange */
}

.portal-modal-btn-confirm.portal-modal-btn-warning:hover {
    background: #e8a003 !important;
}

.portal-modal-btn-confirm.portal-modal-btn-danger {
    background: #e03131 !important; /* Rot */
}

.portal-modal-btn-confirm.portal-modal-btn-danger:hover {
    background: #c92a2a !important;
}

.portal-modal-btn-confirm.portal-modal-btn-info {
    background: #1971c2 !important; /* Blau */
}

.portal-modal-btn-confirm.portal-modal-btn-info:hover {
    background: #1864ab !important;
}

/* Primary Button (für Alert) */
.portal-modal-btn-primary {
    background: var(--primary-color, #de0c15) !important;
    color: white !important;
    font-weight: 600;
}

.portal-modal-btn-primary:hover {
    background: var(--primary-hover, #b80a11) !important;
}

/* Focus-Styles */
.portal-modal-btn:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* ============================================================================
   DARK MODE
   ============================================================================ */

[data-theme="dark"] .portal-modal-overlay {
    background-color: rgba(0, 0, 0, 0.8);
}

[data-theme="dark"] .portal-modal {
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

/* ============================================================================
   RESPONSIVE
   ============================================================================ */

@media (max-width: 768px) {
    .portal-modal {
        max-width: 95%;
        margin: 10px;
    }
    
    .portal-modal-header {
        padding: 20px 16px 12px;
        gap: 12px;
    }
    
    .portal-modal-icon {
        width: 40px;
        height: 40px;
    }
    
    .portal-modal-icon span[data-icon] {
        font-size: 20px;
    }
    
    .portal-modal-title {
        font-size: 1.1rem;
    }
    
    .portal-modal-body {
        padding: 16px;
    }
    
    .portal-modal-footer {
        padding: 12px 16px;
        gap: 8px;
    }
    
    .portal-modal-btn {
        padding: 8px 16px;
        font-size: 0.85rem;
        min-width: 80px;
    }
}

/* ============================================================================
   ANIMATIONS
   ============================================================================ */

@keyframes portalModalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes portalModalFadeOut {
    from {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
    to {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
}

