:root {
    --bg-primary: #0f1419;
    --bg-secondary: #1a1f26;
    --bg-card: #242b33;
    --accent: #e8c547;
    --accent-soft: rgba(232, 197, 71, 0.15);
    --accent-hover: #f5d45a;
    --text-primary: #f7f9fa;
    --text-secondary: #8b98a5;
    --text-muted: #536471;
    --border: #2f3942;
    --success: #00ba7c;
    --warning: #ff9f43;
    --error: #f44336;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    font-family: 'Source Sans 3', -apple-system, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Animated background pattern */
.bg-pattern {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(ellipse at 20% 20%, rgba(232, 197, 71, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(232, 197, 71, 0.05) 0%, transparent 50%),
        linear-gradient(180deg, var(--bg-primary) 0%, #0a0d10 100%);
    z-index: -1;
}

.container {
    max-width: 1800px;
    margin: 0 auto;
    padding: 1rem 1.5rem;
    height: calc(100vh - 2rem);
    display: flex;
    flex-direction: column;
}

/* Header */
header {
    text-align: center;
    padding: 0.75rem 0;
    animation: fadeInDown 0.8s ease-out;
    flex-shrink: 0;
}

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

h1 {
    font-family: 'Playfair Display', serif;
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.15rem;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 300;
    letter-spacing: 0.5px;
}

/* Main Content Layout */
.main-content {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 1.25rem;
    flex: 1;
    min-height: 0;
    animation: fadeIn 1s ease-out 0.3s both;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.sidebar {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-height: 0;
    overflow: hidden;
}

.right-column {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-height: 0;
}

/* Card Component */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem;
    transition: all 0.3s ease;
}

.card:hover {
    border-color: var(--accent);
    box-shadow: 0 0 30px rgba(232, 197, 71, 0.08);
}

.card-title {
    font-family: 'Playfair Display', serif;
    font-size: 1rem;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-title::before {
    content: '';
    width: 3px;
    height: 16px;
    background: var(--accent);
    border-radius: 2px;
}

/* Filter Card */
.filter-card {
    flex-shrink: 0;
    max-height: 60vh;
    overflow-y: auto;
}

.filter-card::-webkit-scrollbar {
    width: 5px;
}

.filter-card::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 3px;
}

.filter-card::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

/* Filter Group */
.filter-group {
    margin-bottom: 0.6rem;
}

.filter-label {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Multi-Select Component */
.multi-select {
    position: relative;
}

.multi-select-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 0.85rem;
    background: var(--bg-secondary);
    border: 2px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.multi-select-header:hover {
    border-color: var(--accent);
}

.multi-select.open .multi-select-header {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.multi-select.disabled .multi-select-header {
    opacity: 0.5;
    cursor: not-allowed;
}

.multi-select.disabled .multi-select-header:hover {
    border-color: var(--border);
}

.multi-select-text {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.multi-select-arrow {
    font-size: 0.55rem;
    color: var(--accent);
    transition: transform 0.2s ease;
}

.multi-select.open .multi-select-arrow {
    transform: rotate(180deg);
}

.multi-select-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 2px solid var(--accent);
    border-radius: 8px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 100;
    display: none;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

.multi-select.open .multi-select-dropdown {
    display: block;
}

.multi-select-dropdown::-webkit-scrollbar {
    width: 5px;
}

.multi-select-dropdown::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

.multi-select-dropdown::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.multi-select-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    transition: background 0.15s ease;
}

.multi-select-option:hover {
    background: var(--bg-secondary);
}

.multi-select-option input[type="checkbox"] {
    width: 14px;
    height: 14px;
    accent-color: var(--accent);
    cursor: pointer;
}

.multi-select-option span {
    font-size: 0.85rem;
    color: var(--text-primary);
}

/* Selected Tags */
.selected-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.35rem;
}

.tag {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.5rem;
    background: var(--accent-soft);
    border: 1px solid var(--accent);
    border-radius: 4px;
    font-size: 0.7rem;
    color: var(--accent);
    font-weight: 500;
}

.tag button {
    background: none;
    border: none;
    color: var(--accent);
    cursor: pointer;
    font-size: 0.85rem;
    line-height: 1;
    padding: 0;
    margin-left: 0.15rem;
    opacity: 0.7;
}

.tag button:hover {
    opacity: 1;
}

/* Filter Actions */
.filter-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.6rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.5rem 0.75rem;
    border: none;
    border-radius: 6px;
    font-family: 'Source Sans 3', sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    flex: 1;
}

.btn svg {
    width: 13px;
    height: 13px;
}

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

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(232, 197, 71, 0.3);
}

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

.btn-secondary:hover {
    border-color: var(--text-secondary);
    color: var(--text-primary);
}

/* Results Count */
.results-count {
    text-align: center;
    padding: 0.5rem;
    margin-top: 0.6rem;
    background: var(--bg-secondary);
    border-radius: 6px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.results-count span {
    font-weight: 700;
    color: var(--accent);
    font-size: 0.95rem;
}

/* Negocios List Card */
.negocios-list-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.negocios-list {
    flex: 1;
    overflow-y: auto;
    margin: -0.25rem;
    padding: 0.25rem;
}

.negocios-list::-webkit-scrollbar {
    width: 5px;
}

.negocios-list::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 3px;
}

.negocios-list::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.negocios-list::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

.list-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100px;
    color: var(--text-muted);
    text-align: center;
    font-size: 0.85rem;
}

.list-placeholder.error {
    color: var(--error);
}

/* Negocio List Item */
.negocio-item {
    padding: 0.6rem 0.75rem;
    background: var(--bg-secondary);
    border-radius: 6px;
    margin-bottom: 0.4rem;
    cursor: pointer;
    transition: all 0.15s ease;
    border: 2px solid transparent;
}

.negocio-item:hover {
    border-color: var(--border);
    background: var(--bg-card);
}

.negocio-item.active {
    border-color: var(--accent);
    background: var(--accent-soft);
}

.negocio-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.4rem;
    margin-bottom: 0.25rem;
}

