/* ═══════════════════════════════════════════════════
   WeBarrio — Design System
   Modern glassmorphism + sidebar layout + dashboard
   ═══════════════════════════════════════════════════ */

/* ─── Variables ──────────────────────────────────── */
:root {
    /* Theme: Light & Orange (WeBarrio) */
    --primary: #F36F21;
    /* Logo Orange */
    --primary-hover: #d35f1b;

    --bg-gradient: #ffffff;
    --glass-bg: rgba(255, 255, 255, 0.95);
    --glass-border: rgba(243, 111, 33, 0.15);
    /* Orange tint */
    --glass-shadow: 0 8px 24px rgba(243, 111, 33, 0.12);
    /* Orange shadow */

    --accent: var(--primary);
    --accent-light: #ff8c4d;
    --accent-glow: rgba(243, 111, 33, 0.25);

    --success: #00c897;
    --warning: #ffb347;
    --danger: #ff4757;

    --text-primary: #2d3436;
    /* Dark grey for readability */
    --text-brand: #F36F21;
    /* Orange for headings/brand */
    --text-secondary: #636e72;
    --text-muted: #b2bec3;

    --radius: 12px;
    --radius-sm: 8px;
    --transition: all 0.25s ease;
    --font: 'Inter', sans-serif;

    --sidebar-width: 260px;
    --sidebar-bg: #fff5f0;
    /* Very light orange tint */
}

/* ─── Reset & Base ───────────────────────────────── */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    height: 100%;
    font-family: var(--font);
    background: var(--bg-gradient);
    color: var(--text-primary);
    overflow-x: hidden;
}

.view {
    display: none;
    min-height: 100vh;
    animation: fadeIn 0.4s ease;
}

.view.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    box-shadow: var(--glass-shadow);
}

.hidden {
    display: none !important;
}

/* ═══════ LOGIN ═══════════════════════════════════ */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.login-card {
    width: 100%;
    max-width: 420px;
    padding: 48px 40px;
    text-align: center;
}

.login-logo {
    margin-bottom: 36px;
}

.logo-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    border-radius: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 800;
    color: #fff;
    margin-bottom: 16px;
    box-shadow: 0 4px 20px var(--accent-glow);
}

/* Logos */
.logo-img {
    max-width: 280px;
    height: auto;
    display: block;
    margin: 0 auto;
}

.sidebar-logo-img {
    max-width: 140px;
    height: auto;
    display: block;
}

.login-card h1 {
    display: none;
    /* Hide text h1 if we have logo */
}

.login-subtitle {
    display: none;
    /* Hide subtitle too if logo handles branding */
}

.input-group {
    margin-bottom: 20px;
    text-align: left;
}

.input-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

/* Updated Input Styles for Light Theme */
.input-group input,
.input-group textarea,
.form-control {
    width: 100%;
    padding: 14px 16px;
    background: #f8f9fa;
    /* Light grey background */
    border: 1px solid #e1e4e8;
    /* Subtle border */
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 15px;
    font-family: var(--font);
    transition: var(--transition);
    outline: none;
}

.input-group input:focus,
.input-group textarea:focus,
.form-control:focus {
    background: #ffffff;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.input-group textarea,
textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

.input-group input::placeholder {
    color: var(--text-muted);
}

/* Updated Select Styles */
.input-group select,
.form-select {
    width: 100%;
    padding: 14px 16px;
    padding-right: 40px;
    /* Space for arrow */
    background-color: #f8f9fa;
    border: 1px solid #e1e4e8;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 15px;
    font-family: var(--font);
    transition: var(--transition);
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23636e72' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    cursor: pointer;
}

.input-group select:focus,
.form-select:focus {
    background-color: #ffffff;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--accent-glow);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23F36F21' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
}

.input-group select:hover:not(:disabled),
.form-select:hover:not(:disabled) {
    border-color: var(--text-muted);
}

.input-group select:disabled,
.form-select:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background-color: #e9ecef;
}

/* Custom File Upload Wrapper */
.file-upload-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Fix for label color specificity conflict */
.input-group label.btn-primary {
    color: #fff !important;
    margin-bottom: 0;
}

.file-name-display {
    font-size: 13px;
    color: var(--text-secondary);
    font-style: italic;
}

/* Password Toggle */
.password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-wrapper input {
    padding-right: 40px;
    /* Space for the button */
}

