/* css/styles.css */

/* ================= VARIABLES ================= */
:root {
    --primary: #2e7d32;
    --primary-light: #4caf50;
    --secondary: #81c784;
    --bg-body: #f4f7f6;
    --bg-card: #ffffff;
    --text-dark: #1f2937;
    --text-light: #6b7280;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.12);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --radius: 16px;
    --nav-height: 70px;
}

/* ================= RESET & BASE ================= */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', system-ui, sans-serif;
}

body {
    background-color: var(--bg-body);
    color: var(--text-dark);
    padding-bottom: var(--nav-height);
}

/* ================= LAYOUT PRINCIPAL ================= */
.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
}

/* Vistas (Ocultar/Mostrar) */
.view {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

.view.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ================= HEADER ================= */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.user-greeting h2 {
    font-size: 1.5rem;
    color: var(--primary);
}

.user-greeting p {
    color: var(--text-light);
    font-size: 0.9rem;
}

.points-badge {
    background: var(--primary);
    color: white;
    padding: 8px 16px;
    border-radius: 50px;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: var(--shadow-md);
}

/* ================= TARJETAS DE RECICLAJE (GRID) ================= */
.section-title {
    font-size: 1.2rem;
    margin-bottom: 15px;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    gap: 10px;
}

.grid-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    /* Adaptativo automático */
    gap: 15px;
    margin-bottom: 30px;
}

.card-residuo {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
    border: 2px solid transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.card-residuo:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
    border-color: var(--secondary);
}

.card-residuo .icon-box {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    color: white;
    margin-bottom: 5px;
}

.card-residuo h3 {
    font-size: 1rem;
    color: var(--text-dark);
}

.card-residuo p {
    font-size: 0.8rem;
    color: var(--text-light);
}

.card-residuo .pts {
    font-weight: bold;
    color: var(--primary);
    font-size: 1.1rem;
}

/* ================= FORMULARIO / MODAL ================= */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: white;
    padding: 25px;
    border-radius: var(--radius);
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-md);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    font-size: 0.9rem;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
}

.btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.2s;
    font-size: 1rem;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: #1b5e20;
}

.btn-secondary {
    background: #e5e7eb;
    color: var(--text-dark);
    margin-top: 10px;
}

/* ================= NAVEGACIÓN INFERIOR (MÓVIL) ================= */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    background: var(--bg-card);
    display: flex;
    justify-content: space-around;
    align-items: center;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
    z-index: 999;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: var(--text-light);
    font-size: 0.75rem;
    cursor: pointer;
    text-decoration: none;
    transition: 0.2s;
}

.nav-item i {
    font-size: 1.3rem;
}

.nav-item.active {
    color: var(--primary);
    font-weight: bold;
}

/* ================= LISTAS (Historial / Ranking) ================= */
.list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-card);
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 10px;
    box-shadow: var(--shadow-sm);
}

.list-item .info h4 {
    font-size: 0.95rem;
    margin-bottom: 2px;
}

.list-item .info p {
    font-size: 0.8rem;
    color: var(--text-light);
}

.list-item .value {
    font-weight: bold;
    color: var(--primary);
}

.badge {
    padding: 3px 8px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: bold;
}

.badge.validado {
    background: #dcfce7;
    color: #166534;
}

.badge.pendiente {
    background: #fef3c7;
    color: #92400e;
}

/* ================= MEDIA QUERY PARA PC (Escritorio) ================= */
@media (min-width: 768px) {
    body {
        padding-bottom: 0;
        display: flex;
    }

    /* La barra inferior se convierte en Sidebar lateral */
    .bottom-nav {
        position: static;
        flex-direction: column;
        justify-content: flex-start;
        width: 90px;
        height: 100vh;
        padding-top: 30px;
        gap: 40px;
        border-right: 1px solid #eee;
        box-shadow: none;
    }

    .nav-item {
        font-size: 0.8rem;
    }

    .nav-item i {
        font-size: 1.5rem;
    }

    .app-container {
        margin-left: 0;
        max-width: 100%;
        padding: 40px;
        flex: 1;
    }

    .grid-cards {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}