/* styles.css */
:root {
    --glass-bg: rgba(255, 255, 255, 0.15);
    --glass-border: rgba(255, 255, 255, 0.25);
    --color-expired: #ff4757;
    --color-expiring: #ffa502;
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: system-ui, -apple-system, sans-serif; color: #fff; }
body { background: #121212; min-height: 100vh; overflow-x: hidden; }

.bg-image {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background: url('https://images.unsplash.com/photo-1495195134817-a1a28078aca9?ixlib=rb-4.0.3&auto=format&fit=crop&w=1920&q=80') center/cover;
    filter: blur(8px) brightness(0.35); z-index: -1;
}

.glass-panel {
    background: var(--glass-bg); backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px); border: 1px solid var(--glass-border);
    border-radius: 20px; box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.hidden { display: none !important; }

.login-box {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    width: 90%; max-width: 350px; padding: 40px; text-align: center; display: flex; flex-direction: column; gap: 15px; z-index: 10;
}

input, select {
    width: 100%; padding: 12px; border-radius: 8px; border: none; outline: none;
    background: rgba(255, 255, 255, 0.15); color: #fff; font-size: 16px;
}
input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(1); }
input::placeholder { color: rgba(255,255,255,0.7); }

.btn-primary, .btn-secondary {
    padding: 12px; border: none; border-radius: 8px; cursor: pointer; font-weight: bold; transition: 0.3s; width: 100%;
}
.btn-primary { background: rgba(255, 255, 255, 0.25); color: white; }
.btn-primary:hover { background: rgba(255, 255, 255, 0.35); }
.btn-secondary { background: rgba(0, 0, 0, 0.3); color: white; }
.btn-secondary:hover { background: rgba(0, 0, 0, 0.5); }

/* RESPONSIVE LAYOUT */
.app-container { 
    display: flex; flex-direction: column; padding: 15px; gap: 20px; 
    min-height: 100vh;
}

.pantry-sidebar { 
    padding: 20px; display: flex; flex-direction: column; gap: 15px; 
    max-height: 45vh; /* Su mobile limita l'altezza e fa scrollare internamente */
    overflow-y: auto;
}

.main-content { 
    display: flex; flex-direction: column; gap: 20px; 
    padding-bottom: 80px; /* Spazio per il FAB */
}

@media(min-width: 768px) { 
    body { overflow: hidden; }
    .app-container { flex-direction: row; height: 100vh; padding: 20px; }
    .pantry-sidebar { flex: 1; max-width: 350px; max-height: 100%; }
    .main-content { flex: 3; overflow-y: auto; padding-bottom: 20px; padding-right: 10px; }
}

.sidebar-header { display: flex; justify-content: space-between; align-items: center; }
.sidebar-actions { display: flex; gap: 10px; }
.icon-btn { background: none; border: none; font-size: 1.5rem; cursor: pointer; transition: 0.2s; }
.icon-btn:hover { transform: scale(1.1); }

#pantry-list, .full-grid-list { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.full-grid-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 15px; margin-top:20px; }

.pantry-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px; border-radius: 12px; background: rgba(0,0,0,0.25); border-left: 4px solid transparent;
}
.pantry-item.expired { border-left-color: var(--color-expired); }
.pantry-item.expiring { border-left-color: var(--color-expiring); }
.pantry-item.expired strong { color: var(--color-expired); }
.pantry-item.expiring strong { color: var(--color-expiring); }

.delete-btn {
    background: rgba(255, 71, 87, 0.8); border: none; border-radius: 8px;
    width: 30px; height: 30px; cursor: pointer; font-weight: bold; transition: 0.2s;
}

.header { padding: 20px; text-align: center; }

.recipe-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 15px; }
.recipe-card { padding: 20px; display: flex; flex-direction: column; gap: 15px; position: relative; overflow: hidden; min-height: 160px; }

.badge { position: absolute; top: 12px; right: 12px; font-size: 0.7rem; padding: 5px 8px; border-radius: 20px; font-weight: bold; text-transform: uppercase; }
.badge.perfect { background: #2ed573; color: #121212; }
.badge.missing { background: var(--color-expiring); color: #121212; }

.fab { position: fixed; bottom: 20px; right: 20px; width: 65px; height: 65px; border-radius: 50%; border: 1px solid var(--glass-border); font-size: 1.5rem; cursor: pointer; z-index: 100; display: flex; align-items: center; justify-content: center; }

.modal {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(0,0,0,0.75); backdrop-filter: blur(8px);
    display: flex; justify-content: center; align-items: center; z-index: 200; opacity: 1; transition: 0.3s;
}
.modal.hidden { opacity: 0; pointer-events: none; }
.modal-content { padding: 30px; width: 90%; max-width: 400px; text-align: center; display: flex; flex-direction: column; gap: 15px; max-height: 90vh; overflow-y: auto; }

.spinner { width: 35px; height: 35px; border: 3px solid rgba(255,255,255,0.2); border-top-color: #2ed573; border-radius: 50%; animation: spin 0.8s linear infinite; margin: 0 auto 15px; }
@keyframes spin { to { transform: rotate(360deg); } }