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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #F5F7FA;
    color: #1A1A2E;
    height: 100vh;
    overflow: hidden;
}

/* ── LOGIN ── */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1565C0 0%, #0D47A1 100%);
    overflow: hidden;
}

.login-card {
    background: white;
    border-radius: 16px;
    padding: 48px 40px;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-logo {
    display: flex;
    justify-content: center;
    margin-bottom: 12px;
}

.login-card h1 {
    text-align: center;
    font-size: 28px;
    font-weight: 700;
    color: #1565C0;
    margin-bottom: 4px;
}

.login-subtitle {
    text-align: center;
    color: #888;
    font-size: 14px;
    margin-bottom: 32px;
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #444;
    margin-bottom: 6px;
}

.form-group input {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid #DDD;
    border-radius: 8px;
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s;
}

.form-group input:focus {
    border-color: #1565C0;
}

.error-msg {
    background: #FFEBEE;
    color: #C62828;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 14px;
}

/* ── BUTTONS ── */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #1565C0;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 9px 18px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-primary:hover { background: #0D47A1; }
.btn-primary:disabled { background: #90CAF9; cursor: not-allowed; }

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: white;
    color: #1565C0;
    border: 1.5px solid #1565C0;
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover { background: #E3F2FD; }

.btn-block { width: 100%; justify-content: center; padding: 12px; font-size: 16px; }

.btn-logout {
    background: rgba(255,255,255,0.15);
    color: white;
    border: 1px solid rgba(255,255,255,0.4);
    border-radius: 6px;
    padding: 6px 14px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s;
}
.btn-logout:hover { background: rgba(255,255,255,0.25); }

/* ── HEADER ── */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #1565C0;
    color: white;
    padding: 0 20px;
    height: 52px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    position: relative;
    z-index: 10;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-title {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-status {
    font-size: 13px;
    opacity: 0.85;
}

/* ── LAYOUT ── */
.main-layout {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 52px);
}

.map-container {
    position: relative;
    flex: 1;
    min-height: 300px;
}

#map {
    width: 100%;
    height: 100%;
}

.sector-selector {
    position: absolute;
    top: 60px;
    left: 10px;
    z-index: 10;
    background: white;
    border-radius: 8px;
    padding: 7px 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #444;
}

.sector-selector label {
    font-weight: 600;
    white-space: nowrap;
    color: #1565C0;
}

.sector-selector select {
    border: 1px solid #DDD;
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 13px;
    color: #1A1A2E;
    background: white;
    cursor: pointer;
    outline: none;
}

.sector-selector select:focus {
    border-color: #1565C0;
}

.map-hint {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(21, 101, 192, 0.92);
    color: white;
    padding: 10px 18px;
    border-radius: 24px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    white-space: nowrap;
}

.map-loading {
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.75);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    font-size: 15px;
    color: #1565C0;
    font-weight: 600;
    z-index: 5;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #E3F2FD;
    border-top-color: #1565C0;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── RESULTS PANEL ── */
.results-panel {
    background: white;
    border-top: 2px solid #E3F2FD;
    display: flex;
    flex-direction: column;
    max-height: 45vh;
}

.results-header {
    padding: 12px 16px 8px;
    border-bottom: 1px solid #EEE;
    flex-shrink: 0;
}

.results-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.results-title-row h2 {
    font-size: 15px;
    font-weight: 600;
    color: #333;
}

.results-actions {
    display: flex;
    gap: 8px;
}

.filter-bar {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 4px 12px;
    border-radius: 20px;
    border: 1.5px solid #BBDEFB;
    background: white;
    color: #1565C0;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.filter-btn:hover { background: #E3F2FD; }
.filter-btn.active { background: #1565C0; color: white; border-color: #1565C0; }

/* ── TABLE ── */
.table-wrapper {
    overflow: auto;
    flex: 1;
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.results-table thead th {
    background: #1565C0;
    color: white;
    padding: 9px 12px;
    text-align: left;
    font-weight: 600;
    position: sticky;
    top: 0;
    white-space: nowrap;
}

.results-table tbody tr {
    transition: background 0.1s;
}

.results-table tbody tr:nth-child(even) { background: #F8FBFF; }
.results-table tbody tr:hover { background: #E3F2FD; }
.results-table tbody tr.hidden { display: none; }

.results-table td {
    padding: 8px 12px;
    border-bottom: 1px solid #EEF2F7;
    vertical-align: middle;
}

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    background: #E3F2FD;
    color: #1565C0;
    white-space: nowrap;
}

.badge-pension  { background: #FFF3E0; color: #E65100; }
.badge-hostal   { background: #E8F5E9; color: #2E7D32; }
.badge-hotel    { background: #EDE7F6; color: #4527A0; }
.badge-hostel   { background: #FCE4EC; color: #880E4F; }
.badge-rural    { background: #F1F8E9; color: #558B2F; }

.rating-stars { color: #FFC107; font-weight: 700; }

.badge-wifi-problemas { background: #FFEBEE; color: #C62828; cursor: default; }
.badge-wifi-ok        { background: #E8F5E9; color: #2E7D32; cursor: default; }
.badge-wifi-nd        { background: #F5F5F5; color: #9E9E9E; cursor: default; }
.wifi-loading         { color: #BDBDBD; font-size: 16px; }

.btn-wifi {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: white;
    color: #E65100;
    border: 1.5px solid #E65100;
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-wifi:hover { background: #FFF3E0; }
.btn-wifi:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-enrich {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: white;
    color: #6A1B9A;
    border: 1.5px solid #6A1B9A;
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-enrich:hover { background: #F3E5F5; }
.btn-enrich:disabled { opacity: 0.6; cursor: not-allowed; }

.filter-btn-wifi { border-color: #FFCDD2; color: #C62828; }
.filter-btn-wifi:hover { background: #FFEBEE; }
.filter-btn-wifi.active { background: #C62828; color: white; border-color: #C62828; }

a.tel-link { color: #1565C0; text-decoration: none; }
a.tel-link:hover { text-decoration: underline; }

a.web-link {
    color: #1565C0;
    text-decoration: none;
    max-width: 160px;
    display: inline-block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
}
a.web-link:hover { text-decoration: underline; }

/* ── CHECKBOX COLUMN ── */
.cb-th {
    width: 36px;
    text-align: center;
    padding: 9px 6px !important;
}
.cb-cell {
    width: 36px;
    text-align: center;
    padding: 8px 6px !important;
}
.cb-select {
    width: 15px;
    height: 15px;
    cursor: pointer;
    accent-color: #1565C0;
    vertical-align: middle;
}
.in-list-mark {
    color: #2E7D32;
    font-size: 15px;
    font-weight: 700;
}
.results-table tbody tr.row-in-list { background: #F1F8E9; }
.results-table tbody tr.row-in-list:nth-child(even) { background: #E8F5E9; }
.results-table tbody tr.row-in-list:hover { background: #DCEDC8 !important; }

/* ── BOTON AÑADIR A LISTA ── */
.btn-add-list {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: white;
    color: #2E7D32;
    border: 1.5px solid #2E7D32;
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-add-list:hover { background: #E8F5E9; }
.btn-add-list:disabled { opacity: 0.35; cursor: not-allowed; }

/* ── BOTON MI LISTA (HEADER) ── */
.btn-lista {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: rgba(255,255,255,0.15);
    color: white;
    border: 1px solid rgba(255,255,255,0.4);
    border-radius: 6px;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}
.btn-lista:hover { background: rgba(255,255,255,0.28); }
.btn-lista.has-items { border-color: rgba(255,255,255,0.8); }

.list-badge {
    background: #FF6B35;
    color: white;
    border-radius: 10px;
    padding: 1px 7px;
    font-size: 11px;
    font-weight: 700;
    min-width: 20px;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ── LIST DRAWER ── */
.list-overlay {
    position: fixed;
    inset: 0;
    top: 52px;
    background: rgba(0,0,0,0.3);
    z-index: 199;
    display: none;
}
.list-overlay.open { display: block; }

.list-drawer {
    position: fixed;
    right: 0;
    top: 52px;
    bottom: 0;
    width: 420px;
    background: white;
    box-shadow: -4px 0 24px rgba(0,0,0,0.18);
    transform: translateX(100%);
    transition: transform 0.28s ease;
    z-index: 200;
    display: flex;
    flex-direction: column;
}
.list-drawer.open { transform: translateX(0); }

.list-drawer-header {
    padding: 14px 16px;
    border-bottom: 1px solid #E8EEF5;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #F8FBFF;
    flex-shrink: 0;
}
.list-drawer-title {
    font-size: 15px;
    font-weight: 700;
    color: #1A1A2E;
}
.list-drawer-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}
.btn-export-list {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #2E7D32;
    color: white;
    border: none;
    border-radius: 7px;
    padding: 7px 13px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}
.btn-export-list:hover { background: #1B5E20; }
.btn-export-list:disabled { background: #A5D6A7; cursor: not-allowed; }

.btn-close-drawer {
    background: none;
    border: none;
    font-size: 17px;
    cursor: pointer;
    color: #888;
    padding: 4px 8px;
    border-radius: 4px;
    line-height: 1;
    transition: all 0.15s;
}
.btn-close-drawer:hover { background: #EEE; color: #333; }

.list-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 6px 0;
}

/* ── LIST ITEMS ── */
.list-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 11px 16px;
    border-bottom: 1px solid #F0F4F8;
    transition: background 0.1s;
}
.list-item:hover { background: #F8FBFF; }
.list-item:last-child { border-bottom: none; }

.list-item-main { flex: 1; min-width: 0; }

.list-item-name {
    font-weight: 600;
    font-size: 13px;
    color: #1A1A2E;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.list-item-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 12px;
    color: #666;
    margin-bottom: 2px;
}
.list-item-sub {
    font-size: 11px;
    color: #888;
    margin-top: 3px;
}
.list-item-remove {
    background: none;
    border: none;
    color: #CCC;
    cursor: pointer;
    font-size: 14px;
    padding: 3px 7px;
    border-radius: 4px;
    flex-shrink: 0;
    transition: all 0.15s;
    margin-top: 1px;
}
.list-item-remove:hover { background: #FFEBEE; color: #C62828; }

/* ── EMPTY STATE ── */
.list-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 64px 30px;
    text-align: center;
    gap: 12px;
}
.list-empty p {
    font-size: 15px;
    font-weight: 600;
    color: #666;
    margin: 0;
}
.list-empty-sub {
    font-size: 12px !important;
    font-weight: 400 !important;
    color: #AAA !important;
    line-height: 1.5;
}

/* ── TOAST ── */
.list-toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%) translateY(16px);
    background: #2E7D32;
    color: white;
    padding: 10px 22px;
    border-radius: 22px;
    font-size: 13px;
    font-weight: 600;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 300;
    white-space: nowrap;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
    pointer-events: none;
}
.list-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.loading-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #BDBDBD;
    animation: bounce 1.4s infinite ease-in-out both;
}

.loading-dot:nth-child(1) { animation-delay: -0.32s; }
.loading-dot:nth-child(2) { animation-delay: -0.16s; }
.loading-dot:nth-child(3) { animation-delay: 0s; }

@keyframes bounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1.0); }
}
