/* Modern UI Design */
#food-checker {
    padding: 2rem;
    border: none;
    border-radius: 12px;
    max-width: 90vw;
    width: 100%;
    margin: 2rem auto;
    background: linear-gradient(135deg, #e3f2fd, #f3e5f5);
    box-sizing: border-box;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

#food-checker h3 {
    text-align: center;
    color: #424242;
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
    font-weight: 600;
    position: relative;
}

#food-checker h3::before {
  content: "🥗";
  display: block !important;
  font-size: 2rem;
  margin-bottom: 0.5rem;
  line-height: 1;
}

.intro {
    text-align: center;
    color: #616161;
    font-size: 1rem;
    margin-bottom: 1.5rem;
    font-style: italic;
}

#food-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-group {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 1rem;
    color: #616161;
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    box-sizing: border-box;
    font-size: 1rem;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.form-group input:focus {
    border-color: #007cba;
    box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.1);
    outline: none;
}

/* === Checkboxes layout & alignment === */
.checkbox-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px 16px;              /* row / column gaps */
    align-items: start;          /* ensures consistent start alignment */
    justify-items: start;        /* left-align each label cell */
}

.checkbox-group label {
    display: inline-flex;        /* keep checkbox + text on the same line */
    align-items: center;         /* vertically center */
    gap: 8px;                    /* space between box and text */
    line-height: 1.3;
    font-weight: normal;
    cursor: pointer;
    user-select: none;
    margin: 0;                   /* remove any theme margin */
    color: #616161;
}

.checkbox-group input[type="checkbox"] {
    margin: 0;                   /* reset browser default margins */
    inline-size: 16px;           /* consistent box size */
    block-size: 16px;
    flex: 0 0 auto;              /* prevent stretching/shrinking */
    vertical-align: middle;      /* extra guard for old engines */
}

/* Optional: nicer focus ring for accessibility */
.checkbox-group input[type="checkbox"]:focus-visible {
    outline: 2px solid #38bdf8;
    outline-offset: 2px;
}

/* Prevent odd wrapping that separates the box from its first word in some themes */
.checkbox-group label > input[type="checkbox"] + * {
    white-space: nowrap;         /* keep first word with the checkbox */
}

/* Turnstile centering */
.cf-turnstile {
    display: flex;
    justify-content: center;
}

button[type="submit"] {
    padding: 0.75rem 2rem;
    background: linear-gradient(135deg, #007cba, #005a87);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: transform 0.2s, box-shadow 0.2s;
}

button[type="submit"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 124, 186, 0.4);
}

button[type="submit"]:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

#food-checker #result {
  text-align: center;
  font-size: 1rem;
  margin-top: 1.5rem;
  padding: 1rem;
  border-radius: 8px;
  transition: all 0.3s;
}

/* Result styling */
#food-checker #result.yes,
#food-checker #result.no,
#food-checker #result.limit,
#food-checker #result.error {
  font-weight: bold;
  padding: 1rem 1.5rem;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  animation: fadeIn 0.5s ease-in;
}

#food-checker #result.yes {
  background-color: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}
#food-checker #result.no {
  background-color: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}
#food-checker #result.limit {
  background-color: #fff3cd;
  color: #856404;
  border: 1px solid #ffeaa7;
}
#food-checker #result.error {
  background-color: #ffebee;
  color: #b71c1c;
  border: 1px solid #ffcdd2;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    #food-checker {
        padding: 1rem;
        margin: 1rem auto;
        max-width: 95vw;
    }

    #food-checker h3 {
        font-size: 1.25rem;
    }

    .intro {
        font-size: 0.9rem;
    }

    .form-group input {
        padding: 0.5rem;
        font-size: 0.9rem;
    }

    .checkbox-group {
        grid-template-columns: 1fr; /* single column on tablets/phones */
    }

    button[type="submit"] {
        padding: 0.5rem;
        font-size: 0.9rem;
    }

    #result {
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    #food-checker {
        padding: 0.75rem;
        margin: 0.75rem auto;
    }

    #food-checker h3 {
        font-size: 1.1rem;
    }

    .form-group label {
        font-size: 0.9rem;
    }

    .form-group input {
        padding: 0.5rem;
        font-size: 0.85rem;
    }

    .checkbox-group {
        grid-template-columns: 1fr;
    }

    button[type="submit"] {
        padding: 0.5rem;
        font-size: 0.85rem;
    }

    #result {
        font-size: 0.85rem;
    }
}
