/* ===== SHARED COMPONENTS ===== */
/* Navbar / Suche / User-Dropdown: Styles leben in styles/main.css
   (sonst überschreibt das hier die Mobile-Drawer). */

/* ===== MODALS ===== */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2000;
    width: 100%;
    height: 100%;
    max-width: 100vw;
    max-height: 100dvh;
    padding: max(0.75rem, env(safe-area-inset-top, 0px))
             max(0.75rem, env(safe-area-inset-right, 0px))
             max(0.75rem, env(safe-area-inset-bottom, 0px))
             max(0.75rem, env(safe-area-inset-left, 0px));
    background: rgba(0, 0, 0, 0.8);
    align-items: center;
    justify-content: center;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 0;
    max-width: min(500px, 100%);
    width: 100%;
    max-height: min(90vh, calc(100dvh - 1.5rem));
    margin: auto;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    box-sizing: border-box;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    gap: 0.75rem;
    flex-shrink: 0;
}

.modal-header h2 {
    font-size: clamp(1.15rem, 4vw, 1.35rem);
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.3;
    min-width: 0;
    word-break: break-word;
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s ease, color 0.2s ease;
}

.close-btn:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex: 1 1 auto;
    min-height: 0;
}

.modal-body form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-width: 0;
    max-width: 100%;
}

.modal-body input,
.modal-body textarea,
.modal-body select {
    padding: 0.8rem 1rem;
    min-height: 44px;
    background: var(--input-bg);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: border-color 0.2s ease;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.modal-body input:focus,
.modal-body textarea:focus,
.modal-body select:focus {
    outline: none;
    border-color: var(--accent-color);
}

.modal-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
    max-width: 100%;
}

.modal-actions .btn-primary,
.modal-actions .btn-secondary,
.modal-actions .btn-danger {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 44px;
    justify-content: center;
}

.register-link {
    text-align: center;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
}

.register-link a {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 500;
}

.register-link a:hover {
    text-decoration: underline;
}

/* ===== FOOTER ===== */
.footer {
    background: rgba(10, 10, 10, 0.95);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 3rem max(1.25rem, env(safe-area-inset-right, 0px)) max(1.25rem, env(safe-area-inset-bottom, 0px)) max(1.25rem, env(safe-area-inset-left, 0px));
    margin-top: 4rem;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(250px, 100%), 1fr));
    gap: 2rem;
}

.footer-section h3,
.footer-section h4 {
    color: #fff;
    margin-bottom: 1rem;
    font-weight: 600;
}

.footer-section p {
    color: #ccc;
    line-height: 1.6;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 0.5rem;
}

.footer-section ul li a {
    color: #ccc;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    transition: color 0.2s ease;
}

.footer-section ul li a:hover {
    color: #ff3b3b;
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    margin-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: #666;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 980px) {
    .footer-content {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 1.5rem;
    }
}

@media (max-width: 768px) {
    .footer {
        padding: 2.5rem max(1.25rem, env(safe-area-inset-right, 0px)) max(1rem, env(safe-area-inset-bottom, 0px)) max(1.25rem, env(safe-area-inset-left, 0px));
        margin-top: 2.5rem;
    }

    .footer-content {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .modal {
        width: min(500px, calc(100vw - 1.5rem - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)));
        max-height: min(90vh, calc(100dvh - 1.5rem));
    }

    .modal-header {
        padding: 1rem 1.15rem;
    }

    .modal-body {
        padding: 1.15rem;
    }

    .modal-actions {
        flex-direction: column;
    }

    .modal-actions .btn-primary,
    .modal-actions .btn-secondary,
    .modal-actions .btn-danger {
        width: 100%;
    }

    .modal-body input,
    .modal-body textarea,
    .modal-body select {
        font-size: 16px; /* verhindert iOS-Zoom */
    }
}

@media (max-width: 480px) {
    .footer {
        padding: 2rem max(1rem, env(safe-area-inset-right, 0px)) max(1rem, env(safe-area-inset-bottom, 0px)) max(1rem, env(safe-area-inset-left, 0px));
    }

    .footer-content {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }

    .modal {
        width: calc(100vw - 1.25rem - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px));
        max-height: calc(100dvh - 1.25rem);
        margin: 0;
    }

    .modal-header {
        padding: 1rem 1rem 0.5rem;
    }

    .modal-header h2 {
        font-size: 1.2rem;
    }

    .modal-body {
        padding: 1rem;
    }
}
