/* Variables de diseño (Teal Water Theme) */
:root {
    --primary: #0d9488; /* Teal 600 */
    --primary-light: #14b8a6; /* Teal 500 */
    --primary-dark: #0f766e; /* Teal 700 */
    --bg-color: #f8fafc; /* Slate 50 */
    --card-bg: #ffffff;
    --text-main: #0f172a; /* Slate 900 */
    --text-muted: #64748b; /* Slate 500 */
    --danger: #ef4444; 
    --success: #10b981;
    --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);
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-full: 9999px;
}

/* Reseteo básico PWA */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.5;
    /* Evitar el pull-to-refresh genérico del navegador (Mobile) */
    overscroll-behavior-y: contain; 
}

h1, h2, h3 { font-family: 'Outfit', sans-serif; }

.app-container {
    max-width: 600px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Encabezado Fijo con Glassmorphism */
.top-nav {
    position: sticky;
    top: 0;
    z-index: 50;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.nav-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo-icon {
    font-size: 1.5rem;
}

h1 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-dark);
}

/* Botón Sincronizar */
.sync-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-full);
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}

.sync-btn:active { transform: scale(0.96); }
.sync-btn.loading .icon { animation: spin 1s linear infinite; }

/* Status bar (Online/Offline) */
.status-bar {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge {
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-full);
    color: white;
}
.badge.online { background-color: var(--success); }
.badge.offline { background-color: var(--text-muted); }
.pendings { color: var(--text-muted); }
.pendings strong { color: var(--danger); }

/* Main Content Layout */
.content {
    flex: 1;
    padding: 1rem;
    padding-bottom: 5rem;
}

/* Búsqueda */
.search-box input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-full);
    font-size: 1rem;
    font-family: 'Inter', sans-serif;
    outline: none;
    box-shadow: inset 0 2px 4px 0 rgb(0 0 0 / 0.02);
    transition: border-color 0.2s;
}
.search-box input:focus { border-color: var(--primary-light); }

/* Sección Listado */
.list-section { margin-top: 1.5rem; }
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}
.section-header h2 {
    font-size: 1.125rem;
    color: var(--text-main);
}
.btn-icon {
    background: var(--bg-color);
    color: var(--primary);
    border: 1px solid var(--primary-light);
    width: 32px; height: 32px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.25rem;
    cursor: pointer;
}

/* Tarjetas (Vecinos) */
.cards-grid { display: flex; flex-direction: column; gap: 0.75rem; }

.user-card {
    background: var(--card-bg);
    border-radius: var(--radius-md);
    padding: 1rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid transparent;
}
.user-card:active { transform: translateY(2px); }

.user-info h3 {
    font-size: 1rem;
    font-weight: 600;
}
.user-info p {
    font-size: 0.812rem;
    color: var(--text-muted);
}
.status-indicator {
    display: inline-block;
    width: 8px; height: 8px;
    border-radius: 50%;
    background-color: var(--danger);
    margin-right: 4px;
}
.al-dia { background-color: var(--success); }

/* Botón de pago en tarjeta */
.btn-pay {
    background: var(--bg-color);
    color: var(--primary-dark);
    border: 1px solid #e2e8f0;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-family: 'Outfit', sans-serif;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-pay:hover, .btn-pay:active { border-color: var(--primary); color: var(--primary); }
.btn-pay.paid {
    background: var(--success);
    color: white;
    border-color: var(--success);
}
.btn-pay:disabled { opacity: 0.7; pointer-events: none; }

/* Notificación flotante (Toast) */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #1e293b;
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-full);
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: var(--shadow-md);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 100;
}
.toast.show { transform: translateX(-50%) translateY(0); }
.empty-state { text-align: center; color: var(--text-muted); padding: 2rem 0; font-size: 0.875rem; }

/* Animaciones */
@keyframes spin { 100% { transform: rotate(360deg); } }

/* Formularios genéricos (Gastos/Jornales) */
.form-group {
    margin-bottom: 1rem;
}
.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
    color: var(--text-muted);
}
.form-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-md);
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}
.form-input:focus { border-color: var(--primary); }

.btn-primary {
    width: 100%;
    padding: 0.875rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
}
.btn-primary:active { transform: scale(0.98); }

/* Tablas Premium */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    background: var(--card-bg);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}
.data-table th, .data-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #f1f5f9;
}
.data-table th {
    background-color: #f8fafc;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-muted);
}
.data-table td {
    font-size: 0.875rem;
}

/* Bottom Navigation Bar */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 600px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(0,0,0,0.05);
    display: flex;
    justify-content: space-around;
    padding: 0.5rem 0;
    z-index: 50;
    padding-bottom: env(safe-area-inset-bottom, 0.5rem);
}
.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-md);
    transition: all 0.2s;
}
.nav-item .icon {
    font-size: 1.25rem;
    margin-bottom: 0.15rem;
}
.nav-item.active {
    color: var(--primary);
}
.nav-item:active { background-color: #f1f5f9; }

/* REPORTE PARA ENVIAR A PDF */
@media print {
    body { background-color: white; }
    .bottom-nav, .sync-btn, .action-section, .btn-icon, .btn-primary, #toastNotification {
        display: none !important;
    }
    .top-nav {
        position: relative;
        backdrop-filter: none;
        background: none;
        border-bottom: 2px solid black;
    }
    .app-container { max-width: 100%; padding: 0; }
    .content { padding-bottom: 0; }
    .data-table { box-shadow: none; border: 1px solid #ccc; }
    .data-table th, .data-table td { border-bottom: 1px solid #eee; }
}
