/* Reset und Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #f5f5f5;
    color: #333;
}

/* Header */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.header h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

.header-controls {
    display: flex;
    gap: 1rem;
}

/* Buttons */
.btn {
    background: #007bff;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn:hover {
    background: #0056b3;
    transform: translateY(-1px);
}

.btn-primary {
    background: #007bff;
}

.btn-secondary {
    background: #6c757d;
}

.btn-danger {
    background: #dc3545;
}

.btn-success {
    background: #28a745;
}

.btn-success:hover {
    background: #218838;
}

.btn-small {
    padding: 0.375rem 0.75rem;
    font-size: 0.8rem;
}

/* Main Container */
.main-container {
    display: flex;
    height: calc(100vh - 80px);
}

/* Sidebar */
.sidebar {
    width: 350px;
    background: white;
    border-right: 1px solid #ddd;
    padding: 1.5rem;
    overflow-y: auto;
    box-shadow: 2px 0 5px rgba(0,0,0,0.1);
}

.sidebar h3 {
    margin-bottom: 1rem;
    color: #495057;
    font-size: 1.1rem;
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 0.5rem;
}

/* Search Section */
.search-section {
    margin-bottom: 2rem;
}

.search-container {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.search-container input {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
}

.search-results {
    max-height: 200px;
    overflow-y: auto;
}

.search-result {
    padding: 0.75rem;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    background: white;
}

.search-result:hover {
    background: #f8f9fa;
    border-color: #007bff;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.search-result-header {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.search-icon {
    font-size: 1.2rem;
    margin-top: 0.1rem;
}

.search-info {
    flex: 1;
}

.search-name {
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.25rem;
}

.search-coords {
    font-size: 0.8rem;
    color: #6c757d;
    margin-bottom: 0.25rem;
}

.search-type {
    font-size: 0.75rem;
    background: #e9ecef;
    color: #495057;
    padding: 0.1rem 0.4rem;
    border-radius: 10px;
    display: inline-block;
}

/* Waypoints Section */
.waypoints-section {
    margin-bottom: 2rem;
}

.waypoints-list {
    min-height: 100px;
    border: 2px dashed #ddd;
    border-radius: 4px;
    padding: 0.5rem;
    margin-bottom: 1rem;
}

.waypoint-item {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: move;
    transition: all 0.2s ease;
}

.waypoint-item:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transform: translateY(-1px);
}

.waypoint-item.sortable-ghost {
    opacity: 0.5;
    background: #f8f9fa;
}

.waypoint-info {
    flex: 1;
}

.waypoint-name {
    font-weight: 600;
    color: #495057;
}

.waypoint-coords {
    font-size: 0.8rem;
    color: #6c757d;
    margin-top: 0.25rem;
}

.waypoint-controls {
    display: flex;
    gap: 0.25rem;
}

.waypoint-controls button {
    background: none;
    border: none;
    color: #6c757d;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 3px;
    transition: all 0.2s ease;
}

.waypoint-controls button:hover {
    background: #f8f9fa;
    color: #dc3545;
}

/* Connections Section */
.connections-section {
    margin-bottom: 2rem;
}

.connection-item {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.connection-info {
    flex: 1;
}

.connection-type {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.connection-type.flight {
    color: #007bff;
}

.connection-type.road {
    color: #28a745;
}

.connection-route {
    font-size: 0.8rem;
    color: #6c757d;
}

.connection-controls {
    display: flex;
    gap: 0.5rem;
}

.connection-controls select {
    padding: 0.25rem;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 0.8rem;
}

.connection-controls button {
    background: none;
    border: none;
    color: #dc3545;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 3px;
    transition: all 0.2s ease;
}

.connection-controls button:hover {
    background: #f8f9fa;
}

/* Style Section */
.style-section select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
}

/* Map Container */
.map-container {
    flex: 1;
    position: relative;
}

#map {
    height: 100%;
    width: 100%;
}

.map-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1000;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background-color: white;
    margin: 15% auto;
    padding: 2rem;
    border-radius: 8px;
    width: 400px;
    max-width: 90%;
    position: relative;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-content h2 {
    margin-bottom: 1.5rem;
    color: #495057;
}

.modal-content input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 1.5rem;
    font-size: 1rem;
}

