:root {
    --bg-color: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --accent: #8b5cf6;
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --border: rgba(255, 255, 255, 0.1);
    --shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    --glow: radial-gradient(circle at 50% 50%, rgba(59, 130, 246, 0.15), transparent 60%);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
}

.background-glow {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--glow);
    z-index: -1;
    pointer-events: none;
}

.container {
    width: 100%;
    max-width: 900px;
    padding: 2rem;
    animation: fadeIn 0.8s ease-out;
}

header {
    text-align: center;
    margin-bottom: 3rem;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, #60a5fa, #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

header p {
    color: var(--text-muted);
    font-size: 1.1rem;
}

.search-section {
    max-width: 600px;
    margin: 0 auto 3rem;
}

.input-group {
    display: flex;
    background: var(--card-bg);
    padding: 0.5rem;
    border-radius: 1rem;
    border: 1px solid var(--border);
    backdrop-filter: blur(12px);
    box-shadow: var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
}

.input-group:focus-within {
    transform: translateY(-2px);
    box-shadow: 0 20px 40px -10px rgba(59, 130, 246, 0.3);
    border-color: var(--primary);
}

input {
    flex: 1;
    background: transparent;
    border: none;
    padding: 1rem;
    color: white;
    font-size: 1.1rem;
    font-family: inherit;
    outline: none;
}

button {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border: none;
    padding: 0 2rem;
    border-radius: 0.75rem;
    color: white;
    font-weight: 600;
    cursor: pointer;
    font-size: 1rem;
    transition: filter 0.2s;
}

button:hover {
    filter: brightness(1.2);
}

.hint {
    text-align: center;
    margin-top: 0.8rem;
    font-size: 0.875rem;
    color: var(--text-muted);
    opacity: 0.7;
}

/* Suggestions */
.input-wrapper {
    position: relative;
    max-width: 600px;
    margin: 0 auto;
}

.suggestions-hidden {
    display: none;
}

#suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #1e293b;
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 1rem 1rem;
    z-index: 50;
    max-height: 300px;
    overflow-y: auto;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5);
    margin-top: 5px;
}

.suggestion-item {
    padding: 1rem;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: background 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover {
    background: rgba(59, 130, 246, 0.2);
}

.suggestion-name {
    font-weight: 500;
    color: var(--text-main);
}

.suggestion-code {
    font-family: monospace;
    font-size: 0.85rem;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.1);
    padding: 0.2rem 0.5rem;
    border-radius: 0.3rem;
}

.suggestion-cedula {
    font-family: monospace;
    font-size: 0.8rem;
    color: var(--accent);
    margin-left: 0.5rem;
}

/* Leaflet Overrides */
.leaflet-container {
    background: #1e293b !important;
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
    background-color: #1e293b;
    color: white;
    border: 1px solid var(--border);
}

.leaflet-popup-content b {
    color: var(--primary);
}

.leaflet-popup-content button {
    background: var(--primary);
    border: none;
    color: white;
    border-radius: 4px;
    width: 100%;
    margin-top: 5px;
}

.leaflet-bar a {
    background-color: #1e293b !important;
    color: white !important;
    border-bottom: 1px solid var(--border) !important;
}

/* Results Area */
.results-hidden {
    display: none;
}

.info-card,
.map-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 1.5rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    backdrop-filter: blur(12px);
    box-shadow: var(--shadow);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.card-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

.status-badge {
    background: rgba(34, 197, 94, 0.2);
    color: #4ade80;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.875rem;
    font-weight: 600;
}

.details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.detail-item label {
    display: block;
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.detail-item span {
    font-size: 1.1rem;
    font-weight: 500;
}

.map-container {
    width: 100%;
    height: 400px;
    border-radius: 1rem;
    overflow: hidden;
    position: relative;
    background: #1e293b;
}

iframe {
    width: 100%;
    height: 100%;
    border: 0;
}

.external-link {
    color: var(--primary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
}

.external-link:hover {
    text-decoration: underline;
}

/* Loading */
.loading-hidden {
    display: none;
}

#loading {
    text-align: center;
    padding: 2rem;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-left-color: var(--primary);
    border-radius: 50%;
    margin: 0 auto 1rem;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    100% {
        transform: rotate(360deg);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Search Mode Toggle */
.search-mode-toggle {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.mode-btn {
    background: var(--card-bg);
    border: 1px solid var(--border);
    padding: 0.75rem 1.5rem;
    border-radius: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.mode-btn:hover {
    border-color: var(--primary);
    color: var(--text-main);
}

.mode-btn.active {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-color: transparent;
    color: white;
}

/* Manzana Results */
#manzanaResults.manzana-results-hidden {
    display: none !important;
}

#manzanaResults {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    align-items: start;
}

@media (max-width: 768px) {
    #manzanaResults {
        grid-template-columns: 1fr;
    }
}

.manzana-list {
    max-height: 400px;
    overflow-y: auto;
}

.manzana-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: background 0.2s;
}

.manzana-item:hover {
    background: rgba(59, 130, 246, 0.15);
}

.manzana-item:last-child {
    border-bottom: none;
}

.manzana-item-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.manzana-item-name {
    font-weight: 500;
    color: var(--text-main);
}

.manzana-item-cedula {
    font-size: 0.85rem;
    color: var(--accent);
    font-family: monospace;
}

.manzana-item-predial {
    font-family: monospace;
    font-size: 0.75rem;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.1);
    padding: 0.25rem 0.5rem;
    border-radius: 0.3rem;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.locate-btn {
    background: var(--primary);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, background 0.2s;
    padding: 0;
    flex-shrink: 0;
    margin-left: 0.5rem;
}

.locate-btn:hover {
    background: var(--accent);
    transform: scale(1.1);
}