* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Softer, more eye-friendly palette */
    --primary-color: #3b82f6;      /* soft blue */
    --primary-dark: #2563eb;
    --secondary-color: #22c55e;    /* gentle green */
    --background: #f3f4f6;         /* warm grey background */
    --surface: #ffffff;
    --text-primary: #0f172a;       /* slightly softer than pure black */
    --text-secondary: #6b7280;
    --border: #e5e7eb;
    --error: #ef4444;
    --success: #16a34a;
    --shadow: 0 1px 3px 0 rgba(15, 23, 42, 0.08), 0 1px 2px 0 rgba(15, 23, 42, 0.04);
    --shadow-lg: 0 18px 45px -15px rgba(15, 23, 42, 0.25);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    /* Pleasant medium blue background */
    background: radial-gradient(circle at top left, #bfdbfe 0%, #93c5fd 40%, #60a5fa 100%);
    min-height: 100vh;
    padding: 20px;
    color: var(--text-primary);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

header {
    text-align: center;
    color: var(--text-primary);
    margin-bottom: 40px;
    padding: 40px 20px;
}

header h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 10px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.subtitle {
    font-size: 1.25rem;
    opacity: 0.95;
    font-weight: 300;
}

main {
    background: var(--surface);
    border-radius: 16px;
    padding: 40px;
    box-shadow: var(--shadow-lg);
    margin-bottom: 30px;
}

.input-section {
    margin-bottom: 30px;
}

.input-group {
    margin-bottom: 24px;
}

.input-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.input-group input,
.input-group textarea,
.input-group select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.2s;
    background: var(--surface);
}

.input-group select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 40px;
}

.input-group input:focus,
.input-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.input-group textarea {
    resize: vertical;
    min-height: 100px;
}

.input-group small {
    display: block;
    margin-top: 6px;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.button-group {
    display: flex;
    gap: 1rem;
    align-items: center;
    width: 100%;
}

.button-group .btn-primary {
    flex: 1;
    margin-bottom: 0; /* keep primary and stop button aligned */
}

.stop-button {
    background: #ef4444;
    color: white;
    padding: 14px 24px;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.stop-button:hover {
    background: #dc2626;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(239, 68, 68, 0.3);
}

.stop-button:disabled {
    background: #9ca3af;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    width: 100%;
    padding: 14px 24px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 24px;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.loader {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.example-queries {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.eval-controls {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    margin-bottom: 16px;
}

.eval-help {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.examples-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.example-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.chip {
    padding: 8px 16px;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-primary);
}

.chip:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-1px);
}

.error-message {
    background: #fef2f2;
    border: 1px solid var(--error);
    color: var(--error);
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 24px;
    font-size: 0.95rem;
}

.results-section {
    margin-top: 40px;
    animation: fadeIn 0.5s;
}

.eval-section {
    margin-top: 32px;
    padding: 20px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: rgba(248, 250, 252, 0.9);
    box-shadow: var(--shadow);
}

.eval-status {
    margin-top: 8px;
    margin-bottom: 16px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.eval-table-wrapper {
    width: 100%;
    overflow-x: auto;
}

.eval-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.eval-table th,
.eval-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    text-align: left;
}

.eval-table th {
    background: #eff6ff;
    font-weight: 600;
    color: #1d4ed8;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.eval-table tr:nth-child(even) td {
    background: #f9fafb;
}

.eval-table tr:hover td {
    background: #eef2ff;
}

.eval-table td:last-child {
    font-weight: 600;
}

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

.summary-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    border-radius: 12px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-lg);
}

.summary-card h2 {
    margin-bottom: 20px;
    font-size: 1.5rem;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.summary-item {
    display: flex;
    flex-direction: column;
}

.summary-label {
    font-size: 0.85rem;
    opacity: 0.9;
    margin-bottom: 6px;
}

.summary-value {
    font-size: 1.5rem;
    font-weight: 700;
}

.compliance-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}

.compliance-tag {
    background: rgba(255, 255, 255, 0.2);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    backdrop-filter: blur(10px);
}

.warning-banner {
    background: linear-gradient(135deg, #e91e63, #f06292);
    border: 2px solid #e91e63;
    border-radius: 12px;
    padding: 16px 20px;
    margin: 20px 0;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 4px 12px rgba(233, 30, 99, 0.4);
}

.warning-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

.warning-banner span:last-child {
    color: #000000;
    font-size: 0.95rem;
    line-height: 1.5;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.5);
}

.mode-badge {
    background: rgba(255, 255, 255, 0.25);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mode-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 40px;
}

.smart-suggestions {
    margin-top: 24px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.8);
    box-shadow: var(--shadow);
}

