/* ============================================================
   GLOBAL THEME VARIABLES
   ============================================================ */
:root {
    --primary: #22c55e;
    --primary-soft: rgba(34, 197, 94, 0.12);

    --dark: #1e293b;
    --gray: #64748b;

    --bg: #f1f5f9;
    --white: #ffffff;

    --shadow: 0 10px 20px rgba(0,0,0,0.06);
    --radius: 16px;
    --transition: 0.25s ease;
}

/* Screen-reader only (for accessibility) */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    border: 0;
}

/* ============================================================
   BASE RESET
   ============================================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Poppins', sans-serif;
    background: var(--bg);
    color: var(--dark);
    padding-bottom: 60px;
    line-height: 1.3;
}

/* ============================================================
   HEADER
   ============================================================ */
header {
    background: var(--white);
    padding: 18px 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 100;
}

header h1 {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--dark);
}

header p {
    font-size: 0.9rem;
    color: var(--gray);
    margin-top: 3px;
}

/* ============================================================
   MAIN WRAPPER
   ============================================================ */
.app-container {
    padding: 20px;
    max-width: 480px;
    margin: 0 auto;
}

/* ============================================================
   DASHBOARD
   ============================================================ */
.dashboard {
    background: var(--white);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

/* -------- Circle calorie chart -------- */
.circle-chart {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    background: conic-gradient(var(--primary) 0%, #e2e8f0 0%);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.4s linear;
}

.cal-circle {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    background: var(--white);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.cal-circle span {
    font-size: 1.6rem;
    font-weight: 700;
}

.cal-circle small {
    font-size: 0.7rem;
    color: var(--gray);
}

/* -------- Nutrients grid -------- */
.nutrients-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.nutri-card {
    background: #f8fafc;
    padding: 8px 10px;
    border-radius: 12px;
}

.nutri-card small {
    font-size: 0.72rem;
    color: var(--gray);
}

.nutri-card span {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 4px;
    display: block;
}

.bar {
    width: 100%;
    height: 4px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
}

.bar .fill {
    height: 100%;
    width: 20%;
    transition: width 0.3s ease;
}

/* ============================================================
   INPUT CARD
   ============================================================ */
.input-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow);
    margin-bottom: 25px;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gray);
    margin-bottom: 6px;
    display: block;
}

/* Search field wrapper */
.search-wrapper {
    position: relative;
}

/* Suggestions */
.suggestions-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--white);
    border: 1px solid #e2e8f0;
    border-top: none;
    border-radius: 0 0 12px 12px;
    max-height: 260px;
    overflow-y: auto;
    display: none;
    z-index: 11;
    box-shadow: var(--shadow);
}

.suggestion-item {
    padding: 14px;
    font-size: 0.92rem;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    cursor: pointer;
    transition: var(--transition);
}

.suggestion-item:hover {
    background: var(--primary-soft);
    color: var(--primary);
}

/* ============================================================
   FORM INPUTS (Input + Select)
   ============================================================ */
input,
select {
    width: 100%;
    padding: 12px;
    border-radius: 12px;
    border: 2px solid #e2e8f0;
    background: #f8fafc;
    font-size: 1rem;
    transition: var(--transition);
}

input:focus,
select:focus {
    border-color: var(--primary);
    background: var(--white);
}

/* ============================================================
   BUTTONS
   ============================================================ */
.add-btn {
    width: 100%;
    padding: 15px;
    background: var(--primary);
    color: var(--white);
    border: none;
    border-radius: 12px;
    font-weight: 600;
    font-size: 1rem;
    box-shadow: 0 4px 12px rgba(34,197,94,0.3);
    cursor: pointer;
    transition: transform 0.15s ease;
}

.add-btn:active {
    transform: scale(0.98);
}

/* Small circle buttons (Undo, Export) */
.aux-btn,
.small-btn {
    background: #e9f8ef;
    color: var(--primary);
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid var(--primary-soft);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
}

.small-btn:active,
.aux-btn:active {
    transform: scale(0.95);
}

/* ============================================================
   LIST SECTION
   ============================================================ */
.list-section h3 {
    font-size: 1.1rem;
    margin-bottom: 15px;
}

#food-list {
    list-style: none;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 5px;
}

#food-list li {
    background: var(--white);
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 1px 5px rgba(0,0,0,0.05);
    animation: fadeItem 0.25s ease;
}

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

#food-list strong {
    display: block;
    font-size: 1rem;
}

#food-list span {
    font-size: 0.8rem;
    color: var(--gray);
}

.item-cal {
    font-size: 0.95rem;
    color: var(--primary);
    font-weight: 700;
}

/* Clear / New Day */
.clear-link {
    background: none;
    border: none;
    color: #ef4444;
    font-weight: 600;
    text-align: center;
    width: 100%;
    padding: 8px 0;
    cursor: pointer;
    margin-top: 12px;
    font-size: 0.9rem;
}

/* ============================================================
   RESPONSIVE TWEAKS
   ============================================================ */
@media (max-width: 360px) {
    header h1 {
        font-size: 1.1rem;
    }

    .cal-circle span {
        font-size: 1.3rem;
    }
}
