/* Feature Area Creator Modal - Based on upload center styles */

.feature-area-creator-root {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: none;
    pointer-events: none;
}

.feature-area-creator-root[aria-hidden="false"] {
    display: flex;
    pointer-events: auto;
}

.feature-area-creator-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(3px);
    cursor: pointer;
}

.feature-area-creator-shell {
    position: relative;
    margin: auto;
    width: min(90vw, 600px);
    max-height: 90vh;
    background: #101018;
    border: 1px solid #00ff88;
    border-radius: 18px;
    box-shadow: 0 0 22px -4px rgba(0, 255, 136, 0.45), 0 0 3px 1px rgba(0, 255, 136, 0.35) inset;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modalSlideIn 0.3s ease-out;
}

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

/* Header */
.fac-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 20px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.fac-header h2 {
    margin: 0;
    min-width: 0; /* allow truncation */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #00ff88; /* neon green title to match standard */
    text-shadow: 0 0 8px rgba(0,255,136,0.35);
}

/* Close button (outline, matches header buttons) */
.fac-close-btn {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto; /* prevent wrapping/shrinking */
    border-radius: 8px;
    background: rgba(var(--dark-color-rgb), 0.6);
    border: 1px solid var(--secondary-color);
    color: var(--primary-color);
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease, transform .15s ease;
    font-size: 18px;
    line-height: 1;
    opacity: .9;
}
.fac-close-btn:hover, .fac-close-btn:focus-visible { background: rgba(var(--dark-color-rgb), 0.8); border-color: var(--primary-color); opacity: 1; transform: translateY(-1px); }
.fac-close-btn:active { transform: translateY(0) scale(1); }

@media (max-width:560px){ .fac-header { padding-right:56px; position:relative; } .fac-close-btn { position:absolute; top:14px; right:14px; } }

/* Main Content */
.fac-main {
    padding: 14px 20px;
    overflow-y: auto;
    flex: 1;
    background: #101018;
}

.fac-section {
    background: #0b0b11;
    border: 1px solid rgba(0, 255, 136, 0.35);
    border-radius: 14px;
    padding: 14px;
    margin-bottom: 14px;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.fac-section:last-child {
    margin-bottom: 0;
}

.fac-section h3 {
    margin: 0 0 6px 0;
    color: #8ff6ff;
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 1px;
}

.fac-instruction {
    margin: 0 0 16px 0;
    color: #b8b8b8;
    font-size: 0.85rem;
    line-height: 1.35;
}

/* Location Controls */
.fac-location-controls {
    margin-bottom: 16px;
}

.fac-coord-row {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    gap: 12px;
}

.fac-coord-row label {
    color: #d6d6d6;
    font-size: 0.85rem;
    min-width: 80px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.fac-coord-row input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid rgba(0, 255, 136, 0.35);
    border-radius: 8px;
    background: #14141d;
    color: #dcdcdc;
    font-size: 0.85rem;
    transition: border-color 0.2s ease;
}

.fac-coord-row input:focus {
    outline: none;
    border-color: #00ff88;
    box-shadow: 0 0 0 2px rgba(0, 255, 136, 0.2);
}

.fac-coord-row input[readonly] {
    background: #0b0b11;
    color: #8f8f8f;
    cursor: not-allowed;
}

/* Map Controls */
.fac-map-controls {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* Form Groups */
.fac-form-group {
    margin-bottom: 20px;
}

.fac-form-group label {
    display: block;
    color: #d6d6d6;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.fac-form-group input,
.fac-form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid rgba(0, 255, 136, 0.35);
    border-radius: 8px;
    background: #14141d;
    color: #dcdcdc;
    font-size: 0.85rem;
    font-family: inherit;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
}

.fac-form-group input:focus,
.fac-form-group textarea:focus {
    outline: none;
    border-color: #00ff88;
    box-shadow: 0 0 0 2px rgba(0, 255, 136, 0.2);
}

.fac-form-group textarea {
    resize: vertical;
    min-height: 80px;
}

/* Buttons */
.fac-btn {
    padding: 8px 18px;
    border: none;
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 36px;
    letter-spacing: 0.5px;
}

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

.fac-btn-primary {
    background: #FFD400;
    color: #000;
    border: none;
    font-weight: 700;
}

.fac-btn-primary:hover:not(:disabled) {
    background: #e6c000;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(255, 212, 0, 0.3);
}

.fac-btn-secondary {
    background: none;
    color: #d6d6d6;
    border: 1px solid #00ff88;
}

.fac-btn-secondary:hover:not(:disabled) {
    background: #00ff8815;
    border-color: #00ff88;
    color: #d6d6d6;
}

.fac-btn-save {
    background: #00ff88;
    color: #000;
    border: none;
    font-weight: 700;
}

.fac-btn-save:hover:not(:disabled) {
    background: #00e67d;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 255, 136, 0.3);
}

.fac-btn-auth-required {
    background: #FFD400 !important;
    color: #000 !important;
    border: none !important;
    font-weight: 700 !important;
}

.fac-btn-auth-required:hover:not(:disabled) {
    background: #e6c000 !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(255, 212, 0, 0.3);
}

.fac-btn-cancel {
    background: none;
    color: #d6d6d6;
    border: 1px solid #00ff88;
}

.fac-btn-cancel:hover {
    background: #00ff8815;
    border-color: #ff6060;
    color: #ff6060;
}

/* Footer */
.fac-footer {
    padding: 12px 20px 18px;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    background: #101018;
}

/* Responsive Design */
@media (max-width: 768px) {
    .feature-area-creator-shell {
        width: 95vw;
        margin: 20px auto;
        max-height: calc(100vh - 40px);
    }
    
    .fac-header,
    .fac-main,
    .fac-footer {
        padding-left: 16px;
        padding-right: 16px;
    }
    
    .fac-coord-row {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
    }
    
    .fac-coord-row label {
        min-width: auto;
    }
    
    .fac-footer {
        flex-direction: column-reverse;
    }
    
    .fac-footer .fac-btn {
        width: 100%;
    }
    
    .fac-map-controls {
        flex-direction: column;
    }
    
    .fac-map-controls .fac-btn {
        width: 100%;
    }
}

/* Status Indicators */
.fac-location-set {
    background: #00ff88 !important;
    color: #000 !important;
    font-weight: 700 !important;
}

.fac-location-set:hover:not(:disabled) {
    background: #00e67d !important;
}

/* Validation States */
.fac-form-group.error input,
.fac-form-group.error textarea {
    border-color: #ff6060;
    box-shadow: 0 0 0 2px rgba(255, 96, 96, 0.2);
}

.fac-error-message {
    color: #ff6060;
    font-size: 0.75rem;
    margin-top: 4px;
    display: block;
    letter-spacing: 0.5px;
}

/* Loading State */
.fac-btn.loading {
    position: relative;
    color: transparent;
}

.fac-btn.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: inherit;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Cursor override helpers applied to Mapbox GL container during drawing */
.rm-map-cursor-center,
.rm-map-cursor-center * {
    cursor: crosshair !important;
}

.rm-map-cursor-radius,
.rm-map-cursor-radius * {
    cursor: zoom-in !important;
}