/**
 * Location Finder - Frontend Editor CSS
 */

/* ========================================
   LOGIN-FORMULAR
======================================== */

.lf-login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
    padding: 40px 20px;
}

.lf-login-box {
    max-width: 450px;
    width: 100%;
    background: white;
    padding: 40px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.lf-login-box h2 {
    margin: 0 0 10px 0;
    font-size: 24px;
    text-align: center;
    color: #333;
}

.lf-login-box > p {
    text-align: center;
    color: #666;
    margin-bottom: 30px;
    font-size: 14px;
}

.lf-error-message {
    padding: 12px 20px;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 6px;
    color: #721c24;
    margin-bottom: 20px;
    font-size: 14px;
}

.lf-form-group {
    margin-bottom: 20px;
}

.lf-form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
    font-size: 14px;
}

.lf-checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: 400 !important;
}

.lf-checkbox-label input[type="checkbox"] {
    margin-right: 8px;
    cursor: pointer;
}

.lf-checkbox-label span {
    font-size: 14px;
    color: #666;
}

.lf-login-box .lf-form-actions {
    margin-top: 30px;
}

.lf-login-box a {
    color: #0073aa;
    text-decoration: none;
}

.lf-login-box a:hover {
    text-decoration: underline;
}

/* ========================================
   EDITOR WRAPPER
======================================== */

.lf-editor-wrapper {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.lf-editor-message {
    padding: 20px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 6px;
    text-align: center;
}

/* ========================================
   STANDORT-LISTE
======================================== */

.lf-my-locations {
    display: grid;
    gap: 15px;
    margin-top: 20px;
}

.lf-location-item {
    padding: 20px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.lf-location-item:hover {
    border-color: #0073aa;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.lf-location-item h3 {
    margin: 0 0 10px 0;
    font-size: 18px;
    color: #333;
}

.lf-location-item p {
    margin: 0;
    color: #666;
    font-size: 14px;
}

/* ========================================
   FORMULAR
======================================== */

.lf-editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
}

.lf-editor-header h2 {
    margin: 0;
    font-size: 24px;
}

.lf-form-section {
    margin-bottom: 40px;
    padding: 25px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
}

.lf-form-section h3 {
    margin: 0 0 20px 0;
    font-size: 16px;
    text-transform: uppercase;
    color: #555;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 10px;
}

.lf-form-group {
    margin-bottom: 20px;
}

.lf-form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.lf-form-row {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

.lf-form-col {
    flex: 1;
}

.lf-form-col-2 {
    flex: 2;
}

.lf-form-col label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

/* ========================================
   INPUTS
======================================== */

.lf-input-full,
.lf-textarea-full {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 15px;
    box-sizing: border-box;
    font-family: inherit;
}

.lf-input-full:focus,
.lf-textarea-full:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 3px rgba(0,115,170,0.1);
}

.lf-textarea-full {
    resize: vertical;
    min-height: 150px;
}

/* ========================================
   BUTTONS
======================================== */

.lf-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-block;
    text-decoration: none;
}

.lf-btn-primary {
    background: #0073aa;
    color: white;
}

.lf-btn-primary:hover {
    background: #005a87;
}

.lf-btn-secondary {
    background: #f0f0f0;
    color: #333;
}

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

.lf-btn-danger {
    background: #dc3545;
    color: white;
}

.lf-btn-danger:hover {
    background: #c82333;
}

.lf-btn-large {
    padding: 15px 30px;
    font-size: 17px;
}

.lf-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ========================================
   GEOCODING BOX
======================================== */

.lf-geocode-box {
    background: #f5f5f5;
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 6px;
    margin-bottom: 20px;
}

.lf-help-text {
    margin: 10px 0 0 0;
    font-size: 13px;
    color: #666;
}

/* ========================================
   GALERIE & THUMBNAIL
======================================== */

.lf-gallery-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px;
}

.lf-gallery-item {
    position: relative;
    cursor: move;
}

.lf-gallery-remove {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lf-gallery-drag-handle {
    cursor: move;
}

.lf-gallery-placeholder {
    width: 112px;
    height: 112px;
    border: 2px dashed #3b82f6;
    border-radius: 12px;
    background: rgba(59, 130, 246, 0.08);
}

/* ========================================
   FEATURES / CHECKBOXEN
======================================== */

.lf-features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.lf-checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-weight: normal;
}

.lf-checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* ========================================
   FORM ACTIONS
======================================== */

.lf-form-actions {
    margin-top: 40px;
    padding: 25px;
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    text-align: center;
}

/* ========================================
   LOADING & MESSAGES
======================================== */

.lf-loading {
    padding: 40px;
    text-align: center;
    color: #666;
    font-size: 16px;
}

.lf-success-message {
    padding: 15px 20px;
    background: #d4edda;
    border: 1px solid #c3e6cb;
    border-radius: 6px;
    color: #155724;
    margin-bottom: 20px;
    text-align: center;
    font-size: 14px;
    line-height: 1.4;
}

