/* Reset y Variables */
:root {
    --primary-color: #4CAF50;
    --accent-color: #FF9800;
    --danger-color: #F44336;
    --bg-color: #f5f5f5;
    --card-bg: #ffffff;
    --text-color: #333333;
    --border-radius: 12px;
    --header-height: 80px;
    --nav-height: 60px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
    color: var(--text-color);
    padding-bottom: var(--nav-height); /* Espacio para el menú inferior */
    padding-top: var(--header-height); /* Espacio para el header fijo */
}

/* Clases de utilidad */
.hidden { display: none !important; }
.view { animation: fadeIn 0.3s ease; }

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

/* Header Fijo */
.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background-color: var(--primary-color);
    color: white;
    padding: 10px 15px;
    height: var(--header-height);
    box-sizing: border-box;
    z-index: 1000;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.user-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.2rem;
    font-weight: bold;
}

.balance-badge {
    background-color: rgba(255,255,255,0.2);
    padding: 4px 10px;
    border-radius: 20px;
}

.status-bar {
    margin-top: 5px;
    font-size: 0.9rem;
    opacity: 0.9;
}

/* Contenido Principal */
.app-content {
    padding: 15px;
    max-width: 600px;
    margin: 0 auto;
}

h2 {
    margin-top: 0;
    color: var(--primary-color);
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 10px;
}

/* Listas de Tarjetas (Tareas y Recompensas) */
.card-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: transform 0.1s active;
}

.card:active {
    transform: scale(0.98);
}

.card-info h3 {
    margin: 0 0 5px 0;
    font-size: 1rem;
}

.card-info p {
    margin: 0;
    color: #666;
    font-size: 0.85rem;
}

.btn-action {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: bold;
    cursor: pointer;
}

.btn-action.spend {
    background-color: var(--accent-color);
}

.btn-action:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

/* Estilos para tareas completadas */
.task-card.completed {
    background-color: #e8f5e9;
    border: 1px solid var(--primary-color);
    opacity: 0.8;
}

.task-card.pending {
    background-color: #fff3cd;
    border: 1px solid #ff9800;
    opacity: 0.9;
}

.task-card.pending .card-info h3 {
    color: #7a4a00;
}

.task-card.completed .card-info h3 {
    text-decoration: line-through;
    color: #555;
}

.completion-badge {
    color: var(--primary-color);
    font-weight: bold;
    font-size: 0.9rem;
    padding: 5px 10px;
    background: white;
    border-radius: 15px;
    border: 1px solid var(--primary-color);
}

.pending-badge {
    color: #ff9800;
    font-weight: bold;
    font-size: 0.9rem;
    padding: 5px 10px;
    background: white;
    border-radius: 15px;
    border: 1px solid #ff9800;
}

/* Recompensas */
.balance-large {
    text-align: center;
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 20px;
    color: var(--text-color);
}

/* Historial */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.history-item {
    background: white;
    padding: 10px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 4px solid #ccc;
}

.history-item.earn { border-left-color: var(--primary-color); }
.history-item.spend { border-left-color: var(--accent-color); }
.history-item.adjust { border-left-color: var(--danger-color); }

.history-details {
    display: flex;
    flex-direction: column;
}

.history-time {
    font-size: 0.75rem;
    color: #888;
}

.history-points {
    font-weight: bold;
}

.points-plus { color: var(--primary-color); }
.points-minus { color: var(--danger-color); }

/* Navegación Inferior */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    height: var(--nav-height);
    display: flex;
    justify-content: space-around;
    align-items: center;
    box-shadow: 0 -2px 5px rgba(0,0,0,0.1);
    z-index: 1000;
}

/* Estilos para estado pendiente */
.pending-card {
    border-left: 5px solid #ffc107 !important;
    background-color: #fff9c4;
}

.nav-btn {
    background: none;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #888;
    font-size: 0.8rem;
    cursor: pointer;
    width: 25%;
}

.nav-btn span:first-child {
    font-size: 1.4rem;
    margin-bottom: 2px;
}

.nav-btn.active {
    color: var(--primary-color);
}

/* Modal System */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    animation: fadeIn 0.2s ease;
}

.modal-content {
    background: white;
    padding: 25px;
    border-radius: 16px;
    width: 85%;
    max-width: 320px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    text-align: center;
    animation: slideUp 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

.modal-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
}

.modal-input {
    width: 100%;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1.1rem;
    text-align: center;
    margin-top: 10px;
    box-sizing: border-box;
    outline: none;
}

.modal-input:focus {
    border-color: var(--primary-color);
}

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