/* ========================================
   LoeschNetz - Public PWA Styles
   Mobile-First Design
   ======================================== */

/* === CSS Variables === */
:root {
    --primary-color: #d32f2f;
    --primary-dark: #9a0007;
    --primary-light: #ff6659;
    --secondary-color: #424242;
    --background: #ffffff;
    --surface: #f5f5f5;
    --text-primary: #212121;
    --text-secondary: #757575;
    --border: #e0e0e0;
    --success: #4caf50;
    --warning: #ff9800;
    --error: #f44336;
    --shadow: rgba(0, 0, 0, 0.1);
    --shadow-strong: rgba(0, 0, 0, 0.2);
}

/* === Reset & Base === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 
                 Oxygen, Ubuntu, Cantarell, sans-serif;
    color: var(--text-primary);
    background: var(--background);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* === Cookie Consent Banner === */
.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--surface);
    border-top: 3px solid var(--primary-color);
    box-shadow: 0 -4px 12px var(--shadow-strong);
    z-index: 10000;
    padding: 20px;
}

.cookie-content {
    max-width: 800px;
    margin: 0 auto;
}

.cookie-content h3 {
    font-size: 1.25rem;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.cookie-content p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
    line-height: 1.5;
}

.cookie-highlight {
    color: var(--success);
    font-weight: 600;
}

.cookie-buttons {
    display: flex;
    gap: 12px;
    margin: 16px 0 12px 0;
    flex-wrap: wrap;
}

.cookie-link {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.9rem;
}

.cookie-link:hover {
    text-decoration: underline;
}

/* === Cookie Declined === */
.cookie-declined {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--background);
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.declined-content {
    max-width: 500px;
    text-align: center;
}

.declined-content h2 {
    font-size: 2rem;
    margin-bottom: 16px;
    color: var(--warning);
}

.declined-content h3 {
    font-size: 1.1rem;
    margin: 24px 0 12px 0;
    text-align: left;
}

.declined-content ul {
    text-align: left;
    list-style-position: inside;
    margin-bottom: 24px;
    line-height: 1.8;
}

/* === Loading Screen === */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-content {
    text-align: center;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

/* === Offline Notice === */
.offline-notice {
    position: fixed;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--secondary-color);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    z-index: 2000;
    box-shadow: 0 2px 8px var(--shadow-strong);
}

.offline-icon {
    font-size: 1.2rem;
}

/* === App Container === */
#app {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* === Header === */
.app-header {
    background: var(--primary-color);
    color: white;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 4px var(--shadow);
    z-index: 1000;
}

.app-title {
    font-size: 1.25rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo {
    width: 32px;
    height: 32px;
    display: block;
}

.icon-button {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.25rem;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-button:hover {
    background: rgba(255, 255, 255, 0.3);
}

.icon-button:active {
    background: rgba(255, 255, 255, 0.4);
}

/* === Map Container === */
.map-container {
    flex: 1;
    position: relative;
    background: var(--surface);
    width: 100%;
    overflow: hidden;
    margin-bottom: 30px;
}

#map {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
}

/* === Leaflet Controls Position === */
.leaflet-top .leaflet-control {
    margin-top: 80px !important;
}

/* === Legend === */
.legend {
    position: absolute;
    top: 140px;
    right: 10px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px var(--shadow-strong);
    z-index: 1000;
}

.legend-toggle {
    display: block;
    width: 100%;
    padding: 8px 12px;
    background: white;
    border: none;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    text-align: left;
    transition: background 0.2s;
}

.legend-toggle:hover {
    background: var(--surface);
}

.legend-toggle::after {
    content: '▼';
    float: right;
    transition: transform 0.3s;
}

.legend.collapsed .legend-toggle::after {
    transform: rotate(-90deg);
}

.legend-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
}

.legend:not(.collapsed) .legend-content {
    max-height: 500px;
    padding: 8px 12px 12px 12px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.7rem;
}