.lf-error-message {
    padding: 15px 20px;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 6px;
    color: #721c24;
    margin-bottom: 20px;
    text-align: center;
}

/* ========================================
   RESPONSIVE
======================================== */

@media (max-width: 768px) {
    .lf-editor-wrapper {
        padding: 15px;
    }
    
    .lf-form-row {
        flex-direction: column;
        gap: 0;
    }
    
    .lf-features-grid {
        grid-template-columns: 1fr;
    }
    
    .lf-editor-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
}

/* ========================================
   LOGIN-FORMULAR
   ======================================== */

.lf-login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
    padding: 40px 20px;
}

.lf-login-box {
    max-width: 450px;
    width: 100%;
    background: white;
    padding: 40px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.lf-login-box h2 {
    margin: 0 0 10px 0;
    font-size: 24px;
    text-align: center;
    color: #333;
}

.lf-login-box > p {
    text-align: center;
    color: #666;
    margin-bottom: 30px;
}

.lf-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.lf-checkbox-label input[type="checkbox"] {
    margin: 0;
}

.lf-checkbox-label span {
    font-size: 14px;
    color: #555;
}

.lf-error-message {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    padding: 12px 16px;
    border-radius: 4px;
    margin-bottom: 20px;
}

/* TinyMCE: aktive Toolbar-Buttons im Frontend klar lesbar halten */
#lf-editor-container .tox .tox-tbtn--enabled,
#lf-editor-container .tox .tox-tbtn--enabled:hover,
#lf-editor-container .tox .tox-tbtn[aria-pressed="true"],
#lf-editor-container .tox .tox-tbtn[aria-pressed="true"]:hover {
    background: rgb(59 130 246 / 0.16) !important;
    color: rgb(31 41 55) !important;
}

#lf-editor-container .tox .tox-tbtn--enabled .tox-icon svg,
#lf-editor-container .tox .tox-tbtn[aria-pressed="true"] .tox-icon svg {
    fill: currentColor !important;
}

#lf-editor-container .tox {
    --tox-icon-color: rgb(31 41 55) !important;
    --tox-icon-color__active: rgb(31 41 55) !important;
    --tox-icon-color__disabled: rgb(107 114 128) !important;
}

#lf-editor-container .tox .tox-tbtn--enabled *,
#lf-editor-container .tox .tox-tbtn[aria-pressed="true"] * {
    color: rgb(31 41 55) !important;
}

#lf-editor-container .tox .tox-tbtn--enabled svg,
#lf-editor-container .tox .tox-tbtn[aria-pressed="true"] svg,
#lf-editor-container .tox .tox-tbtn--enabled svg *,
#lf-editor-container .tox .tox-tbtn[aria-pressed="true"] svg * {
    fill: currentColor !important;
    stroke: currentColor !important;
}

/* TinyMCE 4 Fallback (mce-*) */
#lf-editor-container .mce-btn.mce-active button,
#lf-editor-container .mce-btn.mce-active:hover button,
#lf-editor-container .mce-btn.mce-active i,
#lf-editor-container .mce-btn.mce-active:hover i {
    color: #1f2937 !important;
}

/* ========================================
   HOVER-VORSCHAU FÜR ADRESSEN
======================================== */

.lf-address-hover {
    cursor: help;
    position: relative;
}

.lf-address-hover:hover {
    color: #0073aa;
}

.lf-address-tooltip {
    position: absolute;
    z-index: 10000;
    width: 320px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    overflow: hidden;
    display: none;
    pointer-events: none;
}

.lf-tooltip-map {
    width: 100%;
    height: 200px;
    overflow: hidden;
    background: #f5f5f5;
}

.lf-tooltip-map img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.lf-tooltip-info {
    padding: 12px 15px;
    line-height: 1.4;
}

.lf-tooltip-line {
    margin: 0;
    padding: 0;
}

.lf-tooltip-info strong {
    display: inline;
    margin: 0;
    font-size: 14px;
    color: #333;
}

.lf-tooltip-info span {
    font-size: 13px;
    color: #666;
}

.lf-tooltip-country {
    color: #888;
}

/* ========================================
   QUICK EDIT - Adress-Felder Styling
======================================== */

.inline-edit-col .lf_address,
.inline-edit-col .lf_zip,
.inline-edit-col .lf_city {
    width: 100%;
}

/* ========================================
   FRONTEND EDITOR BUTTON HARDENING
======================================== */

#lf-editor-container .bg-primary,
#lf-editor-login .bg-primary {
    background-color: rgb(var(--primary)) !important;
    color: rgb(var(--primary-foreground)) !important;
}

#lf-editor-container .hover\:bg-primary\/90:hover,
#lf-editor-login .hover\:bg-primary\/90:hover {
    background-color: rgb(var(--primary) / 0.9) !important;
}

