/* main.css - Hauptstyles der Webseite */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Arial', sans-serif;
}

body {
    background: #f5f5f5;
    color: #333;
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
    max-width: 100vw;
}

.page-container {
    display: flex;
    flex-grow: 1;
    height: 100vh;
    width: 100%;
}

.left-sidebar {
    width: 30%;
    min-width: 300px;
    background: white;
    border-right: 1px solid #ddd;
    display: flex;
    flex-direction: column;
    padding: 15px;
    height: 100%;
    overflow: hidden;
}

.sidebar-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.logo-container {
    text-align: center;
    margin-bottom: 15px;
    cursor: pointer;
    transition: transform 0.3s;
    flex-shrink: 0;
}

.logo-container:hover {
    transform: scale(1.03);
}

.logo {
    max-width: 100%;
    max-height: 100px;
}

.right-content {
    flex-grow: 1;
    padding: 20px;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    width: 70%;
}

.content-scrollable {
    flex-grow: 1;
    overflow-y: auto;
    padding-bottom: 20px;
}

.tabs-header {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #ddd;
    margin-bottom: 20px;
    position: sticky;
    top: 0;
    background: white;
    z-index: 100;
}

.tab-button {
    padding: 10px 20px;
    background: #e9ecef;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
}

.tab-button:hover {
    background: #dee2e6;
}

.tab-button.active {
    background: #0066cc;
    color: white;
}

.tab-content {
    display: none;
    padding: 20px 0;
    flex-grow: 1;
}

.tab-content.active {
    display: block;
}

.home-content {
    text-align: center;
    padding: 20px;
}

.home-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

/* Form Styles */
.form-group {
    margin-bottom: 10px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.form-control {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* Route Basket Styles */
#route-basket {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
    border-left: 4px solid #0066cc;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    max-height: 40vh;
}

#route-basket h3 {
    margin-top: 0;
    color: #0066cc;
    margin-bottom: 10px;
    font-size: 1.2rem;
}

#basket-items {
    overflow-y: auto;
    margin-bottom: 10px;
    flex-grow: 1;
}

.basket-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
    border-bottom: 1px solid #eee;
}

.basket-actions {
    display: flex;
    gap: 5px;
}

.basket-actions button {
    padding: 4px 8px;
    font-size: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
}

.set-start {
    background: #28a745;
    color: white;
    border: none;
}

.set-end {
    background: #0066cc;
    color: white;
    border: none;
}

.remove-item {
    background: #dc3545;
    color: white;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

#open-google-maps {
    padding: 10px;
    background: #0066cc;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    margin-top: 10px;
    flex-shrink: 0;
}

/* Loading and Error Styles */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-left-color: #0066cc;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 50px auto;
}

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

.error-message {
    padding: 20px;
    background: #f8d7da;
    color: #721c24;
    border-radius: 4px;
    text-align: center;
    margin: 20px 0;
}

/* Footer Styles */
#footer-container {
    padding-top: 20px;
    border-top: 1px solid #eee;
    margin-top: auto;
}

.main-footer {
    width: 100%;
    padding: 20px 0;
    background: #f8f9fa;
    border-top: 1px solid #ddd;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.footer-col {
    padding: 10px;
    display: flex;
    flex-direction: column;
}

.footer-heading {
    font-size: 1.2rem;
    margin-bottom: 15px;
    color: #0066cc;
}

.office-image-container {
    position: relative;
    margin-bottom: 15px;
}

.footer-logo, .office-image {
    width: 100%;
    border-radius: 8px;
}

.image-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px;
    text-align: center;
}

.overlay-text {
    margin: 0;
    font-size: 0.9rem;
}

.copyright {
    margin-top: 10px;
    font-size: 0.9rem;
    color: #666;
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: 8px;
}

.footer-links a {
    color: #0066cc;
    text-decoration: none;
}

.footer-links a:hover {
    text-decoration: underline;
}

/* Notification Styles */
.notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 15px 20px;
    background: #333;
    color: white;
    border-radius: 4px;
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 1000;
}

.notification.show {
    opacity: 1;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    padding: 20px;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: white;
    border-radius: 8px;
    max-width: 90vw;
    max-height: 90vh;
    overflow: auto;
    position: relative;
    width: 100%;
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 15px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
    z-index: 2001;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

#modal-body {
    padding: 20px;
}

/* Responsive Styles */
@media (max-width: 768px) {
    body {
        overflow-x: hidden;
    }
    
    .page-container {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
    }
    
    .left-sidebar, .right-content {
        width: 100% !important;
        height: auto;
        padding: 10px;
    }
    
    #map-container {
        height: 40vh;
        min-height: 250px;
    }
    
    .tabs-header {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 5px;
    }
    
    .tab-button {
        font-size: 14px;
        padding: 8px 15px;
        white-space: nowrap;
    }
    
    #route-basket {
        max-height: 30vh;
        order: 3; /* Basket nach unten verschieben */
        margin-top: 15px;
    }
    
    .content-scrollable {
        overflow-y: auto;
        padding: 10px;
    }
    
    .locations-grid, .home-grid {
        grid-template-columns: 1fr !important;
    }
    
    /* Mobile-spezifische Basket-Styles */
    #basket-items {
        max-height: 150px;
    }
    
    .basket-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .basket-actions {
        align-self: flex-end;
    }
    
    /* Modal-Anpassungen für Mobile */
    .modal-overlay {
        padding: 10px;
        align-items: flex-start;
        padding-top: 40px;
    }
    
    .modal-content {
        max-width: 100%;
        max-height: calc(100vh - 50px);
        border-radius: 8px 8px 0 0;
    }
    
    .close-modal {
        top: 10px;
        right: 10px;
        width: 35px;
        height: 35px;
        font-size: 20px;
        background: rgba(220, 53, 69, 0.9);
    }
    
    /* Sicherstellen, dass Karte im Modal responsive ist */
    .modal-content .leaflet-container {
        width: 100% !important;
        height: 300px !important;
    }
}