.negocio-item-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.88rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.coords-indicator {
    font-size: 0.7rem;
    flex-shrink: 0;
}

.coords-indicator.exact {
    color: var(--success);
}

.coords-indicator.approx {
    color: var(--warning);
}

.negocio-item-details {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.negocio-item-separator {
    color: var(--border);
}

.negocio-item-location {
    color: var(--text-secondary);
}

.negocio-item-industry {
    color: var(--accent);
    opacity: 0.8;
}

.negocio-item-tiempo {
    color: var(--text-muted);
}

/* Company Info Section */
.company-info {
    flex-shrink: 0;
}

.info-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 120px;
    color: var(--text-muted);
    text-align: center;
}

.info-placeholder svg {
    width: 40px;
    height: 40px;
    margin-bottom: 0.5rem;
    opacity: 0.5;
}

.info-placeholder p {
    font-size: 0.85rem;
}

/* Images Section */
.images-section {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    justify-content: center;
}

.image-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
}

.image-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    font-weight: 600;
}

.negocio-image {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 10px;
    border: 2px solid var(--border);
    background: var(--bg-secondary);
    transition: all 0.3s ease;
}

.negocio-image:hover {
    border-color: var(--accent);
    transform: scale(1.05);
    box-shadow: 0 4px 20px rgba(232, 197, 71, 0.2);
}

.logo-container .negocio-image {
    border-radius: 10px;
}

.owner-container .negocio-image {
    border-radius: 50%;
}

.company-name {
    font-family: 'Playfair Display', serif;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    text-align: center;
    margin-bottom: 0.4rem;
}

.company-description {
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 0.75rem;
    font-size: 0.85rem;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.6rem;
}

.info-item {
    background: var(--bg-secondary);
    padding: 0.6rem;
    border-radius: 6px;
    border-left: 3px solid var(--accent);
}

.info-label {
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 0.15rem;
}

.info-value {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.8rem;
}

/* Contact Section */
.contact-section {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}

.section-title {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
}

.contact-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.contact-item svg {
    color: var(--accent);
    flex-shrink: 0;
    width: 14px;
    height: 14px;
}

