/**
 * Modal-System Styles
 * Styling für das wiederverwendbare Modal-Framework
 * Ergänzt styles.css, überschreibt nur nötiges Layout
 */

/* ===== Modal Overlay ===== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(150, 150, 150, 0.5);
    /* Match styles.css .overlay-outer color */
    z-index: 1999;
    transition: opacity 0.3s ease;
    opacity: 0;
}

.modal-overlay.show {
    display: block;
    opacity: 1;
}

/* ===== Modal Section ===== */
.modal-section {
    display: none;
    position: fixed;
    z-index: 2000;
    pointer-events: none;
    /* Allows clicking through empty areas if needed, but inner has pointer-events: auto */
}

.modal-section.show {
    display: block;
}

.modal-section .overlay-inner {
    position: fixed;
    pointer-events: auto;
    background-color: var(--white, white);
    border-radius: 8px;
    box-shadow: 0 0 32px 0 rgba(0, 0, 0, 0.2);
    /* Match styles.css */
    width: 600px;
    /* Default fallbacks */
    max-height: 90vh;
    height: auto;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 0;
    /* padding handled by children or specific classes */
    animation: modalSlideIn 0.3s ease;
}

/* ===== Animation ===== */
@keyframes modalSlideIn {
    from {
        transform: translateY(-30px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ===== Header ===== */
.modal-section .header-overlay,
.modal-section .header-overlayZuord {
    /* Match styles.css .overlay-inner .header-overlay */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0 24px 0;
    border-bottom: 1px solid var(--monochrom-grey-1, #e0e0e0);
    background: transparent;
    /* Match styles.css */
    flex-shrink: 0;
}

.modal-section.new-entry .header-overlay {
    height: 40px;
    /* Match styles.css .new-entry ... */
}

.modal-section:not(.new-entry) .header-overlay {
    height: auto;
    /* Default from styles.css */
    justify-content: center;
    /* Ensure centering */
}

.modal-section .header-overlay p {
    margin: 0;
    font-size: 1.375rem;
    /* Default small from styles.css */
    font-weight: 300;
    color: var(--black, #000);
}

/* Specific overrides for New Entry */
.modal-section.new-entry .header-overlay p {
    font-size: 1.375rem;
    font-weight: 300;
}

/* Specific overrides for HeaderZuord */
.modal-section .header-overlayZuord {
    height: 60px;
}

.modal-section .header-overlayZuord p {
    font-size: 1.375rem;
    font-weight: 300;
}


/* ===== Content ===== */
.modal-section .content {
    padding: 16px 35px;
    /* Match styles.css */
    overflow-y: auto;
	overflow-x: auto;
    flex: 1;
}

/* Remove default padding for new-entry content to match styles.css */
.modal-section.new-entry .content {
    padding-top: 24px;
}


/* Scrollbar Styling matches styles.css defaults (browser default) or custom if styles.css has main scrollbars */
.modal-section .content::-webkit-scrollbar {
    width: 8px;
}

.modal-section .content::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.modal-section .content::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.modal-section .content::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* ===== Footer ===== */
.modal-section .footer-overlay {
    /* Match styles.css */
    border-top: 1px solid var(--monochrom-grey-1, #e0e0e0);
    padding: 0;
    min-height: 64px;
    height: auto;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    flex-shrink: 0;
    background: transparent;
}

/* Button-Container im Footer */
.modal-section .footer-buttons {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 16px;
    padding: 12px 24px 10px;
}

/* Footer buttons sizing from styles.css */
/* .broeffnung-overlay-inner .footer-overlay button { width: 128px; height: 32px; border-radius: 16px; ... } */
/* We try to target generic footer-overlay buttons */
.modal-section .footer-overlay button {
    min-width: 100px;
    height: 32px;
    border-radius: 16px;
    text-transform: uppercase;
}

.mdc-radio-flexcontainer{
	display: flex;
	flex-direction: column;
	justify-content: space-evenly;
}

.mdc-form-field > label {
	padding-top: 6px;
}

.modal-footer-button {
	display: inline-block;
	padding: 0px 15px;
	min-width: 100px;
	height: 32px;
	border-radius: 16px;
	text-transform: uppercase;
}

/* ===== Responsive Design ===== */
@media (max-width: 768px) {
    .modal-section .overlay-inner {
        width: 90vw !important;
        max-width: none;
        left: 5vw !important;
    }

    .modal-section .header-overlay p {
        font-size: 18px;
    }

    .modal-section .footer-overlay {
        flex-direction: column;
    }

    .modal-section .footer-overlay button {
        width: 100%;
        margin: 5px 0;
    }
}

/* ===== Timeline / Stepper Component ===== */
.modal-timeline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 10px;
    margin: 0;
    position: relative;
    /* border-top wird vom footer-overlay übernommen */
}

/* Timeline Steps */
.timeline-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    position: relative;
}

/* Step Circle */
.timeline-step-circle {
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: #ffffff;
    border: 3px solid #d0d0d0;
    z-index: 2;
    position: relative;
    transition: all 0.3s ease;
}

.timeline-step.completed .timeline-step-circle {
    background: var(--accent-green, #5AB066);
    border-color: var(--accent-green, #5AB066);
}

.timeline-step.active .timeline-step-circle {
    background: var(--accent-blue, #006fc2);
    border-color: var(--accent-blue, #006fc2);
    box-shadow: 0 0 0 4px rgba(0, 111, 194, 0.15);
}

/* Connecting Line */
.timeline-step::before {
    content: '';
    position: absolute;
    top: 7px;
    left: 50%;
    width: 100%;
    height: 2px;
    background: #d0d0d0;
    z-index: 1;
}

/*.timeline-step:first-child::before {
    display: none;
}*/

/* Letzter Step hat keine Linie nach rechts */
.timeline-step:last-child::before {
    display: none;
}

.timeline-step.completed::before {
    background: var(--accent-green, #5AB066)
}

/* Dotted line for pending steps after active */
.timeline-step.pending::before {
    background: transparent;
    border-top: 2px dotted #d0d0d0;
}

/* Step Label */
.timeline-step-label {
    margin-top: 8px;
    font-size: 12px;
    text-align: center;
    color: #666;
    max-width: 100px;
    line-height: 1.3;
}

.timeline-step.active .timeline-step-label {
    font-weight: 600;
    color: var(--accent-blue, #006fc2);
}

.timeline-step.completed .timeline-step-label {
    color: #333;
}

/* Responsive Timeline */
@media (max-width: 768px) {
    .modal-timeline {
        padding: 20px 10px;
    }

    .timeline-step-label {
        font-size: 10px;
        max-width: 80px;
    }

    .timeline-step-circle {
        width: 16px;
        height: 16px;
    }

    .timeline-step::before {
        top: 8px;
    }
}

/* ===== Disabled State ===== */
.modal-section button.disabled,
.modal-section button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: var(--monochrom-grey-4, #ccc) !important;
    border-color: var(--monochrom-grey-4, #ccc) !important;
    pointer-events: none;
}