.btn-toggle-password {
    position: absolute;
    right: 10px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    color: var(--text-secondary);
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.btn-toggle-password:hover {
    color: var(--primary);
}

/* ═══════ APP LAYOUT ═════════════════════════════ */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ─── Sidebar ────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background: var(--sidebar-bg);
    backdrop-filter: blur(30px);
    border-radius: 0;
    border: none;
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 200;
    transition: transform 0.3s ease;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 24px 20px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-logo {
    width: 40px;
    height: 40px;
    font-size: 18px;
    margin-bottom: 0;
}

.sidebar-brand {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}

.sidebar-section-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    padding: 12px 12px 8px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    margin-bottom: 4px;
    cursor: pointer;
}

.sidebar-submenu {
    padding-left: 15px;
    margin-bottom: 5px;
    display: none;
    /* Hidden by default, or you can make it always visible if preferred */
}

/* Show submenu when parent is active or if we want it always open */
.sidebar-item-group:hover .sidebar-submenu,
.sidebar-link.active+.sidebar-submenu,
.sidebar-submenu:hover {
    display: block;
}

/* Just make it always visible for now based on user request "immediately below" */
.sidebar-submenu {
    display: block !important;
}

.sidebar-submenu .sidebar-link {
    font-size: 13px;
    padding: 6px 14px;
    opacity: 0.85;
    background: transparent;
}

.sidebar-submenu .sidebar-icon {
    font-size: 14px;
    width: 20px;
}

.sidebar-link:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
}

.sidebar-link.active {
    background: rgba(108, 99, 255, 0.15);
    color: var(--accent-light);
}

.sidebar-link.disabled {
    opacity: 0.45;
    cursor: default;
    pointer-events: none;
}

.sidebar-icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-text {
    flex: 1;
}

.sidebar-badge {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.sidebar-user-avatar {
    width: 36px;
    height: 36px;
    background: rgba(108, 99, 255, 0.2);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.sidebar-user-info {
    display: flex;
    flex-direction: column;
}

.sidebar-user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.sidebar-user-role {
    font-size: 11px;
    color: var(--text-muted);
}

.btn-logout-sidebar {
    width: 100%;
    justify-content: center;
    font-size: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

/* ─── Main Content ───────────────────────────────── */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.3s ease;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 32px;
    border-radius: 0;
    border-top: none;
    border-left: none;
    border-right: none;
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--glass-bg);
    /* Ensure background is set */
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-module-title {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.2px;
}

.sidebar-toggle {
    display: none;
    /* Desktop default */
    font-size: 22px;
    cursor: pointer;
    background: transparent;
    border: none;
    color: var(--text-primary);
    padding: 4px;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-badge {
    font-size: 13px;
    color: var(--text-secondary);
    padding: 6px 14px;
    background: rgba(108, 99, 255, 0.15);
    border-radius: 20px;
}

.module {
    display: none;
    flex: 1;
}

.module.active {
    display: flex;
    flex-direction: column;
}

.module-step {
    display: none;
    animation: fadeIn 0.3s ease;
}

.module-step.active {
    display: block;
}

.content-area {
    max-width: 900px;
    margin: 0 auto;
    padding: 40px 32px 60px;
    width: 100%;
}

.content-area-wide {
    max-width: 1100px;
}

/* ═══════ BUTTONS ════════════════════════════════ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    color: #fff;
    box-shadow: 0 4px 15px var(--accent-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px var(--accent-glow);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
}

.btn-outline:hover {
    background: var(--glass-bg);
    border-color: var(--accent);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.btn-full {
    width: 100%;
    padding: 16px;
    font-size: 15px;
    margin-top: 8px;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
}

.verificacion-filtro-btn {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
    transition: all 0.2s;
}

.verificacion-filtro-btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.verificacion-filtro-btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.08);
}

.error-text {
    color: var(--danger);
    font-size: 13px;
    margin-top: 16px;
}

.field-warning {
    color: #ff6b6b;
    font-size: 12px;
    margin-top: 6px;
    display: block;
    animation: fadeIn 0.3s ease;
}

.input-error {
    border-color: #ff6b6b !important;
    box-shadow: 0 0 0 2px rgba(255, 107, 107, 0.3) !important;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.btn-loader {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ═══════ DASHBOARD ══════════════════════════════ */

/* Welcome Banner */
.dash-welcome {
    padding: 28px 32px;
    margin-bottom: 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, rgba(108, 99, 255, 0.15), rgba(139, 131, 255, 0.08));
    border: 1px solid rgba(108, 99, 255, 0.2);
    border-radius: var(--radius);
}

.dash-welcome h2 {
    font-size: 22px;
    font-weight: 400;
    margin-bottom: 6px;
}

.dash-welcome h2 strong {
    font-weight: 700;
}

.dash-welcome p {
    color: var(--text-secondary);
    font-size: 14px;
}

.dash-welcome-date {
    font-size: 13px;
    color: var(--text-muted);
    text-align: right;
    white-space: nowrap;
}

/* KPI Cards */
.dash-kpis {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 28px;
}

.dash-kpi {
    padding: 22px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.dash-kpi:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}

.kpi-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.kpi-vecinos {
    background: rgba(108, 99, 255, 0.2);
}

.kpi-eventos {
    background: rgba(255, 179, 71, 0.2);
}

.kpi-asistencia {
    background: rgba(0, 200, 151, 0.2);
}

.kpi-cargas {
    background: rgba(255, 107, 107, 0.2);
}

.kpi-body {
    flex: 1;
}

.kpi-number {
    display: block;
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -1px;
    line-height: 1.1;
}

.kpi-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.kpi-trend {
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 8px;
    position: absolute;
    top: 14px;
    right: 14px;
}

.kpi-trend.up {
    background: rgba(0, 200, 151, 0.15);
    color: var(--success);
}

.kpi-trend.neutral {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-muted);
}

/* Charts Row */
.dash-charts-row {
    display: grid;
    grid-template-columns: 1.3fr 1fr;
    gap: 20px;
    margin-bottom: 28px;
}

.dash-chart {
    padding: 24px;
}

.dash-chart-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--text-primary);
}

