/**
 * Feuerwehr Krokier App - Frontend Styles
 */

/* Container */
.fw-krokier-app-container {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    background: #f5f5f5;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.fw-krokier-app-container:fullscreen {
    border-radius: 0;
}

/* Toolbar */
.fw-krokier-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #2c3e50;
    color: white;
    padding: 12px 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.toolbar-left,
.toolbar-center,
.toolbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.toolbar-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #34495e;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.toolbar-btn:hover {
    background: #4a5f7f;
    transform: translateY(-1px);
}

.toolbar-btn.active {
    background: #3498db;
}

.toolbar-btn-primary {
    background: #e74c3c;
}

.toolbar-btn-primary:hover {
    background: #c0392b;
}

.toolbar-btn .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

.current-time {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 20px;
    font-weight: bold;
    font-family: 'Courier New', monospace;
    background: #1a252f;
    padding: 8px 16px;
    border-radius: 4px;
}

/* Color Picker */
.color-picker {
    display: flex;
    align-items: center;
    gap: 6px;
}

.color-picker label {
    font-size: 14px;
    margin-right: 4px;
}

.color-btn {
    width: 30px;
    height: 30px;
    border: 2px solid white;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.color-btn:hover {
    transform: scale(1.1);
}

.color-btn.active {
    border-width: 3px;
    box-shadow: 0 0 8px rgba(255,255,255,0.8);
}

/* Export Dropdown */
.export-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000;
    min-width: 150px;
}

.export-option {
    display: block;
    width: 100%;
    padding: 10px 16px;
    text-align: left;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s ease;
}

.export-option:hover {
    background: #f0f0f0;
}

.export-option:not(:last-child) {
    border-bottom: 1px solid #eee;
}

/* Main Content */
.fw-krokier-content {
    display: flex;
    height: 600px;
    background: white;
}

.fw-krokier-map-wrapper {
    flex: 1;
    position: relative;
    overflow: hidden;
}

#fw-krokier-map {
    width: 100%;
    height: 100%;
}

/* Loading Overlay */
.fw-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    color: white;
}

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

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

/* Symbol Library */
.fw-krokier-symbols {
    width: 280px;
    background: #f9f9f9;
    border-left: 1px solid #ddd;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.symbols-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: #34495e;
    color: white;
}

.symbols-header h3 {
    margin: 0;
    font-size: 16px;
}

.refresh-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.refresh-btn:hover {
    background: rgba(255,255,255,0.1);
}

.refresh-btn .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

.symbols-search {
    padding: 12px;
    background: white;
    border-bottom: 1px solid #ddd;
}

.symbols-search input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.symbols-grid {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.symbol-item {
    background: white;
    border: 2px solid #ddd;
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 12px;
    cursor: move;
    transition: all 0.2s ease;
    text-align: center;
}

.symbol-item:hover {
    border-color: #3498db;
    box-shadow: 0 2px 8px rgba(52,152,219,0.2);
    transform: translateY(-2px);
}

.symbol-item img {
    width: 60px;
    height: 60px;
    object-fit: contain;
    margin-bottom: 8px;
}

.symbol-name {
    display: block;
    font-size: 12px;
    color: #555;
    word-break: break-word;
}

.symbols-loading {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

.symbols-loading .dashicons {
    font-size: 32px;
    width: 32px;
    height: 32px;
    margin-bottom: 12px;
}

.symbols-loading .spin {
    animation: spin 2s linear infinite;
}

.no-symbols {
    text-align: center;
    padding: 40px 20px;
    color: #999;
    font-size: 14px;
}

/* Custom Marker Styles */
.rotated-marker {
    background: none !important;
    border: none !important;
}

.text-marker {
    background: none !important;
    border: none !important;
}

/* Context Menu */
.context-menu {
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    overflow: hidden;
    min-width: 180px;
}

.context-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 16px;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s ease;
}

.context-menu-item:hover {
    background: #f0f0f0;
}

.context-menu-item .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

.context-menu-delete {
    color: #e74c3c;
}

.context-menu-delete:hover {
    background: #fee;
}

/* Modals */
.fw-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100000;
}

.fw-modal-content {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow: auto;
}

.fw-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #eee;
}

.fw-modal-header h3 {
    margin: 0;
    font-size: 18px;
}

.fw-modal-close {
    background: none;
    border: none;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    color: #999;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.fw-modal-close:hover {
    background: #f0f0f0;
    color: #333;
}

.fw-modal-body {
    padding: 20px;
}

.fw-modal-body label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.fw-modal-body input[type="text"],
.fw-modal-body select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    margin-bottom: 16px;
}

.fw-modal-body .color-picker {
    margin-bottom: 16px;
}

.fw-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 20px;
    border-top: 1px solid #eee;
}

.fw-modal-footer .button {
    padding: 10px 20px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
}

.fw-modal-footer .button:hover {
    background: #f0f0f0;
}

.fw-modal-footer .button-primary {
    background: #3498db;
    color: white;
    border-color: #3498db;
}

.fw-modal-footer .button-primary:hover {
    background: #2980b9;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .fw-krokier-content {
        flex-direction: column;
        height: auto;
    }
    
    .fw-krokier-map-wrapper {
        height: 400px;
    }
    
    .fw-krokier-symbols {
        width: 100%;
        max-height: 300px;
        border-left: none;
        border-top: 1px solid #ddd;
    }
    
    .symbols-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 12px;
    }
    
    .symbol-item {
        margin-bottom: 0;
    }
}

@media (max-width: 768px) {
    .fw-krokier-toolbar {
        padding: 8px 12px;
    }
    
    .toolbar-btn .btn-text {
        display: none;
    }
    
    .toolbar-btn {
        padding: 8px;
    }
    
    .current-time {
        font-size: 16px;
        padding: 6px 12px;
    }
    
    .color-picker label {
        display: none;
    }
    
    .color-btn {
        width: 24px;
        height: 24px;
    }
}

/* Fullscreen Mode */
.fw-krokier-app-container:fullscreen .fw-krokier-content {
    height: calc(100vh - 60px);
}

/* Leaflet Customizations */
.leaflet-draw-toolbar a {
    background-color: #34495e !important;
}

.leaflet-draw-toolbar a:hover {
    background-color: #4a5f7f !important;
}

.leaflet-popup-content-wrapper {
    border-radius: 6px;
}

.leaflet-popup-content {
    font-size: 14px;
    line-height: 1.5;
}

/* Print Styles */
@media print {
    .fw-krokier-toolbar,
    .fw-krokier-symbols {
        display: none !important;
    }
    
    .fw-krokier-content {
        height: auto !important;
    }
    
    .fw-krokier-map-wrapper {
        height: 100vh !important;
    }
}
