:root {
    --bg-color: #f2f2f7;
    --text-color: #1c1c1e;
    --glass-bg: rgba(255, 255, 255, 0.65);
    --border-glass: rgba(255, 255, 255, 0.4);
    
    /* Colores semánticos */
    --primary-blue: #007AFF; 
    --danger-red: #FF3B30;   
    --warning-yellow: #FF9500;
    --success-green: #34C759;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #000000;
        --text-color: #ffffff;
        --glass-bg: rgba(28, 28, 30, 0.75);
        --border-glass: rgba(255, 255, 255, 0.1);
    }
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    padding: 20px;
    padding-bottom: 80px;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden; /* Evitar scroll horizontal */
}

/* Glassmorphism Classes */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-glass);
    border-radius: 20px;
    /* IMPORTANTE: Padding eliminado aquí para los items swipeables */
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.05);
}

/* INPUTS (Alineación corregida) */
.glass-input {
    display: block;
    background: rgba(120, 120, 128, 0.1);
    border: none;
    border-radius: 10px;
    padding: 12px;
    color: var(--text-color);
    font-size: 16px;
    width: 100%; 
    max-width: 100%;
    box-sizing: border-box;
    margin: 0 0 10px 0;
    -webkit-appearance: none;
    appearance: none;
}

input[type="date"].glass-input {
    min-height: 44px;
    font-family: inherit;
}

/* Header */
.total-banner {
    text-align: center;
    position: relative;
}
.total-banner h1 {
    margin: 10px 0;
    font-size: 2.5rem;
    font-weight: 700;
}
.actions-toolbar {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 15px;
}

/* --- SWIPE ACTIONS (NUEVO) --- */

.transaction-item {
    /* El contenedor ahora es una ventana de visualización */
    padding: 0 !important; /* Sobrescribe el padding del glass-panel */
    overflow: hidden;
    position: relative;
    /* Bloquea scroll horizontal del navegador al deslizar */
    touch-action: pan-y; 
    user-select: none;
    animation: fadeIn 0.3s ease;
}

.swipe-track {
    display: flex;
    width: 100%;
    transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
    will-change: transform;
}

/* Contenido Principal (Lo que se ve normalmente) */
.swipe-content {
    flex: 0 0 100%; /* Ocupa el 100% del ancho */
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px; /* Recuperamos el padding aquí */
    box-sizing: border-box;
    background: transparent;
}

/* Botones Ocultos (A la derecha) */
.swipe-actions {
    display: flex;
    flex: 0 0 auto; /* No se estira */
}

.swipe-btn {
    width: 74px; /* Ancho estándar iOS */
    border: none;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    cursor: pointer;
    margin: 0;
    padding: 0;
}

.edit-action { background-color: var(--warning-yellow); }
.delete-action { background-color: var(--danger-red); }

/* Textos dentro del item */
.t-date { font-size: 0.8rem; opacity: 0.6; }
.t-desc { font-weight: 500; font-size: 1rem;}
.t-amount { font-weight: 700; font-size: 1.1rem; }

/* Colores condicionales */
.amount-income { color: var(--primary-blue); }
.amount-expense { color: var(--danger-red); }

/* Botones Generales */
.button-group { display: flex; gap: 10px; }
.action-btn {
    flex: 1;
    border: none;
    padding: 15px;
    border-radius: 12px;
    color: white;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: opacity 0.2s;
}
.action-btn:active { opacity: 0.7; }
.income-btn { background-color: var(--primary-blue); }
.expense-btn { background-color: var(--danger-red); }

.icon-btn {
    background: rgba(120, 120, 128, 0.1);
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-color);
    cursor: pointer;
}
.icon-btn:active { background: rgba(120, 120, 128, 0.2); }

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