.modal-buttons {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

.close {
    position: absolute;
    right: 1rem;
    top: 1rem;
    color: #aaa;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s ease;
}

.close:hover {
    color: #000;
}

/* Responsive Design */
@media (max-width: 768px) {
    .main-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: 300px;
        order: 2;
    }
    
    .map-container {
        height: calc(100vh - 380px);
        order: 1;
    }
    
    .header {
        padding: 0.75rem 1rem;
        flex-direction: column;
        gap: 1rem;
    }
    
    .header-controls {
        width: 100%;
        justify-content: center;
    }
}

/* Custom Leaflet Styles */
.leaflet-popup-content {
    font-family: inherit;
}

.flight-line {
    stroke: #007bff;
    stroke-width: 3;
    fill: none;
    stroke-dasharray: 5,5;
}

.road-line {
    stroke: #28a745;
    stroke-width: 3;
    fill: none;
}

/* Neue Verbindungsstile */
.flight-path {
    animation: dash 2s linear infinite;
}

@keyframes dash {
    to {
        stroke-dashoffset: -20;
    }
}

.road-path {
    filter: drop-shadow(0 2px 4px rgba(40, 167, 69, 0.3));
}

.road-path-fallback {
    stroke-linecap: round;
    filter: drop-shadow(0 2px 4px rgba(40, 167, 69, 0.3));
}

/* Icons für Verbindungen */
.plane-icon {
    background: none !important;
    border: none !important;
    font-size: 16px;
    text-align: center;
    line-height: 20px;
    animation: float 3s ease-in-out infinite;
}

.car-icon {
    background: none !important;
    border: none !important;
    font-size: 16px;
    text-align: center;
    line-height: 20px;
    animation: bounce 2s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

@keyframes bounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Loading Spinner */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

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

/* API Status Display */
.api-status-display {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
    color: white;
    padding: 1rem 2rem;
    border-bottom: 3px solid rgba(238, 90, 36, 0.8);
    box-shadow: 0 2px 10px rgba(238, 90, 36, 0.3);
    position: relative;
    z-index: 100;
}

.status-content {
    max-width: 1200px;
    margin: 0 auto;
}

.status-alert {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
    padding: 0.5rem 0;
}

.status-alert:last-child {
    margin-bottom: 0;
}

.status-alert i {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.rate-limit {
    border-left: 4px solid #ffeaa7;
}

.service-error {
    border-left: 4px solid #fdcb6e;
}

.status-details {
    margin-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.3);
    padding-top: 1rem;
}

.status-details summary {
    cursor: pointer;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0;
    transition: all 0.2s ease;
}

.status-details summary:hover {
    color: #ffeaa7;
}

.status-details[open] summary i {
    transform: rotate(180deg);
}

.status-details summary i {
    transition: transform 0.2s ease;
}

.status-details-content {
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.limit-info {
    background: rgba(255, 255, 255, 0.1);
    padding: 1rem;
    border-radius: 4px;
    border-left: 3px solid #ffeaa7;
}

.limit-info h4 {
    margin-bottom: 0.5rem;
    color: #ffeaa7;
}

.limit-info p {
    margin-bottom: 0.25rem;
    font-size: 0.9rem;
    opacity: 0.9;
}

/* Rate Limit Notification (temporäre Popup) */
.rate-limit-notification {
    position: fixed;
    top: 100px;
    right: 20px;
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(238, 90, 36, 0.4);
    z-index: 2000;
    animation: slideInRight 0.3s ease, fadeOut 0.5s ease 4.5s forwards;
    max-width: 300px;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

.notification-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.notification-content i {
    font-size: 1.2rem;
    flex-shrink: 0;
}

/* Search Error Styles */
.search-error {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
    color: white;
    border-radius: 6px;
    padding: 1rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.search-error i {
    font-size: 1.2rem;
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.error-content {
    flex: 1;
}

.error-content strong {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.error-content p {
    margin-bottom: 0.25rem;
    opacity: 0.9;
}

.next-available {
    font-size: 0.9rem;
    font-style: italic;
    background: rgba(255, 255, 255, 0.2);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    margin-top: 0.5rem;
}

.search-warning {
    background: linear-gradient(135deg, #fdcb6e 0%, #e17055 100%);
    color: white;
    border-radius: 6px;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
}

.search-warning i {
    font-size: 1rem;
    flex-shrink: 0;
}

.network-error {
    background: linear-gradient(135deg, #6c5ce7 0%, #a29bfe 100%);
}

/* Status Display Responsive */
@media (max-width: 768px) {
    .api-status-display {
        padding: 0.75rem 1rem;
    }
    
    .status-details-content {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .rate-limit-notification {
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    .status-alert {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
}