/**
 * ═══════════════════════════════════════════════════════════════════════════
 * SMART POI CREATOR - Styles
 * Developed by Toni Sciacca - mail@tonisciacca.com
 * ═══════════════════════════════════════════════════════════════════════════
 */

/* ═══════════════════ MODAL CONTAINER ═══════════════════ */
#smartPoiModal {
    z-index: 9500;
}

#smartPoiModal .smart-poi-modal {
    width: 95vw;
    max-width: 1000px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

#smartPoiModal .modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

#smartPoiModal .modal-header h2 {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 20px;
    font-weight: 600;
    margin: 0;
}

#smartPoiModal .modal-header h2 [data-lucide] {
    width: 24px;
    height: 24px;
    color: var(--primary);
}

/* ═══════════════════ BODY LAYOUT ═══════════════════ */
.smart-poi-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    flex: 1;
    overflow: hidden;
}

/* ═══════════════════ MAP SECTION ═══════════════════ */
.smart-poi-map-section {
    position: relative;
    background: var(--gray-100);
    min-height: 400px;
}

.smart-poi-map {
    width: 100%;
    height: 100%;
    min-height: 400px;
}

.smart-poi-map-hint {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: rgba(0, 0, 0, 0.75);
    color: white;
    border-radius: 50px;
    font-size: 13px;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.smart-poi-map-hint [data-lucide] {
    width: 16px;
    height: 16px;
}

.smart-poi-map-section.has-marker .smart-poi-map-hint {
    opacity: 0;
}

/* ═══════════════════ FORM SECTION ═══════════════════ */
.smart-poi-form-section {
    padding: 24px;
    overflow-y: auto;
    background: var(--bg-primary);
}

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

#smartPoiForm .form-group:last-child {
    margin-bottom: 0;
}

#smartPoiForm label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

#smartPoiForm label [data-lucide] {
    width: 14px;
    height: 14px;
}

#smartPoiForm label .required {
    color: var(--error);
}

#smartPoiForm input[type="text"],
#smartPoiForm input[type="url"],
#smartPoiForm textarea,
#smartPoiForm select {
    width: 100%;
    padding: 12px 14px;
    font-size: 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    background: var(--bg-primary);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

#smartPoiForm input:focus,
#smartPoiForm textarea:focus,
#smartPoiForm select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(255, 56, 92, 0.1);
}

#smartPoiForm input[readonly] {
    background: var(--gray-100);
    color: var(--text-secondary);
    cursor: default;
}

#smartPoiForm textarea {
    resize: vertical;
    min-height: 80px;
}

/* ═══════════════════ ADDRESS SEARCH ═══════════════════ */
.smart-poi-address-group {
    position: relative;
}

.smart-poi-address-input-wrapper {
    display: flex;
    gap: 8px;
}

.smart-poi-address-input-wrapper input {
    flex: 1;
}

.btn-search-address {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: background 0.2s ease;
}

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

.btn-search-address [data-lucide] {
    width: 18px;
    height: 18px;
}

/* Suggestions Dropdown */
.smart-poi-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    box-shadow: var(--shadow-lg);
    z-index: 100;
    max-height: 250px;
    overflow-y: auto;
    display: none;
}

.smart-poi-suggestions.active {
    display: block;
}

.smart-poi-suggestion-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px;
    cursor: pointer;
    border-bottom: 1px solid var(--gray-100);
    transition: background 0.15s ease;
}

.smart-poi-suggestion-item:last-child {
    border-bottom: none;
}

.smart-poi-suggestion-item:hover {
    background: var(--gray-50);
}

.smart-poi-suggestion-item [data-lucide] {
    width: 18px;
    height: 18px;
    color: var(--text-secondary);
    flex-shrink: 0;
    margin-top: 2px;
}

.smart-poi-suggestion-text {
    flex: 1;
    min-width: 0;
}

.smart-poi-suggestion-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.smart-poi-suggestion-address {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.smart-poi-suggestions-loading {
    padding: 20px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 13px;
}

.smart-poi-suggestions-empty {
    padding: 20px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 13px;
}

/* ═══════════════════ COORDINATES ROW ═══════════════════ */
.smart-poi-coords-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.smart-poi-coords-row input {
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 13px;
}

/* ═══════════════════ DIVIDER ═══════════════════ */
.smart-poi-divider {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 24px 0;
}

/* ═══════════════════ CATEGORY GRID ═══════════════════ */
.smart-poi-category-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.smart-poi-category-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 8px;
    background: var(--gray-50);
    border: 2px solid transparent;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
}

.smart-poi-category-btn:hover {
    background: var(--gray-100);
}

.smart-poi-category-btn.active {
    background: rgba(255, 56, 92, 0.08);
    border-color: var(--primary);
}

.smart-poi-category-btn [data-lucide] {
    width: 20px;
    height: 20px;
    color: var(--text-secondary);
}

.smart-poi-category-btn.active [data-lucide] {
    color: var(--primary);
}

.smart-poi-category-btn span {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
    text-align: center;
    line-height: 1.2;
}