.suggestion-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
}

.suggestion-chip {
    background: var(--primary-color);
    color: white;
    padding: 8px 14px;
    border-radius: 18px;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    box-shadow: var(--shadow);
    transition: all 0.2s;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

.suggestion-chip:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.history-section {
    margin-top: 24px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: var(--shadow);
}

.history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.history-content {
    margin-top: 12px;
}

.history-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 12px;
}

.history-card {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px;
    background: #f8fafc;
    box-shadow: var(--shadow);
}

.history-query {
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.history-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}

.history-tag {
    background: #e0e7ff;
    color: #1e3a8a;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.85rem;
}

.history-actions {
    display: flex;
    justify-content: flex-end;
}

.regenerate-btn {
    background: var(--secondary-color);
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.regenerate-btn:hover {
    background: #0ea268;
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.link-button {
    background: transparent;
    border: 1px solid rgba(99, 102, 241, 0.4);
    color: var(--primary-color);
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.link-button:hover {
    background: rgba(99, 102, 241, 0.08);
    border-color: var(--primary-dark);
    color: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.link-button:focus-visible {
    outline: 2px solid rgba(99, 102, 241, 0.7);
    outline-offset: 2px;
}

.empty-state {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.mode-badge {
    background: rgba(255, 255, 255, 0.25);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mode-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 40px;
}

.meal-plan-days {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.day-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow);
}

.day-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--border);
}

.day-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.day-date {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.meals-container {
    display: grid;
    gap: 20px;
}

.meal-card {
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
    transition: all 0.2s;
}

.meal-card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.meal-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 12px;
}

.meal-type {
    display: inline-block;
    padding: 4px 12px;
    background: var(--primary-color);
    color: white;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.meal-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 8px 0;
}

.meal-description {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 16px;
    line-height: 1.6;
}

.meal-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.detail-section {
    background: white;
    padding: 12px;
    border-radius: 6px;
    border: 1px solid var(--border);
}

.detail-section h4 {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}

.detail-section ul {
    list-style: none;
    font-size: 0.9rem;
    line-height: 1.8;
}

.detail-section ul li:before {
    content: "• ";
    color: var(--primary-color);
    font-weight: bold;
}

.nutrition-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-top: 8px;
}

.nutrition-item {
    text-align: center;
    padding: 8px;
    background: var(--background);
    border-radius: 6px;
}

.nutrition-value {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 1.1rem;
}

.nutrition-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.instructions {
    background: white;
    padding: 16px;
    border-radius: 6px;
    border-left: 4px solid var(--primary-color);
    margin-top: 16px;
}

.instructions h4 {
    font-size: 0.85rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 12px;
    letter-spacing: 0.5px;
}

.instructions p {
    font-size: 0.95rem;
    line-height: 1.8;
    color: var(--text-primary);
    white-space: pre-line;
}

footer {
    text-align: center;
    color: var(--text-secondary);
    padding: 30px 20px;
    opacity: 0.9;
}

.footer-links {
    margin-top: 10px;
}

.footer-links a {
    color: var(--primary-color);
    text-decoration: none;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.footer-links a:hover {
    opacity: 1;
    text-decoration: underline;
}

@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }

    main {
        padding: 24px;
    }

    .summary-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .meal-details {
        grid-template-columns: 1fr;
    }

    .nutrition-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

