:root {
    --bg-color: #0f172a;
    --panel-bg: rgba(30, 41, 59, 0.7);
    --panel-border: rgba(255, 255, 255, 0.1);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --success-color: #10b981;
    --error-color: #ef4444;
    --input-bg: rgba(15, 23, 42, 0.6);
    --input-border: rgba(255, 255, 255, 0.15);
    --input-focus: #3b82f6;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    background-image: 
        radial-gradient(at 0% 0%, rgba(59, 130, 246, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(16, 185, 129, 0.1) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(139, 92, 246, 0.15) 0px, transparent 50%);
    background-attachment: fixed;
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0;
}

/* Barra de Navegación */
.navbar {
    width: 100%;
    margin-bottom: 2rem;
    padding: 1rem 3rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-top: none;
    position: sticky;
    top: 0;
    z-index: 2000;
}

.nav-brand {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(to right, #60a5fa, #a78bfa);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transition: all 0.3s;
}

.nav-link:hover {
    color: var(--text-primary);
    background: rgba(255,255,255,0.05);
}

.nav-link.active {
    color: var(--text-primary);
    background: rgba(59, 130, 246, 0.2);
    border: 1px solid rgba(59, 130, 246, 0.4);
}

.main-container {
    display: flex;
    flex-direction: row;
    gap: 2rem;
    width: 100%;
    max-width: 1200px;
    height: calc(85vh - 80px); /* Ajustado por la altura del nav */
    min-height: 600px;
    padding: 0 2rem 2rem 2rem;
}

/* Glassmorphism Panels */
.glass-panel {
    background: var(--panel-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--panel-border);
    border-radius: 20px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

/* Form Section */
.form-container {
    flex: 1;
    max-width: 450px;
    padding: 1.5rem 2rem;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

/* Custom scrollbar for form container */
.form-container::-webkit-scrollbar {
    width: 6px;
}
.form-container::-webkit-scrollbar-track {
    background: transparent;
}
.form-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}

.header {
    margin-bottom: 1.25rem;
}

.header h1 {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    background: linear-gradient(to right, #60a5fa, #a78bfa);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header p {
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.4;
}

/* Multi-column rows */
.form-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.form-row .input-group {
    flex: 1;
    margin-bottom: 0;
}

.input-group {
    margin-bottom: 1rem;
}

.input-group label {
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
}

/* OCR Upload Area */
.ine-upload-area {
    border: 2px dashed var(--input-border);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    background: rgba(15, 23, 42, 0.4);
    transition: all 0.3s ease;
    margin-bottom: 1.25rem;
    position: relative;
}

.ine-upload-area:hover, .ine-upload-area.dragover {
    border-color: var(--primary-color);
    background: rgba(59, 130, 246, 0.1);
}

.ine-upload-content h4 {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.ine-upload-content p {
    color: var(--text-secondary);
    font-size: 0.8rem;
    margin-bottom: 1rem;
}

.upload-icon {
    font-size: 2rem;
    display: block;
    margin-bottom: 0.5rem;
    opacity: 0.8;
}

.ocr-status {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 8px;
    padding: 0.75rem;
    margin-bottom: 1.25rem;
    font-size: 0.85rem;
    color: #93c5fd;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ocr-status.error {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

.ocr-status.success {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.3);
    color: #6ee7b7;
}

.input-group input, .input-group select {
    width: 100%;
    padding: 0.75rem 1rem;
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.input-group select {
    cursor: pointer;
}

.input-group input:focus, .input-group select:focus {
    outline: none;
    border-color: var(--input-focus);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.input-group input::placeholder {
    color: rgba(148, 163, 184, 0.5);
}

/* Coordinates Display */
.coords-display {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.25rem;
    background: rgba(0, 0, 0, 0.2);
    padding: 1rem;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.05);
}

.coord-item {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.coord-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.coord-value {
    font-family: monospace;
    font-size: 0.9rem;
    color: #60a5fa;
    word-break: break-all;
}

/* Buttons */
.btn-primary {
    width: 100%;
    padding: 1rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(59, 130, 246, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    padding: 0.5rem 1rem;
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

/* Map Section */
.map-container {
    flex: 2;
    position: relative;
    padding: 0.5rem; /* Border thickness */
}

#map {
    height: 100%;
    width: 100%;
    border-radius: 15px;
    z-index: 1;
    background-color: #1e293b; /* Placeholder color before map loads */
}

/* Customizing Leaflet Map to fit dark theme slightly */
.leaflet-container {
    font-family: 'Inter', sans-serif;
}
.leaflet-control-zoom a {
    background-color: var(--panel-bg) !important;
    color: var(--text-primary) !important;
    border-color: var(--panel-border) !important;
    backdrop-filter: blur(10px);
}
.leaflet-control-zoom a:hover {
    background-color: var(--primary-color) !important;
}

.map-overlay {
    position: absolute;
    inset: 0.5rem; /* Inside the padding */
    z-index: 1000;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(4px);
    border-radius: 15px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    color: white;
    transition: opacity 0.5s ease;
}

.map-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.pulse-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.map-overlay p {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    font-weight: 500;
}

/* Utilities */
.class-hidden {
    display: none !important;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

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

.message {
    margin-top: 1.5rem;
    padding: 1rem;
    border-radius: 10px;
    font-size: 0.9rem;
    text-align: center;
    animation: slideUp 0.3s ease-out;
}

.message.success {
    background-color: rgba(16, 185, 129, 0.1);
    border: 1px solid var(--success-color);
    color: #34d399;
}

.message.error {
    background-color: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--error-color);
    color: #f87171;
}

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

/* Dashboard Styles */
.dashboard-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    width: 100%;
    max-width: 1300px;
    padding: 0 2rem 2rem 2rem;
}

.dashboard-map-section {
    padding: 2rem;
    height: 500px;
    display: flex;
    flex-direction: column;
}

.map-global {
    flex: 1;
    border-radius: 15px;
    border: 1px solid var(--panel-border);
}

.dashboard-table-section {
    padding: 2rem;
}

.table-container {
    overflow-x: auto;
    border-radius: 10px;
    border: 1px solid var(--panel-border);
    background: rgba(0,0,0,0.2);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.data-table th, .data-table td {
    padding: 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.data-table th {
    background-color: rgba(15, 23, 42, 0.8);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    position: sticky;
    top: 0;
}

.data-table tbody tr {
    transition: background-color 0.2s;
}

.data-table tbody tr:hover {
    background-color: rgba(255,255,255,0.05);
}

.data-table td {
    font-size: 0.95rem;
    color: var(--text-primary);
}

.text-muted {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.text-center {
    text-align: center;
}

.loading-text {
    padding: 2rem;
    color: var(--text-secondary);
}

/* DataTables Custom Theme overriding default styles */
.dataTables_wrapper .dataTables_length, 
.dataTables_wrapper .dataTables_filter, 
.dataTables_wrapper .dataTables_info, 
.dataTables_wrapper .dataTables_processing, 
.dataTables_wrapper .dataTables_paginate {
    color: var(--text-secondary) !important;
    margin-bottom: 1rem;
    margin-top: 1rem;
}

.dataTables_wrapper .dataTables_filter input {
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 6px;
    color: var(--text-primary);
    padding: 0.4rem 0.8rem;
    margin-left: 0.5rem;
}

.dataTables_wrapper .dataTables_filter input:focus {
    outline: none;
    border-color: var(--input-focus);
}

.dataTables_wrapper .dataTables_length select {
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    color: var(--text-primary);
    border-radius: 4px;
    padding: 0.2rem;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    color: var(--text-secondary) !important;
    border: 1px solid transparent !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    color: white !important;
    background: rgba(255, 255, 255, 0.1) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current, 
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
    color: white !important;
    background: var(--primary-color) !important;
    border: 1px solid var(--primary-hover) !important;
}

table.dataTable.no-footer {
    border-bottom: 1px solid rgba(255,255,255,0.05) !important;
}

/* Responsive */
@media (max-width: 900px) {
    .navbar {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }
    
    .main-container {
        flex-direction: column;
        height: auto;
        padding: 1rem;
    }
    
    .dashboard-container {
        padding: 1rem;
    }

    .form-container {
        max-width: 100%;
        order: 2; /* Form below map on mobile */
    }
    
    .map-container {
        height: 50vh;
        min-height: 400px;
        order: 1;
    }
}