@media (max-width: 992px) {
    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 576px) {
    .footer-grid {
        grid-template-columns: 1fr;
    }
    
    /* Zusätzliche Mobile-Optimierungen */
    .home-content h1 {
        font-size: 1.5rem;
    }
    
    .home-content p {
        font-size: 0.9rem;
    }
    
    #route-basket h3 {
        font-size: 1.1rem;
    }
    
    .form-group label {
        font-size: 0.9rem;
    }
}

/* Touch-Optimierungen für mobile Geräte */
@media (hover: none) and (pointer: coarse) {
    .tab-button {
        min-height: 44px; /* Mindestgröße für Touch-Ziele */
        display: flex;
        align-items: center;
    }
    
    .basket-actions button {
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    #open-google-maps {
        min-height: 44px;
    }
    
    .action-button {
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* Sicherstellen, dass die Karte immer sichtbar ist */
#map-container {
    flex-grow: 1;
    min-height: 300px;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 15px;
}

/* Basket-Container optimieren */
#route-basket {
    display: flex;
    flex-direction: column;
}

/* Zusätzliche Hilfsklassen für bessere mobile Darstellung */
.mobile-only {
    display: none;
}

@media (max-width: 768px) {
    .mobile-only {
        display: block;
    }
    
    .desktop-only {
        display: none;
    }
}

/* Plus-Code Container Styles für Mobile */
@media (max-width: 768px) {
    .plus-code-container {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 12px !important;
        padding: 12px !important;
    }
    
    .plus-code-compact {
        text-align: center;
        margin-bottom: 8px;
    }
    
    #modal-add-to-basket {
        width: 100% !important;
        margin-left: 0 !important;
        padding: 12px !important;
        font-size: 16px !important; /* Größere Schrift für bessere Lesbarkeit auf Mobile */
    }
    
    /* Sicherstellen, dass der Modal-Inhalt nicht zu breit wird */
    .modal-content {
        max-width: 95vw !important;
        margin: 0 auto;
    }
    
    #modal-body {
        overflow-x: hidden;
    }
    
    /* Spezifische Anpassungen für den Modal-Inhalt */
    .modal-content > div {
        max-width: 100%;
        overflow-x: hidden;
    }
}

/* Zusätzliche Optimierungen für sehr kleine Bildschirme */
@media (max-width: 480px) {
    .plus-code-value {
        font-size: 12px !important;
        word-break: break-all;
    }
    
    .plus-code-label {
        font-size: 12px !important;
    }
}

/* Allgemeine Modal-Optimierungen */
.modal-content {
    width: auto !important;
    max-width: 90vw;
}

/* Sicherstellen, dass Bilder im Modal nicht zu breit werden */
.modal-content img,
.modal-content video {
    max-width: 100%;
    height: auto;
}

/* Zusätzliche CSS-Regeln für die Wegepunktliste auf mobilen Geräten */
@media (max-width: 768px) {
    #route-basket {
        order: 3;
        margin-top: 15px;
        max-height: none; /* Entfernt die Höhenbegrenzung */
        height: auto; /* Automatische Höhe */
        display: block !important; /* Erzwingt die Anzeige */
        opacity: 1 !important; /* Stellt die Sichtbarkeit sicher */
        visibility: visible !important; /* Stellt die Sichtbarkeit sicher */
    }
    
    #basket-items {
        max-height: 200px; /* Begrenzte Höhe mit Scrollfunktion */
        overflow-y: auto;
        display: block !important;
        opacity: 1 !important;
        visibility: visible !important;
        background: white;
        border-radius: 4px;
        padding: 10px;
        border: 1px solid #ddd;
        margin-bottom: 10px;
    }
    
    .empty-basket {
        text-align: center;
        padding: 20px;
        color: #666;
        font-style: italic;
    }
    
    .basket-item {
        background: #f8f9fa;
        border-radius: 4px;
        margin-bottom: 8px;
        padding: 10px;
        border: 1px solid #e9ecef;
    }
    
    .basket-item:last-child {
        margin-bottom: 0;
    }
    
    .basket-item span {
        display: block;
        margin-bottom: 8px;
        font-weight: 500;
    }
    
    .basket-actions {
        display: flex;
        justify-content: flex-end;
        gap: 5px;
    }
}

/* Sicherstellen, dass die Wegepunktliste immer sichtbar ist */
#route-basket {
    display: flex;
    flex-direction: column;
}

#basket-items {
    display: block;
}