.legend-icon {
    width: 15px;
    height: 15px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* === GPS Location Button === */
.gps-button {
    position: absolute;
    bottom: 80px;
    right: 10px;
    width: 40px;
    height: 40px;
    background: white;
    border: 2px solid rgba(0,0,0,0.2);
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px var(--shadow-strong);
    z-index: 1000;
    transition: all 0.2s;
}

.gps-button:hover {
    background: var(--surface);
    border-color: var(--primary-color);
}

.gps-button:active {
    transform: scale(0.95);
}

.gps-button svg {
    color: #666;
}

.gps-button:hover svg {
    color: var(--primary-color);
}

.gps-button.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.gps-button.active svg {
    color: white;
}

/* === Footer === */
.app-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 30px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 10px;
    color: var(--text-secondary);
    z-index: 999;
}

.app-footer a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s;
}

.app-footer a:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

.app-footer span {
    color: var(--border);
}

/* === Install Prompt === */
.install-prompt {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    padding: 16px 20px;
    border-radius: 12px;
    box-shadow: 0 4px 16px var(--shadow-strong);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    max-width: 90%;
    z-index: 1500;
}

.install-prompt p {
    margin: 0;
    font-weight: 500;
}

/* === Buttons === */
.btn-primary,
.btn-secondary,
.btn-text {
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-secondary {
    background: var(--surface);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: #e0e0e0;
}

.btn-text {
    background: transparent;
    color: var(--text-secondary);
    padding: 8px 16px;
}

.btn-text:hover {
    background: rgba(0, 0, 0, 0.05);
}

/* === Modal === */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
}

.modal-content {
    background: white;
    padding: 24px;
    border-radius: 12px;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 8px 32px var(--shadow-strong);
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: var(--surface);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    line-height: 1;
}

.modal-close:hover {
    background: var(--border);
}

.modal-content h2 {
    margin-bottom: 16px;
    color: var(--primary-color);
}

.modal-content h3 {
    margin: 16px 0 8px 0;
    font-size: 1.1rem;
}

.modal-content ul {
    list-style-position: inside;
    margin: 8px 0;
    line-height: 1.8;
}

.version {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 16px;
}

.modal-links {
    display: flex;
    gap: 16px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.modal-links a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

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

/* === Mobile Responsive === */
@media (max-width: 600px) {
    .legend {
        top: auto;
        bottom: 35px; 
        right: auto;
        left: 10px;
    }
    
    .gps-button {
        bottom: 65px; 
        right: 10px;
    }
    
    .cookie-buttons {
        flex-direction: column;
    }
    
    .cookie-buttons button {
        width: 100%;
    }
}

/* === Leaflet Popup === */
.leaflet-popup-content-wrapper {
    border-radius: 8px;
    min-width: 320px;
}

.leaflet-popup-content {
    margin: 12px;
    max-width: 400px;
}

.leaflet-popup-content h3 {
    margin: 0 0 8px 0;
    color: var(--primary-color);
}

.hydrant-popup {
    text-align: center;
}

.hydrant-popup img {
    width: 100%;
    max-width: 350px;
    border-radius: 4px;
    margin: 12px 0;
    cursor: zoom-in;
    transition: transform 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.hydrant-popup img:hover {
    transform: scale(1.05);
}

/* === Photo Overlay === */
.photo-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 10000;
    cursor: zoom-out;
    padding: 20px;
}

.photo-overlay.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.photo-overlay img {
    max-width: 90%;
    max-height: 90%;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    animation: zoomIn 0.3s ease;
}

@keyframes zoomIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* === Leaflet Attribution === */
.leaflet-control-attribution {
    margin-bottom: 0px !important;
    background: rgba(255, 255, 255, 0.8) !important;
    font-size: 10px !important;
}

.leaflet-bottom {
    bottom: 35px !important;
}

/* === Mobile Responsive - Leaflet === */
@media (max-width: 600px) {
    .leaflet-popup-content-wrapper {
        min-width: 280px;
    }
    
    .hydrant-popup img {
        max-width: 100%;
    }
    
    .leaflet-control-attribution {
        margin-bottom: 0px !important;
        font-size: 9px !important;
        max-width: 60%;
    }
    
    .leaflet-control-scale {
        margin-bottom: 35px !important;
    }
}

/* === Print === */
@media print {
    .app-header,
    .legend,
    .install-prompt,
    .offline-notice {
        display: none !important;
    }
}
