/* Reset y configuración base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #e3f2fd 0%, #f1f8e9 50%, #e8f5e9 100%);
    min-height: 100vh;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Container principal */
.container {
    max-width: 800px;
    width: 100%;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 30px;
    animation: fadeInDown 0.6s ease-out;
}

.logo {
    font-size: 42px;
    background: linear-gradient(135deg, #1976d2, #4caf50);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 10px;
    font-weight: bold;
}

.tagline {
    color: #546e7a;
    font-size: 16px;
}

/* Card principal */
.shopping-card {
    background: #ffffff;
    border-radius: 25px;
    padding: 35px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
    animation: fadeInUp 0.6s ease-out 0.2s backwards;
}

/* Formulario */
.add-item-form {
    margin-bottom: 30px;
}

.input-group {
    display: flex;
    gap: 10px;
}

.item-input {
    flex: 1;
    padding: 16px 20px;
    border: 2px solid #e0e0e0;
    border-radius: 15px;
    font-size: 16px;
    transition: all 0.3s;
    background: #f8f9fa;
}

.item-input:focus {
    outline: none;
    border-color: #1976d2;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(25, 118, 210, 0.1);
}

.quantity-input {
    width: 80px;
    padding: 16px;
    border: 2px solid #e0e0e0;
    border-radius: 15px;
    font-size: 16px;
    text-align: center;
    transition: all 0.3s;
    background: #f8f9fa;
}

.quantity-input:focus {
    outline: none;
    border-color: #4caf50;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(76, 175, 80, 0.1);
}

.add-btn {
    padding: 16px 30px;
    border: none;
    border-radius: 15px;
    background: linear-gradient(135deg, #1976d2, #1565c0);
    color: #fff;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(25, 118, 210, 0.3);
}

.add-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(25, 118, 210, 0.4);
}

.add-btn:active {
    transform: translateY(0);
}

.btn-icon {
    font-size: 20px;
}

/* Estadísticas */
.stats-bar {
    display: flex;
    justify-content: space-around;
    padding: 20px;
    background: linear-gradient(135deg, #e3f2fd, #f1f8e9);
    border-radius: 15px;
    margin-bottom: 25px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
}

.stat-icon {
    font-size: 20px;
}

.stat-label {
    color: #546e7a;
    font-weight: 500;
}

.stat-value {
    color: #1976d2;
    font-weight: bold;
    font-size: 18px;
}

/* Filtros */
.filters {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.filter-btn {
    flex: 1;
    min-width: 120px;
    padding: 12px 20px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    background: #f8f9fa;
    color: #546e7a;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.filter-btn:hover {
    border-color: #1976d2;
    background: #e3f2fd;
}

.filter-btn.active {
    background: linear-gradient(135deg, #1976d2, #1565c0);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 4px 15px rgba(25, 118, 210, 0.3);
}

/* Lista */
.shopping-list {
    max-height: 500px;
    overflow-y: auto;
    margin-bottom: 25px;
}

.shopping-list::-webkit-scrollbar {
    width: 8px;
}

.shopping-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.shopping-list::-webkit-scrollbar-thumb {
    background: #1976d2;
    border-radius: 10px;
}

/* Estado vacío */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #90a4ae;
}

.empty-icon {
    font-size: 80px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-title {
    font-size: 24px;
    margin-bottom: 10px;
    color: #546e7a;
}

.empty-text {
    font-size: 16px;
}

/* Item de la lista */
.list-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 18px;
    background: #f8f9fa;
    border-radius: 15px;
    margin-bottom: 12px;
    transition: all 0.3s;
    animation: slideIn 0.4s ease-out;
    border: 2px solid transparent;
}

.list-item:hover {
    background: #fff;
    border-color: #e0e0e0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.list-item.purchased {
    opacity: 0.6;
    background: #f1f8e9;
}

.list-item.purchased .item-text {
    text-decoration: line-through;
    color: #81c784;
}

/* Checkbox personalizado */
.checkbox-wrapper {
    position: relative;
}

.item-checkbox {
    appearance: none;
    width: 28px;
    height: 28px;
    border: 3px solid #1976d2;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
}

.item-checkbox:hover {
    border-color: #1565c0;
    box-shadow: 0 0 0 4px rgba(25, 118, 210, 0.1);
}

.item-checkbox:checked {
    background: linear-gradient(135deg, #4caf50, #66bb6a);
    border-color: transparent;
}

.item-checkbox:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 18px;
    font-weight: bold;
}

/* Contenido del item */
.item-content {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
}

.item-text {
    flex: 1;
    font-size: 16px;
    color: #263238;
    font-weight: 500;
}

.item-quantity {
    padding: 6px 14px;
    background: linear-gradient(135deg, #e3f2fd, #f1f8e9);
    border-radius: 20px;
    font-size: 14px;
    font-weight: bold;
    color: #1976d2;
}

/* Botones de acción del item */
.item-actions {
    display: flex;
    gap: 8px;
}

.action-item-btn {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.edit-btn {
    background: #e3f2fd;
    color: #1976d2;
}

.edit-btn:hover {
    background: #1976d2;
    color: #fff;
    transform: scale(1.1);
}

.delete-btn {
    background: #ffebee;
    color: #f44336;
}

.delete-btn:hover {
    background: #f44336;
    color: #fff;
    transform: scale(1.1);
}

/* Barra de acciones */
.actions-bar {
    display: flex;
    gap: 12px;
    padding-top: 20px;
    border-top: 2px solid #f0f0f0;
}

.action-btn {
    flex: 1;
    padding: 14px 20px;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.clear-btn {
    background: #e8f5e9;
    color: #4caf50;
    border: 2px solid #4caf50;
}

.clear-btn:hover {
    background: #4caf50;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
}

.delete-all-btn {
    background: #ffebee;
    color: #f44336;
    border: 2px solid #f44336;
}

.delete-all-btn:hover {
    background: #f44336;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(244, 67, 54, 0.3);
}

/* Footer */
.footer {
    text-align: center;
    margin-top: 30px;
    padding: 20px;
}

.footer-text {
    color: #546e7a;
    font-size: 14px;
}

.highlight {
    color: #1976d2;
    font-weight: bold;
}

/* Animaciones */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Responsive */
@media (max-width: 768px) {
    body {
        padding: 15px;
        align-items: flex-start;
        padding-top: 20px;
    }

    .logo {
        font-size: 32px;
    }

    .tagline {
        font-size: 14px;
    }

    .shopping-card {
        padding: 25px 20px;
    }

    .input-group {
        flex-direction: column;
    }

    .quantity-input {
        width: 100%;
    }

    .add-btn {
        width: 100%;
        justify-content: center;
    }

    .stats-bar {
        flex-direction: column;
        gap: 12px;
    }

    .stat-item {
        justify-content: space-between;
    }

    .filters {
        flex-direction: column;
    }

    .filter-btn {
        width: 100%;
    }

    .shopping-list {
        max-height: 400px;
    }

    .actions-bar {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .logo {
        font-size: 28px;
    }

    .shopping-card {
        padding: 20px 15px;
        border-radius: 20px;
    }

    .item-input,
    .quantity-input,
    .add-btn {
        padding: 14px 16px;
        font-size: 15px;
    }

    .list-item {
        padding: 15px;
    }

    .item-text {
        font-size: 15px;
    }

    .item-quantity {
        font-size: 13px;
        padding: 5px 12px;
    }

    .action-item-btn {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
}