/* ===================================================================
   WDTModal - Modernes Modal-System mit native HTML <dialog>
   Features: Multi-Modal Stacking, Backdrop, Animations
   =================================================================== */

/* ===================================================================
   BACKDROP - Verdunkelung hinter dem Modal
   =================================================================== */

.wdt-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    animation: wdt-modal-backdrop-fade-in 0.2s ease-out;
    pointer-events: auto;
}

/* Backdrop für gestackte Modals - jedes weitere Modal dunkler */
.wdt-modal-backdrop + .wdt-modal-backdrop {
    background-color: rgba(0, 0, 0, 0.2);
}

@keyframes wdt-modal-backdrop-fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* ===================================================================
   DIALOG - Native HTML <dialog> Element
   =================================================================== */

.wdt-modal-dialog {
    /* Zentrierte Positionierung - überschreibt Browser-Defaults */
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    right: auto !important;
    bottom: auto !important;
    transform: translate(-50%, -50%);
    margin: 0 !important;

    /* Kendo Theme Integration */
    background: var(--kendo-color-surface, #ffffff);
    border: 1px solid var(--kendo-color-border, #e0e0e0);
    border-radius: var(--kendo-border-radius-md, 8px);

    /* Shadow für Tiefe */
    box-shadow:
        0 11px 15px -7px rgba(0, 0, 0, 0.2),
        0 24px 38px 3px rgba(0, 0, 0, 0.14),
        0 9px 46px 8px rgba(0, 0, 0, 0.12);

    /* Layout */
    display: flex;
    flex-direction: column;
    padding: 0;
    max-width: 90vw;
    max-height: 90vh;

    /* Animation */
    animation: wdt-modal-scale-in 0.2s cubic-bezier(0.4, 0, 0.2, 1);

    /* Focus-Outline */
    outline: none;

    /* Overflow für scrollbare Inhalte */
    overflow: hidden;
}

/* Native Browser Backdrop Styling */
.wdt-modal-dialog::backdrop {
    background-color: rgba(0, 0, 0, 0.5);
    animation: wdt-modal-backdrop-fade-in 0.2s ease-out;
}

@keyframes wdt-modal-scale-in {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

/* ===================================================================
   HEADER - Titel und Close-Button
   =================================================================== */

.wdt-modal-header {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--kendo-color-border, #e0e0e0);
    flex-shrink: 0;
    gap: 16px;
}

.wdt-modal-title {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: var(--kendo-color-on-app-surface, #212121);
    flex: 1;
    order: 1;
}

.wdt-modal-close-button {
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    color: var(--kendo-color-on-app-surface, #757575);
    font-size: 20px;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, color 0.2s;
    flex-shrink: 0;
    order: 2;
    margin-left: auto;
}

.wdt-modal-close-button:hover {
    background: var(--kendo-color-base-hover, rgba(0, 0, 0, 0.08));
    color: var(--kendo-color-on-app-surface, #212121);
}

.wdt-modal-close-button:active {
    background: var(--kendo-color-base-active, rgba(0, 0, 0, 0.12));
}

/* ===================================================================
   CONTENT - Scrollbarer Inhaltsbereich
   =================================================================== */

.wdt-modal-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 5px;
    color: var(--kendo-color-on-app-surface, #212121);
}

/* Scrollbar-Styling (Webkit) */
.wdt-modal-content::-webkit-scrollbar {
    width: 8px;
}

.wdt-modal-content::-webkit-scrollbar-track {
    background: var(--kendo-color-base, #f5f5f5);
}

.wdt-modal-content::-webkit-scrollbar-thumb {
    background: var(--kendo-color-base-emphasis, #bdbdbd);
    border-radius: 4px;
}

.wdt-modal-content::-webkit-scrollbar-thumb:hover {
    background: var(--kendo-color-base-active, #9e9e9e);
}

/* ===================================================================
   STACKING - Mehrere Modals übereinander
   =================================================================== */

/* Modals weiter hinten leicht abdunkeln und blurren */
.wdt-modal-dialog[style*="z-index: 1401"] ~ .wdt-modal-dialog {
    filter: brightness(0.9);
}

/* ===================================================================
   RESPONSIVE - Mobile Anpassungen
   =================================================================== */

@media (max-width: 768px) {
    .wdt-modal-dialog {
        width: 95vw !important;
        max-width: 95vw;
        height: auto !important;
        max-height: 90vh;
    }

    .wdt-modal-header {
        padding: 16px 20px;
    }

    .wdt-modal-content {
        padding: 5px;
    }

    .wdt-modal-title {
        font-size: 18px;
    }
}

/* ===================================================================
   UTILITY CLASSES - Optional
   =================================================================== */

/* Fullscreen Modal */
.wdt-modal-dialog.wdt-modal-fullscreen {
    width: 100vw !important;
    height: 100vh !important;
    max-width: 100vw;
    max-height: 100vh;
    border-radius: 0;
    top: 0;
    left: 0;
    transform: none;
}

/* Small Modal */
.wdt-modal-dialog.wdt-modal-sm {
    width: 400px !important;
    max-width: 90vw;
}

/* Large Modal */
.wdt-modal-dialog.wdt-modal-lg {
    width: 900px !important;
    max-width: 90vw;
}

/* Extra Large Modal */
.wdt-modal-dialog.wdt-modal-xl {
    width: 1200px !important;
    max-width: 95vw;
}

/* No Padding Content (für z.B. Bilder/Videos) */
.wdt-modal-content.wdt-modal-no-padding {
    padding: 0;
}

/* ===================================================================
   DARK MODE - Optional (wird automatisch via Kendo CSS Vars angepasst)
   =================================================================== */

/* Kendo Dark Themes werden automatisch unterstützt durch:
   - var(--kendo-color-surface) für Background
   - var(--kendo-color-on-app-surface) für Text
   - var(--kendo-color-border) für Borders

   Keine manuellen Dark-Mode Styles nötig!
*/
