/* ===========================
   CSS Variables & Reset
   =========================== */
:root {
    /* Colors */
    --primary-50: #e6f7ff;
    --primary-100: #bae7ff;
    --primary-200: #91d5ff;
    --primary-300: #69c0ff;
    --primary-400: #40a9ff;
    --primary-500: #1890ff;
    --primary-600: #096dd9;
    --primary-700: #0050b3;
    --primary-800: #003a8c;
    --primary-900: #002766;
    
    --cyan-400: #00b4d8;
    --cyan-500: #0096c7;
    --cyan-600: #0077b6;
    --cyan-700: #023e8a;
    
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    
    --success-500: #10b981;
    --warning-500: #f59e0b;
    --error-500: #ef4444;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    
    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 350ms ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
    min-height: 100vh;
    color: var(--gray-100);
    line-height: 1.6;
}

/* ===========================
   App Container
   =========================== */
.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ===========================
   Header
   =========================== */
.header {
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1920px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-icon {
    width: 48px;
    height: 48px;
}

.logo-icon svg {
    width: 100%;
    height: 100%;
}

.logo-text {
    display: flex;
    flex-direction: column;
}

.logo-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--cyan-400);
    letter-spacing: 0.05em;
}

.logo-subtitle {
    font-size: 0.875rem;
    color: var(--gray-400);
    font-weight: 400;
}

/* ===========================
   Main Content
   =========================== */
.main-content {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 1.5rem;
    padding: 1.5rem 2rem;
    flex: 1;
    max-width: 1920px;
    margin: 0 auto;
    width: 100%;
}

/* ===========================
   Filters Panel
   =========================== */
.filters-panel {
    background: rgba(30, 41, 59, 0.8);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    height: fit-content;
    position: sticky;
    top: 100px;
}

.panel-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: white;
    margin-bottom: 0.25rem;
}

.panel-description {
    font-size: 0.875rem;
    color: var(--gray-400);
}

/* Filter Groups */
.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.filter-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-300);
}

.label-icon {
    font-size: 1rem;
}

/* Select Input */
.select-input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    color: white;
    font-size: 0.9375rem;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-fast);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%239ca3af'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1.25rem;
    padding-right: 2.5rem;
}

.select-input:hover:not(:disabled) {
    border-color: var(--cyan-400);
    background-color: rgba(15, 23, 42, 0.8);
}

.select-input:focus {
    outline: none;
    border-color: var(--cyan-400);
    box-shadow: 0 0 0 3px rgba(0, 180, 216, 0.2);
}

.select-input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.select-input option {
    background: var(--gray-800);
    color: white;
    padding: 0.5rem;
}

/* Text Input */
.text-input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    color: white;
    font-size: 0.9375rem;
    font-family: inherit;
    transition: all var(--transition-fast);
}

.text-input:hover {
    border-color: var(--cyan-400);
}

.text-input:focus {
    outline: none;
    border-color: var(--cyan-400);
    box-shadow: 0 0 0 3px rgba(0, 180, 216, 0.2);
}

.text-input::placeholder {
    color: var(--gray-500);
}

/* ===========================
   Buttons
   =========================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    font-family: inherit;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(135deg, var(--cyan-400) 0%, var(--cyan-600) 100%);
    color: white;
    box-shadow: 0 4px 14px 0 rgba(0, 180, 216, 0.35);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px 0 rgba(0, 180, 216, 0.45);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-secondary:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--cyan-400);
}

.btn-large {
    padding: 1rem 1.5rem;
    font-size: 1rem;
    width: 100%;
    margin-top: 0.5rem;
}

.btn-icon {
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    color: white;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.2);
}

.btn-text {
    background: none;
    border: none;
    color: var(--cyan-400);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    transition: color var(--transition-fast);
}

.btn-text:hover {
    color: var(--cyan-300);
}

/* ===========================
   Selected Manzanas
   =========================== */
.selected-manzanas {
    background: rgba(15, 23, 42, 0.4);
    border-radius: var(--radius-lg);
    padding: 1rem;
}

.selected-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.selected-header h3 {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--gray-200);
}

.manzanas-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 200px;
    overflow-y: auto;
}

.manzanas-list::-webkit-scrollbar {
    width: 6px;
}

.manzanas-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.manzanas-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.manzana-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(0, 180, 216, 0.1);
    border: 1px solid rgba(0, 180, 216, 0.3);
    border-radius: var(--radius-md);
    padding: 0.625rem 0.875rem;
    animation: slideIn 0.2s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.manzana-info {
    display: flex;
    gap: 1rem;
    font-size: 0.8125rem;
}

.manzana-info span {
    color: var(--gray-300);
}

.manzana-info strong {
    color: var(--cyan-400);
    font-weight: 600;
}

.manzana-remove {
    background: none;
    border: none;
    color: var(--gray-400);
    cursor: pointer;
    padding: 0.25rem;
    font-size: 1rem;
    line-height: 1;
    transition: color var(--transition-fast);
}

.manzana-remove:hover {
    color: var(--error-500);
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.5rem;
    color: var(--gray-500);
}

.empty-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    opacity: 0.5;
}

.empty-state p {
    font-size: 0.875rem;
}

/* ===========================
   Map Preview Section
   =========================== */
.map-preview-section {
    background: rgba(30, 41, 59, 0.8);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-xl);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.preview-header h2 {
    font-size: 1.125rem;
    font-weight: 600;
    color: white;
}

.preview-controls {
    display: flex;
    gap: 0.5rem;
}

.map-container {
    flex: 1;
    min-height: 500px;
    position: relative;
    background: var(--gray-900);
}

.map-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.9) 0%, rgba(30, 41, 59, 0.9) 100%);
}

.placeholder-content {
    text-align: center;
    color: var(--gray-400);
}

.placeholder-icon {
    font-size: 4rem;
    opacity: 0.3;
    display: block;
    margin-bottom: 1rem;
}

.placeholder-content h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--gray-300);
    margin-bottom: 0.5rem;
}

.placeholder-content p {
    font-size: 0.9375rem;
}

.map-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: white;
}

.map-loading {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.9);
    color: var(--gray-300);
}

.spinner {
    width: 48px;
    height: 48px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--cyan-400);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ===========================
   Loading Overlay
   =========================== */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-content {
    text-align: center;
    color: white;
}

.loading-spinner {
    width: 64px;
    height: 64px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--cyan-400);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1.5rem;
}

.loading-content h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.loading-content p {
    color: var(--gray-400);
}

/* ===========================
   Responsive
   =========================== */
@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
    }
    
    .filters-panel {
        position: static;
    }
}

@media (max-width: 640px) {
    .header {
        padding: 1rem;
    }
    
    .main-content {
        padding: 1rem;
    }
    
    .logo-subtitle {
        display: none;
    }
}