#lf-editor-container .text-primary-foreground,
#lf-editor-login .text-primary-foreground {
    color: rgb(var(--primary-foreground)) !important;
}

#lf-editor-container #lf-create-location-btn {
    background-color: rgb(var(--primary)) !important;
    color: rgb(var(--primary-foreground)) !important;
    border: 1px solid transparent !important;
    border-radius: 12px !important;
}

#lf-editor-container #lf-create-location-btn:hover {
    background-color: rgb(var(--primary) / 0.9) !important;
}

/* ========================================
   MAP Z-INDEX FIX (Editor)
======================================== */

#lf-editor-container #lf-edit-preview-map {
    position: relative;
    z-index: 0 !important;
}

#lf-editor-container #lf-edit-preview-map .leaflet-container,
#lf-editor-container #lf-edit-preview-map .leaflet-map-pane,
#lf-editor-container #lf-edit-preview-map .leaflet-pane {
    z-index: 0 !important;
}

#lf-editor-container #lf-edit-preview-map .leaflet-tile-pane { z-index: 1 !important; }
#lf-editor-container #lf-edit-preview-map .leaflet-overlay-pane { z-index: 2 !important; }
#lf-editor-container #lf-edit-preview-map .leaflet-shadow-pane { z-index: 3 !important; }
#lf-editor-container #lf-edit-preview-map .leaflet-marker-pane { z-index: 4 !important; }
#lf-editor-container #lf-edit-preview-map .leaflet-tooltip-pane { z-index: 5 !important; }
#lf-editor-container #lf-edit-preview-map .leaflet-popup-pane { z-index: 6 !important; }
#lf-editor-container #lf-edit-preview-map .leaflet-control-container,
#lf-editor-container #lf-edit-preview-map .leaflet-top,
#lf-editor-container #lf-edit-preview-map .leaflet-bottom,
#lf-editor-container #lf-edit-preview-map .leaflet-control {
    z-index: 7 !important;
}

/* ========================================
   STICKY SAVE BAR (Frontend Editor)
======================================== */

#lf-editor-container .lf-editor-save-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 16px;
    z-index: 45;
    display: none;
    justify-content: center;
    padding: 0 1rem;
    pointer-events: none;
}

#lf-editor-container .lf-editor-save-bar.is-visible {
    display: flex;
}

#lf-editor-container .lf-editor-save-bar.is-static {
    position: static;
    left: auto;
    right: auto;
    bottom: auto;
    padding: 0;
    margin-top: 1.25rem;
    justify-content: center;
    pointer-events: auto;
}

#lf-editor-container .lf-editor-save-bar.is-static .lf-editor-save-bar-inner {
    width: auto;
    max-width: none;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
    gap: 0;
}

#lf-editor-container .lf-editor-save-bar.is-static .lf-editor-save-hint {
    display: none;
}

#lf-editor-container .lf-editor-save-bar-inner {
    width: 100%;
    max-width: 640px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px;
    border-radius: 14px;
    border: 1px solid rgb(var(--border));
    background: rgb(var(--card) / 0.96);
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.16);
    backdrop-filter: blur(10px);
    pointer-events: auto;
}

#lf-editor-container .lf-editor-save-hint {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: rgb(var(--muted-foreground));
}

#lf-editor-container #lf-editor-save-btn {
    white-space: nowrap;
}

/* ========================================
   MEINE STANDORTE (Mobile)
======================================== */

#lf-my-locations-list .lf-my-location-card {
    width: 100%;
}

#lf-my-locations-list .lf-my-location-main {
    width: 100%;
}

#lf-my-locations-list .lf-my-location-content {
    flex: 1;
}

#lf-my-locations-list .lf-my-location-actions {
    width: 100%;
}

@media (max-width: 640px) {
    /* Robust mobile layout for "Meine Standorte" cards
       (works for current and previously cached JS markup) */
    #lf-my-locations-list > [data-id] {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.75rem !important;
        padding: 0.9rem !important;
        border-radius: 0.9rem !important;
    }

    #lf-my-locations-list > [data-id] > div:first-child {
        width: 100%;
        min-width: 0;
    }

    #lf-my-locations-list > [data-id] > div:last-child {
        width: 100%;
        margin-left: 0 !important;
        justify-content: flex-end !important;
    }

    #lf-my-locations-list > [data-id] h2,
    #lf-my-locations-list > [data-id] h3 {
        word-break: break-word;
    }

    #lf-my-locations-list {
        gap: 0.75rem !important;
    }

    #lf-my-locations-list .lf-my-location-card {
        padding: 0.9rem !important;
        border-radius: 0.9rem;
    }

    #lf-my-locations-list .lf-my-location-actions {
        justify-content: flex-end;
    }

    #lf-editor-container .lf-editor-save-bar-inner {
        flex-direction: column;
        align-items: stretch;
    }

    #lf-editor-container #lf-editor-save-btn {
        width: 100%;
        justify-content: center;
    }
}