.redes-sociales {
    margin-top: 0.4rem;
    padding: 0.5rem;
    background: var(--bg-secondary);
    border-radius: 5px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Coordinates Badge */
.coords-badge {
    margin-top: 0.6rem;
    text-align: right;
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-exact {
    background: rgba(0, 186, 124, 0.15);
    color: var(--success);
}

.badge-approx {
    background: rgba(255, 159, 67, 0.15);
    color: var(--warning);
}

/* Map Container */
.map-wrapper {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    flex: 1;
    min-height: 300px;
}

#map {
    height: 100%;
    width: 100%;
    filter: saturate(0.8) contrast(1.05);
}

.map-overlay {
    position: absolute;
    bottom: 0.75rem;
    left: 0.75rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 0.4rem 0.75rem;
    border-radius: 6px;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.map-overlay .dot {
    width: 6px;
    height: 6px;
    background: var(--success);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.map-overlay span {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Custom Marker */
.custom-marker {
    background: var(--text-secondary);
    width: 24px;
    height: 24px;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    transition: all 0.2s ease;
    cursor: pointer;
}

.custom-marker::after {
    content: '';
    width: 8px;
    height: 8px;
    background: var(--bg-primary);
    border-radius: 50%;
    transform: rotate(45deg);
}

.custom-marker.approx {
    background: var(--warning);
    opacity: 0.85;
}

.custom-marker.active {
    background: var(--accent);
    width: 32px;
    height: 32px;
    box-shadow: 0 4px 20px rgba(232, 197, 71, 0.6);
    animation: markerPulse 2s ease-in-out infinite;
}

.custom-marker.active::after {
    width: 12px;
    height: 12px;
}

.custom-marker.active.approx {
    background: var(--warning);
    box-shadow: 0 4px 20px rgba(255, 159, 67, 0.6);
    animation: markerPulseOrange 2s ease-in-out infinite;
}

@keyframes markerPulse {
    0%, 100% { box-shadow: 0 4px 20px rgba(232, 197, 71, 0.6); }
    50% { box-shadow: 0 4px 30px rgba(232, 197, 71, 0.9); }
}

@keyframes markerPulseOrange {
    0%, 100% { box-shadow: 0 4px 20px rgba(255, 159, 67, 0.6); }
    50% { box-shadow: 0 4px 30px rgba(255, 159, 67, 0.9); }
}

.custom-marker-wrapper:hover .custom-marker:not(.active) {
    background: var(--accent);
    width: 28px;
    height: 28px;
}

.custom-marker-wrapper:hover .custom-marker.approx:not(.active) {
    background: var(--warning);
}

.custom-marker-wrapper:hover .custom-marker:not(.active)::after {
    width: 10px;
    height: 10px;
}

/* Leaflet Popup Customization */
.leaflet-popup-content-wrapper {
    background: var(--bg-card) !important;
    border: 1px solid var(--border) !important;
    border-radius: 8px !important;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5) !important;
}

.leaflet-popup-content {
    color: var(--text-primary) !important;
    font-family: 'Source Sans 3', sans-serif !important;
    margin: 0.6rem !important;
}

.leaflet-popup-tip {
    background: var(--bg-card) !important;
    border: 1px solid var(--border) !important;
}

.popup-title {
    font-family: 'Playfair Display', serif;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 0.2rem;
}

.popup-location {
    color: var(--text-secondary);
    font-size: 0.8rem;
    margin-bottom: 0.15rem;
}

.popup-industry {
    color: var(--text-muted);
    font-size: 0.7rem;
    font-style: italic;
}

.popup-badge {
    margin-top: 0.35rem;
    padding: 0.15rem 0.35rem;
    background: rgba(255, 159, 67, 0.15);
    color: var(--warning);
    border-radius: 3px;
    font-size: 0.65rem;
    text-align: center;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .main-content {
        grid-template-columns: 340px 1fr;
    }
    
    .info-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 900px) {
    .container {
        height: auto;
        min-height: 100vh;
    }
    
    .main-content {
        grid-template-columns: 1fr;
    }

    .map-wrapper {
        min-height: 350px;
    }
    
    .right-column {
        min-height: 500px;
    }

    h1 {
        font-size: 1.75rem;
    }
    
    .filter-actions {
        flex-direction: column;
    }
    
    .negocios-list-card {
        max-height: 250px;
    }
    
    .info-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .filter-card {
        max-height: none;
    }
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--border);
    border-radius: 50%;
    border-top-color: var(--accent);
    animation: spin 1s linear infinite;
}

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