/* Bar Chart */
.chart-bar-container {
    padding-top: 8px;
}

.chart-bar-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    height: 180px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.chart-bar {
    flex: 1;
    height: var(--h);
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.chart-bar::after {
    content: attr(data-label);
    position: absolute;
    bottom: -24px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
}

.bar-fill {
    width: 100%;
    height: 100%;
    border-radius: 6px 6px 2px 2px;
    background: linear-gradient(180deg, var(--accent-light), var(--accent));
    opacity: 0.7;
    transition: all 0.3s ease;
}

.chart-bar-values {
    display: flex;
    justify-content: space-between;
    margin-top: 30px;
    padding: 0 10px;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
}

.chart-bar.active .bar-fill {
    opacity: 1;
    background: linear-gradient(180deg, var(--primary), #ff9f43);
    box-shadow: 0 0 15px rgba(243, 111, 33, 0.4);
}

.chart-bar.highlight .bar-fill {
    opacity: 0.9;
    background: linear-gradient(180deg, #ff9f43, #feb47b);
}

/* Donut Chart */
.chart-donut-container {
    display: flex;
    align-items: center;
    gap: 24px;
}

.donut {
    position: relative;
    width: 140px;
    height: 140px;
    flex-shrink: 0;
}

.donut-svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.donut-segment {
    transition: all 0.6s ease;
    transform-origin: center;
}

.donut-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.donut-center .donut-total {
    display: block;
    font-size: 20px;
    font-weight: 700;
    line-height: 1;
}

.donut-center .donut-label {
    font-size: 11px;
    color: var(--text-secondary);
}

.donut-legend {
    flex: 1;
}

.legend-item {
    display: flex;
    align-items: center;
    font-size: 13px;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.legend-item strong {
    margin-left: auto;
    font-weight: 600;
    color: var(--text-primary);
}

.legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 8px;
}

/* Activity & Quick actions */
.dash-bottom-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.activity-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.activity-item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.activity-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-top: 6px;
    flex-shrink: 0;
}

.dot-success {
    background: var(--success);
    box-shadow: 0 0 10px rgba(0, 200, 151, 0.4);
}

.dot-warning {
    background: var(--warning);
    box-shadow: 0 0 10px rgba(255, 179, 71, 0.4);
}

.dot-accent {
    background: var(--accent);
    box-shadow: 0 0 10px rgba(108, 99, 255, 0.4);
}

.activity-content {
    display: flex;
    flex-direction: column;
}

.activity-text {
    font-size: 13px;
    color: var(--text-primary);
}

.activity-time {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.quick-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.quick-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px;
    gap: 8px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.quick-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-2px);
}

.quick-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.quick-icon {
    font-size: 24px;
}

.quick-label {
    font-size: 12px;
    font-weight: 500;
}

/* ═══════ EVENTOS ════════════════════════════════ */
.eventos-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
}

