/* ============================================
   NUTRICHEF V2 - STYLESHEET
   Design moderne et épuré
   ============================================ */

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

:root {
    --primary: #27ae60;
    --primary-dark: #229954;
    --primary-light: #2ecc71;
    --secondary: #34495e;
    --background: #f8f9fa;
    --card-bg: #ffffff;
    --text: #2c3e50;
    --text-light: #7f8c8d;
    --border: #e1e8ed;
    --error: #e74c3c;
    --success: #27ae60;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 20px rgba(0,0,0,0.12);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--background);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    text-align: center;
    padding: 40px 20px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border-radius: 16px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-lg);
}

.logo {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 10px;
}

.tagline {
    font-size: 16px;
    opacity: 0.95;
}

/* Main Content */
.main-content {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 30px;
    box-shadow: var(--shadow);
    margin-bottom: 30px;
}

/* Mode Selector */
.mode-selector {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
}

.mode-btn {
    flex: 1;
    padding: 12px 20px;
    border: 2px solid var(--border);
    background: white;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    transition: all 0.2s;
}

.mode-btn:hover {
    border-color: var(--primary-light);
    background: #f0fff4;
}

.mode-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Input Areas */
.input-area {
    animation: fadeIn 0.3s;
}

.input-area label {
    display: block;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text);
}

textarea,
input[type="url"],
input[type="number"] {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: 10px;
    font-size: 15px;
    font-family: inherit;
    transition: border-color 0.2s;
}

textarea {
    resize: vertical;
    min-height: 200px;
}

textarea:focus,
input:focus {
    outline: none;
    border-color: var(--primary);
}

.portions-input {
    margin-top: 20px;
    margin-bottom: 20px;
}

.portions-input input {
    max-width: 120px;
}

.help-text {
    font-size: 13px;
    color: var(--text-light);
    margin-top: 8px;
    margin-bottom: 20px;
}

/* Buttons */
.btn-analyze {
    width: 100%;
    padding: 16px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: var(--shadow);
}

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

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

/* Loading */
.loading {
    text-align: center;
    padding: 40px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

/* Results */
.results {
    animation: fadeIn 0.4s;
}

.results h2 {
    font-size: 24px;
    margin-bottom: 30px;
    color: var(--text);
}

.ingredients-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 30px;
}

.ingredients-section h3 {
    font-size: 18px;
    margin-bottom: 15px;
    color: var(--text);
}

.ingredients-list {
    list-style: none;
}

.ingredients-list li {
    padding: 10px;
    border-bottom: 1px solid var(--border);
}

.ingredients-list li:last-child {
    border-bottom: none;
}

.match-info {
    font-size: 13px;
    color: var(--text-light);
    margin-left: 8px;
}

/* Nutrition Cards */
.nutrition-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.nutrition-card {
    padding: 20px;
    border-radius: 10px;
    box-shadow: var(--shadow);
}

.nutrition-card.total {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.nutrition-card.portion {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
}

.nutrition-card h3 {
    font-size: 16px;
    margin-bottom: 20px;
    opacity: 0.95;
}

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

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

.nutrition-item .label {
    font-size: 13px;
    opacity: 0.9;
    margin-bottom: 5px;
}

.nutrition-item .value {
    font-size: 22px;
    font-weight: 700;
}

/* Error */
.error {
    background: #ffe5e5;
    border: 2px solid var(--error);
    border-radius: 10px;
    padding: 20px;
    text-align: center;
}

.error-message {
    color: var(--error);
    font-weight: 600;
}

/* Footer */
.footer {
    text-align: center;
    padding: 20px;
    font-size: 13px;
    color: var(--text-light);
}

.footer a {
    color: var(--primary);
    text-decoration: none;
}

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

/* Utilities */
.hidden {
    display: none !important;
}

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

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    .header {
        padding: 30px 15px;
    }

    .logo {
        font-size: 24px;
    }

    .main-content {
        padding: 20px;
    }

    .mode-selector {
        flex-direction: column;
    }

    .nutrition-grid {
        grid-template-columns: 1fr;
    }
}