.smart-poi-category-btn.active span {
    color: var(--primary);
}

/* ═══════════════════ SUBCATEGORY DROPDOWN ═══════════════════ */
.smart-poi-subcategory-dropdown {
    position: relative;
    margin-top: 12px;
    padding: 16px;
    background: linear-gradient(135deg, rgba(255, 56, 92, 0.03) 0%, rgba(255, 56, 92, 0.07) 100%);
    border: 1px solid rgba(255, 56, 92, 0.12);
    border-radius: 12px;
    animation: slideDown 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.smart-poi-subcategory-dropdown::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 28px;
    width: 14px;
    height: 14px;
    background: linear-gradient(135deg, rgba(255, 56, 92, 0.03) 0%, rgba(255, 56, 92, 0.07) 100%);
    border-left: 1px solid rgba(255, 56, 92, 0.12);
    border-top: 1px solid rgba(255, 56, 92, 0.12);
    transform: rotate(45deg);
}

.smart-poi-subcategory-dropdown .subcategory-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 10px;
}

.smart-poi-subcategory-dropdown .subcategory-label [data-lucide] {
    width: 14px;
    height: 14px;
}

.smart-poi-subcategory-dropdown select {
    width: 100%;
    padding: 14px 44px 14px 16px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    background: white;
    border: 2px solid rgba(255, 56, 92, 0.15);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23FF385C' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    box-shadow: 0 2px 8px rgba(255, 56, 92, 0.08);
}

.smart-poi-subcategory-dropdown select:hover {
    border-color: rgba(255, 56, 92, 0.3);
    box-shadow: 0 4px 12px rgba(255, 56, 92, 0.12);
}

.smart-poi-subcategory-dropdown select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(255, 56, 92, 0.12), 0 4px 12px rgba(255, 56, 92, 0.15);
}

.smart-poi-subcategory-dropdown select option {
    padding: 12px;
    font-size: 14px;
    font-weight: 400;
}

.smart-poi-subcategory-dropdown select option:first-child {
    color: var(--text-secondary);
}

/* ═══════════════════ AI BUTTON ═══════════════════ */
.btn-ai-suggest {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    padding: 8px 14px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--gray-50);
    border: 1px solid var(--border-color);
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-ai-suggest:hover {
    background: var(--gray-100);
    color: var(--text-primary);
}

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

.btn-ai-suggest [data-lucide] {
    width: 14px;
    height: 14px;
}

.btn-ai-suggest.loading [data-lucide] {
    animation: spin 1s linear infinite;
}

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

/* ═══════════════════ EXTRAS SECTION ═══════════════════ */
.smart-poi-extras {
    margin-top: 20px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
}

.smart-poi-extras summary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    list-style: none;
}

.smart-poi-extras summary::-webkit-details-marker {
    display: none;
}

.smart-poi-extras summary [data-lucide] {
    width: 16px;
    height: 16px;
}

.smart-poi-extras summary:hover {
    color: var(--text-primary);
}

.smart-poi-extras[open] summary {
    border-bottom: 1px solid var(--border-color);
}

.smart-poi-extras-content {
    padding: 16px 14px;
}

.smart-poi-extras-content .form-group {
    margin-bottom: 16px;
}

.smart-poi-extras-content .form-group:last-child {
    margin-bottom: 0;
}

/* ═══════════════════ FOOTER ═══════════════════ */
#smartPoiModal .modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    flex-shrink: 0;
}

#smartPoiModal .btn-secondary {
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    background: var(--gray-100);
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: background 0.2s ease;
}

#smartPoiModal .btn-secondary:hover {
    background: var(--gray-200);
}

#smartPoiModal .btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 600;
    color: white;
    background: var(--primary);
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: background 0.2s ease;
}

#smartPoiModal .btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
}

#smartPoiModal .btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#smartPoiModal .btn-primary [data-lucide] {
    width: 18px;
    height: 18px;
}

/* ═══════════════════ LEAFLET MARKER OVERRIDE ═══════════════════ */
.smart-poi-marker {
    width: 40px !important;
    height: 40px !important;
    margin-left: -20px !important;
    margin-top: -40px !important;
}

.smart-poi-marker-inner {
    width: 40px;
    height: 40px;
    background: var(--primary);
    border: 3px solid white;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
}

.smart-poi-marker-inner [data-lucide] {
    width: 18px;
    height: 18px;
    color: white;
    transform: rotate(45deg);
}

/* ═══════════════════ RESPONSIVE ═══════════════════ */
@media (max-width: 768px) {
    #smartPoiModal .smart-poi-modal {
        width: 100%;
        max-width: 100%;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }

    .smart-poi-body {
        grid-template-columns: 1fr;
        grid-template-rows: 250px 1fr;
    }

    .smart-poi-map-section {
        min-height: 250px;
    }

    .smart-poi-map {
        min-height: 250px;
    }

    .smart-poi-category-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .smart-poi-subcategory-dropdown::before {
        display: none;
    }
}