.eventos-header h2 {
    font-size: 24px;
    margin-bottom: 8px;
}

.eventos-header p {
    color: var(--text-secondary);
    font-size: 14px;
}

.form-evento-container {
    padding: 24px;
    margin-bottom: 24px;
    border-radius: var(--radius);
}

.form-evento-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.form-evento-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.eventos-table-container {
    min-height: 200px;
    padding: 0;
    overflow: auto;
    /* Changed from hidden to auto to allow scrolling */
}

.eventos-table {
    width: 100%;
    border-collapse: collapse;
}

.eventos-table th {
    text-align: left;
    padding: 16px 20px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: rgba(0, 0, 0, 0.02);
    border-bottom: 1px solid var(--glass-border);
}

.eventos-table td {
    padding: 16px 20px;
    font-size: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.eventos-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

.eventos-loading,
.eventos-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    text-align: center;
}

.placeholder-icon {
    font-size: 40px;
    opacity: 0.3;
    margin-bottom: 16px;
}

/* Actions in table */
.action-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    padding: 4px 8px;
    border-radius: 4px;
    transition: var(--transition);
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.badge-estado {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.badge-activo {
    background: rgba(0, 200, 151, 0.15);
    color: var(--success);
}

.badge-inactivo {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
}

.badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

/* ═══════ UPLOAD & CARGA ═════════════════════════ */
.upload-header,
.mapping-header {
    margin-bottom: 24px;
    text-align: center;
}

.upload-header h2 {
    font-size: 24px;
    margin-bottom: 8px;
}

.upload-header p {
    color: var(--text-secondary);
}

.upload-zona {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    border: 2px dashed rgba(255, 255, 255, 0.2);
    border-radius: var(--radius);
    margin-bottom: 24px;
    transition: var(--transition);
}

.upload-zona.dragover {
    border-color: var(--accent);
    background: rgba(108, 99, 255, 0.05);
}

.upload-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.upload-text {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
}

.upload-subtext {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.file-info {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    margin-top: 20px;
}

.file-icon {
    font-size: 24px;
}

.file-details {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.file-name {
    font-weight: 600;
    font-size: 14px;
}

.file-cols {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Mapping Table */
.mapping-table-container {
    overflow-x: auto;
    margin-bottom: 24px;
}

.mapping-table {
    width: 100%;
    border-collapse: collapse;
}

.mapping-table th {
    text-align: left;
    padding: 12px 16px;
    font-size: 13px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--glass-border);
}

.mapping-table td {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

/* Preview Panel */
.preview-panel {
    margin-top: 24px;
    padding: 20px;
}

.preview-table-wrap {
    overflow-x: auto;
    max-height: 300px;
}

.preview-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.preview-table th,
.preview-table td {
    padding: 8px 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* ═══════ SPINNER ════════════════════════════════ */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* ═══════ MODAL ══════════════════════════════════ */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: #fff;
    padding: 30px;
    border-radius: var(--radius);
    width: 100%;
    max-width: 400px;
    position: relative;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
}

.close-modal:hover {
    color: var(--danger);
}

/* ─── Media Queries (Responsive) ─────────────────── */

/* TABLET & SMALL LAPTOPS (Max 1024px) */
@media screen and (max-width: 1024px) {

    /* Sidebar still visible, but content narrower */
    .content-area-wide {
        max-width: 100%;
    }

    .dash-kpis {
        grid-template-columns: repeat(2, 1fr);
    }

    .dash-charts-row {
        grid-template-columns: 1fr;
    }

    .dash-bottom-row {
        grid-template-columns: 1fr;
    }
}

/* MOBILE (Max 768px) */
@media screen and (max-width: 768px) {

    /* Sidebar Layout */
    .sidebar {
        transform: translateX(-100%);
        width: 80%;
        /* Wider sidebar on mobile */
        max-width: 300px;
        box-shadow: 5px 0 15px rgba(0, 0, 0, 0.1);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    /* Topbar */
    .topbar {
        padding: 12px 16px;
    }

    .sidebar-toggle {
        display: block;
        /* Show hamburger */
    }

    .topbar-module-title {
        font-size: 16px;
    }

    /* Content Area */
    .content-area,
    .content-area-wide {
        padding: 24px 16px;
    }

    /* Dashboard */
    .dash-welcome {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .dash-welcome-date {
        text-align: left;
    }

    .dash-kpis {
        grid-template-columns: 1fr;
        /* 1 Column KPIs */
    }

    /* Events Form */
    .form-evento-grid {
        grid-template-columns: 1fr;
        /* Stack inputs */
    }

    /* Tables */
    .eventos-table-container,
    .mapping-table-container,
    .preview-table-wrap {
        display: block;
        /* Ensure block level for scrolling */
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        /* Smooth scroll on iOS */
        max-width: 100%;
        white-space: nowrap;
        /* Prevent wrapping inside cells */
    }

    .eventos-table th,
    .eventos-table td,
    .mapping-table th,
    .mapping-table td {
        white-space: nowrap;
        /* Prevent wrapping in tight spaces */
        padding: 12px 10px;
    }

    /* Login */
    .login-card {
        padding: 32px 20px;
    }

    /* Modals */
    .modal-content {
        width: 90%;
        margin: 0 auto;
    }

    /* Event selection in Upload module */
    .evento-selector {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ═══════ PILL SELECTOR ══════════════════════════ */
.pill-search {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #e1e4e8;
    border-radius: var(--radius-sm);
    font-size: 14px;
    margin-bottom: 12px;
    background: #f8f9fa;
    transition: var(--transition);
    outline: none;
}

.pill-search:focus {
    background: #ffffff;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.pill-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    max-height: 180px;
    overflow-y: auto;
    padding: 2px;
    /* Prevent shadow cutout */
}

.pill {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    background: #f1f2f6;
    border: 1px solid transparent;
    border-radius: 50px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    user-select: none;
    margin-bottom: 4px;
}

.pill:hover {
    background: #e1e4e8;
    color: var(--text-primary);
}

.pill.selected {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 4px 12px var(--accent-glow);
}

.pill.hidden {
    display: none !important;
}


/* ═══════ AUTOCOMPLETE CHIPS ═════════════════════ */
.autocomplete-container {
    position: relative;
    width: 100%;
}

.chips-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
    min-height: 0;
    /* don't take space if empty */
}

.chip {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    background: rgba(243, 111, 33, 0.1);
    border: 1px solid rgba(243, 111, 33, 0.2);
    border-radius: 50px;
    font-size: 13px;
    font-weight: 500;
    color: var(--primary);
    user-select: none;
}

.chip-remove {
    margin-left: 6px;
    cursor: pointer;
    font-weight: bold;
    font-size: 16px;
    line-height: 1;
    color: var(--primary);
    opacity: 0.7;
    transition: opacity 0.2s;
}

.chip-remove:hover {
    opacity: 1;
}

.suggestions-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #e1e4e8;
    border-radius: var(--radius-sm);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    /* Hidden by default */
}

.suggestions-list.active {
    display: block;
}

.suggestion-item {
    padding: 10px 14px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.1s;
    color: var(--text-primary);
}

.suggestion-item:hover {
    background: #f8f9fa;
    color: var(--primary);
}

.suggestion-item.highlighted {
    background: #f1f2f6;
}

/* ─── Info Field (Comunidades Detalle) ─── */
.info-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.info-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted, #888);
}

.info-val {
    font-size: 14px;
    color: var(--text-main, #222);
    font-weight: 500;
}

/* ═══════ FICHA FIFA VECINO ══════════════════════ */
#modal-ficha-vecino {
    display: none;
}

#modal-ficha-vecino:not(.hidden) {
    display: flex;
}

.ficha-fifa-card {
    position: relative;
    z-index: 1;
    width: 320px;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(243, 111, 33, 0.25), 0 4px 20px rgba(0, 0, 0, 0.15);
    background: #ffffff;
    color: var(--text-primary);
    font-family: var(--font);
    border: 1px solid rgba(243, 111, 33, 0.2);
    animation: fifaCardIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes fifaCardIn {
    from {
        transform: scale(0.7) translateY(40px);
        opacity: 0;
    }

    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

/* Zona superior naranja */
.ficha-fifa-bg {
    position: relative;
    background: linear-gradient(135deg, #F36F21 0%, #ff9a56 50%, #F36F21 100%);
    padding: 20px 20px 0 20px;
    min-height: 130px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
}

.ficha-fifa-rating-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1;
}

.ficha-fifa-rating {
    font-size: 52px;
    font-weight: 900;
    color: #fff;
    line-height: 1;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.ficha-fifa-posicion {
    font-size: 13px;
    font-weight: 800;
    color: rgba(255, 255, 255, 0.85);
    letter-spacing: 2px;
    margin-top: 2px;
}

.ficha-fifa-avatar-wrap {
    position: absolute;
    bottom: -40px;
    left: 50%;
    transform: translateX(-50%);
}

.ficha-fifa-avatar {
    width: 84px;
    height: 84px;
    border-radius: 50%;
    background: linear-gradient(135deg, #fff5f0, #ffe0cc);
    border: 4px solid #fff;
    box-shadow: 0 8px 20px rgba(243, 111, 33, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    font-weight: 800;
    color: var(--primary);
    text-shadow: none;
}

.ficha-fifa-close {
    background: rgba(255, 255, 255, 0.25);
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    color: #fff;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    flex-shrink: 0;
}

.ficha-fifa-close:hover {
    background: rgba(0, 0, 0, 0.2);
    color: #fff;
}

/* Nombre */
.ficha-fifa-nombre-wrap {
    text-align: center;
    padding: 52px 16px 10px;
    background: #fff;
}

.ficha-fifa-nombre {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.ficha-fifa-apellido {
    font-size: 22px;
    font-weight: 900;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 2px;
    line-height: 1.1;
}

/* Stats */
.ficha-fifa-stats-row {
    display: flex;
    justify-content: space-around;
    padding: 10px 20px 14px;
    background: #fff;
    border-bottom: 2px solid rgba(243, 111, 33, 0.15);
}

.ficha-fifa-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.ficha-fifa-stat-val {
    font-size: 24px;
    font-weight: 900;
    color: var(--primary);
    line-height: 1;
}

.ficha-fifa-stat-label {
    font-size: 9px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Divider */
.ficha-fifa-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(243, 111, 33, 0.3), transparent);
    margin: 0 16px;
}

/* Datos detalle */
.ficha-fifa-detalles {
    padding: 12px 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: #fff;
}

.ficha-fifa-detalle-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
}

.ficha-fifa-detalle-icon {
    font-size: 14px;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.ficha-fifa-detalle-label {
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 10px;
    letter-spacing: 0.5px;
    width: 70px;
    flex-shrink: 0;
}

.ficha-fifa-detalle-val {
    color: var(--text-primary);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

/* Badges */
.ficha-fifa-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0 20px 12px;
    justify-content: center;
    background: #fff;
}

.ficha-fifa-badge {
    background: linear-gradient(135deg, #F36F21, #ff9a56);
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    padding: 3px 10px;
    border-radius: 50px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ficha-fifa-badge.badge-adulto {
    background: linear-gradient(135deg, #ffb347, #ffcf77);
    color: #7a4a00;
}

.ficha-fifa-badge.badge-activo {
    background: linear-gradient(135deg, #00c897, #00a880);
    color: #fff;
}

/* Footer */
.ficha-fifa-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 20px 12px;
    background: #fff5f0;
    border-top: 1px solid rgba(243, 111, 33, 0.15);
}

.ficha-fifa-footer-brand {
    font-size: 11px;
    font-weight: 900;
    color: var(--primary);
    letter-spacing: 2px;
    text-transform: uppercase;
}

.ficha-fifa-footer-sub {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Fila clickeable en la tabla de vecinos */
#vecinos-comunidad-tbody tr {
    cursor: pointer;
    transition: background 0.15s;
}

#vecinos-comunidad-tbody tr:hover {
    background: rgba(243, 111, 33, 0.08);
}

/* ═══════ DASHBOARD TAGS COMUNIDAD ══════════════════ */
.comunidad-tags-row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    grid-template-rows: auto auto;
    gap: 12px;
    margin-bottom: 20px;
}

.comunidad-tags-row.hidden {
    display: none !important;
}

/* Tag base */
.ctag {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-radius: var(--radius);
    border: 1px solid transparent;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: transform 0.15s, box-shadow 0.15s;
    position: relative;
    overflow: hidden;
    min-width: 0;
}

.ctag::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    border-radius: 4px 0 0 4px;
    background: currentColor;
    opacity: 0.5;
}

.ctag:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
}

.ctag-icon {
    font-size: 22px;
    line-height: 1;
    flex-shrink: 0;
}

.ctag-body {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.ctag-value {
    font-size: 22px;
    font-weight: 800;
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ctag-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Variantes de color */
.ctag-primary {
    border-color: rgba(243, 111, 33, 0.2);
    color: var(--primary);
}

.ctag-primary .ctag-value {
    color: var(--primary);
}

.ctag-primary::before {
    background: var(--primary);
    opacity: 1;
}

.ctag-warning {
    border-color: rgba(255, 179, 71, 0.25);
    color: #d97706;
}

.ctag-warning .ctag-value {
    color: #d97706;
}

.ctag-warning::before {
    background: #f59e0b;
    opacity: 1;
}

.ctag-info {
    border-color: rgba(59, 130, 246, 0.2);
    color: #2563eb;
}

.ctag-info .ctag-value {
    color: #2563eb;
}

.ctag-info::before {
    background: #3b82f6;
    opacity: 1;
}

.ctag-pink {
    border-color: rgba(236, 72, 153, 0.2);
    color: #db2777;
}

.ctag-pink .ctag-value {
    color: #db2777;
}

.ctag-pink::before {
    background: #ec4899;
    opacity: 1;
}

.ctag-success {
    border-color: rgba(0, 200, 151, 0.2);
    color: #059669;
}

.ctag-success .ctag-value {
    color: #059669;
}

.ctag-success::before {
    background: #10b981;
    opacity: 1;
}

.ctag-danger {
    border-color: rgba(255, 71, 87, 0.2);
    color: var(--danger);
}

.ctag-danger .ctag-value {
    color: var(--danger);
}

.ctag-danger::before {
    background: var(--danger);
    opacity: 1;
}

/* Tag neutro (por definir) */
.ctag-neutral {
    border-color: rgba(0, 0, 0, 0.07);
    background: #f9fafb;
    box-shadow: none;
}

.ctag-neutral::before {
    background: #d1d5db;
    opacity: 1;
}

.ctag-neutral .ctag-value {
    color: #9ca3af;
    font-size: 18px;
}

.ctag-neutral .ctag-icon {
    opacity: 0.35;
    filter: grayscale(1);
}

.ctag-neutral:hover {
    transform: none;
    box-shadow: none;
}

/* Tag de asistencia con barra de progreso */
.ctag-asistencia .ctag-body {
    gap: 4px;
    width: 100%;
}

.ctag-asistencia-meta {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    margin-left: 2px;
    align-self: flex-end;
    padding-bottom: 2px;
}

.ctag-progress-wrap {
    position: relative;
    height: 5px;
    background: rgba(0, 0, 0, 0.07);
    border-radius: 10px;
    margin-top: 5px;
    width: 100%;
    overflow: visible;
}

.ctag-progress-bar {
    height: 100%;
    border-radius: 10px;
    transition: width 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
}

.ctag-progress-bar.bar-ok {
    background: linear-gradient(90deg, #10b981, #34d399);
}

.ctag-progress-bar.bar-warn {
    background: linear-gradient(90deg, #f59e0b, #fbbf24);
}

.ctag-progress-bar.bar-danger {
    background: linear-gradient(90deg, #ef4444, #f87171);
}

/* Línea vertical de target */
.ctag-progress-target {
    position: absolute;
    top: -3px;
    width: 2px;
    height: 11px;
    background: var(--text-muted);
    border-radius: 2px;
    transform: translateX(-50%);
    display: none;
}

.ctag-progress-target::after {
    content: attr(title);
    position: absolute;
    bottom: 14px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 9px;
    font-weight: 700;
    color: var(--text-muted);
    white-space: nowrap;
    letter-spacing: 0.3px;
}

/* ─── ACCESIBILIDAD ─── */

/* Focus visible para navegación por teclado */
a:focus-visible,
button:focus-visible,
select:focus-visible,
input:focus-visible,
.sidebar-link:focus-visible,
.btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Indicador adicional para badges (no solo color) */
.badge-activo::before {
    content: "●";
    margin-right: 4px;
    font-size: 8px;
}

.badge-inactivo::before {
    content: "○";
    margin-right: 4px;
    font-size: 8px;
}

/* Reducir animaciones para usuarios que lo prefieran */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}