/* ============================================
   CSS Reset and Base Styles
   ============================================ */

:root {
    --primary-color: #14b8a6;
    --primary-dark: #0d9488;
    --primary-light: #5eead4;
    --secondary-color: #22d3ee;
    --success-color: #10b981;
    --danger-color: #f87171;
    --warning-color: #fbbf24;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-dark: #1e293b;
    --bg-primary: #1e293b;
    --bg-secondary: #0f172a;
    --bg-tertiary: #334155;
    --bg-card: #1e293b;
    --border-color: #334155;
    --glow-color: rgba(20, 184, 166, 0.3);
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px var(--glow-color);
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background: linear-gradient(135deg, var(--bg-secondary) 0%, #0a0f1e 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ============================================
   Typography
   ============================================ */

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 0.5em;
}

h1 {
    font-size: 2rem;
}

h2 {
    font-size: 1.5rem;
    color: var(--primary-light);
}

h3 {
    font-size: 1.25rem;
}

p {
    margin-bottom: 1em;
}

/* ============================================
   Header
   ============================================ */

header {
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    border-bottom: 2px solid var(--primary-color);
    color: var(--text-primary);
    padding: 2rem 0;
    box-shadow: var(--shadow-md);
    position: relative;
}

/* Logo Header Layout */
.logo-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    justify-content: center;
}

.dragon-logo {
    width: 80px;
    height: 80px;
    filter: drop-shadow(0 0 15px var(--glow-color));
    animation: dragonFloat 3s ease-in-out infinite;
}

.dragon-logo .dragon-eye {
    animation: dragonBlink 4s ease-in-out infinite;
}

.dragon-logo .dragon-flame {
    animation: flamePulse 1.5s ease-in-out infinite;
}

.dragon-logo .dragon-wing-left {
    animation: wingFlap 2s ease-in-out infinite;
    transform-origin: 30px 50px;
}

.dragon-logo .dragon-wing-right {
    animation: wingFlap 2s ease-in-out infinite 0.5s;
    transform-origin: 70px 50px;
}

@keyframes dragonFloat {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-8px);
    }
}

@keyframes dragonBlink {
    0%, 90%, 100% {
        opacity: 1;
    }
    95% {
        opacity: 0;
    }
}

@keyframes flamePulse {
    0%, 100% {
        opacity: 0.5;
        transform: scale(1);
    }
    50% {
        opacity: 0.9;
        transform: scale(1.1);
    }
}

@keyframes wingFlap {
    0%, 100% {
        transform: scaleX(1);
    }
    50% {
        transform: scaleX(1.15);
    }
}

.app-title {
    text-align: left;
}

.app-title h1 {
    margin-bottom: 0.25rem;
    font-size: 2.5rem;
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--secondary-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: none;
}

.tagline {
    font-size: 0.95rem;
    opacity: 0.85;
    margin: 0;
    color: var(--text-secondary);
}

/* ============================================
   Container
   ============================================ */

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

main {
    flex: 1;
    padding: 2rem 0;
}

/* ============================================
   Tabs Navigation
   ============================================ */

.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 2rem;
    background: var(--bg-card);
    padding: 0.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    overflow-x: auto;
}

.tab-btn {
    flex: 1;
    min-width: 80px;
    padding: 0.75rem 1rem;
    background: transparent;
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.tab-multiline {
    white-space: normal;
    line-height: 1.2;
    display: inline-block;
    text-align: center;
}

.tab-btn:hover {
    background: var(--bg-tertiary);
    color: var(--primary-light);
    border-color: var(--primary-color);
}

.tab-btn.active {
    background: var(--primary-color);
    color: var(--bg-secondary);
    border-color: var(--primary-color);
    box-shadow: var(--shadow-glow);
}

.tab-btn:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* ============================================
   Tab Content
   ============================================ */

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

/* ============================================
   Stats Grid (Dashboard)
   ============================================ */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    text-align: center;
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow), var(--shadow-lg);
    border-color: var(--primary-color);
}

.stat-card h3 {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-light);
    margin: 0;
    line-height: 1;
    text-shadow: 0 0 10px var(--glow-color);
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 0;
}

/* ============================================
   Chart Container
   ============================================ */

.chart-container {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    margin-bottom: 2rem;
}

.chart-container h2 {
    margin-bottom: 1.5rem;
    font-size: 1.25rem;
}

.chart-container canvas {
    max-height: 400px;
}

/* ============================================
   Forms
   ============================================ */

.form-container {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    margin-bottom: 2rem;
}

.form-container h2 {
    margin-bottom: 1.5rem;
    color: var(--primary-light);
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--primary-light);
    font-size: 0.95rem;
}

label span[aria-label="erforderlich"] {
    color: var(--danger-color);
}

input[type="text"],
input[type="number"],
input[type="date"],
input[type="time"],
select,
textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.3s ease;
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--glow-color), var(--shadow-glow);
    background-color: var(--bg-card);
}

input:invalid:not(:placeholder-shown) {
    border-color: var(--danger-color);
}

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

/* ============================================
   Buttons
   ============================================ */

.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    text-decoration: none;
}

.btn:focus {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

.btn-primary {
    background: var(--primary-color);
    color: var(--bg-secondary);
    border: 2px solid var(--primary-color);
    font-weight: 600;
}

.btn-primary:hover {
    background: var(--primary-light);
    border-color: var(--primary-light);
    transform: translateY(-1px);
    box-shadow: var(--shadow-glow), var(--shadow-md);
}

.btn-secondary {
    background: transparent;
    color: var(--primary-light);
    border: 2px solid var(--primary-color);
}

.btn-secondary:hover {
    background: var(--primary-color);
    color: var(--bg-secondary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-glow), var(--shadow-md);
}

.btn-danger {
    background: transparent;
    color: var(--danger-color);
    border: 2px solid var(--danger-color);
}

.btn-danger:hover {
    background: var(--danger-color);
    color: var(--bg-secondary);
    transform: translateY(-1px);
    box-shadow: 0 0 20px rgba(248, 113, 113, 0.3), var(--shadow-md);
}

/* ============================================
   Barcode Scanner
   ============================================ */

.scanner-section {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 2px solid var(--border-color);
}

.btn-scanner {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: var(--bg-secondary);
    border: 2px solid var(--primary-light);
    font-weight: 600;
    font-size: 1.1rem;
    padding: 1rem 2rem;
    width: 100%;
    max-width: 300px;
    display: block;
    margin: 0 auto;
}

.btn-scanner:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow), var(--shadow-lg);
}

.scanner-container {
    margin-top: 1.5rem;
    padding: 1.5rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 2px solid var(--primary-color);
}

#barcode-reader {
    width: 100%;
    max-width: 500px;
    margin: 0 auto 1rem;
    border-radius: var(--radius-md);
    overflow: hidden;
}

#barcode-reader video {
    width: 100%;
    border-radius: var(--radius-md);
}

#close-scanner-btn {
    display: block;
    margin: 0 auto;
}

.scanner-status {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: var(--radius-md);
    text-align: center;
    font-weight: 500;
}

.scanner-status.success {
    background: rgba(16, 185, 129, 0.2);
    border: 2px solid var(--success-color);
    color: var(--success-color);
}

.scanner-status.error {
    background: rgba(248, 113, 113, 0.2);
    border: 2px solid var(--danger-color);
    color: var(--danger-color);
}

.scanner-status.loading {
    background: rgba(34, 211, 238, 0.2);
    border: 2px solid var(--secondary-color);
    color: var(--secondary-color);
}

.form-hint {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-style: italic;
}

.product-info {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--bg-tertiary);
    border-left: 4px solid var(--primary-color);
    border-radius: var(--radius-md);
}

.product-info h4 {
    color: var(--primary-light);
    margin-bottom: 0.5rem;
}

.product-info p {
    margin: 0.25rem 0;
    color: var(--text-secondary);
}

.nutrition-reference {
    margin: 1.5rem 0 1rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border-left: 4px solid var(--secondary-color);
    border-radius: var(--radius-md);
}

.nutrition-reference strong {
    color: var(--secondary-color);
    display: block;
    margin-bottom: 0.25rem;
}

.calculated-nutrition {
    margin: 1.5rem 0;
    padding: 1.5rem;
    background: linear-gradient(135deg, rgba(20, 184, 166, 0.1) 0%, rgba(34, 211, 238, 0.1) 100%);
    border: 2px solid var(--primary-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-glow);
}

.calculated-nutrition h4 {
    color: var(--primary-light);
    margin-bottom: 1rem;
    text-align: center;
}

.calculated-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.calc-item {
    text-align: center;
    padding: 1rem;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.calc-label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.calc-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-light);
    text-shadow: 0 0 10px var(--glow-color);
}

/* ============================================
   Recipes
   ============================================ */

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

.recipe-tabs {
    display: flex;
    gap: 0.5rem;
    margin: 2rem 0 1.5rem;
    background: var(--bg-card);
    padding: 0.5rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

.recipe-tab-btn {
    flex: 1;
    padding: 0.75rem 1.5rem;
    background: transparent;
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.recipe-tab-btn:hover {
    background: var(--bg-tertiary);
    color: var(--primary-light);
    border-color: var(--primary-color);
}

.recipe-tab-btn.active {
    background: var(--primary-color);
    color: var(--bg-secondary);
    border-color: var(--primary-color);
    box-shadow: var(--shadow-glow);
}

.recipe-tab-content {
    display: none;
}

.recipe-tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

.ingredients-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.ingredient-item {
    display: grid;
    grid-template-columns: 2fr 1fr 100px 40px;
    gap: 0.5rem;
    align-items: center;
}

.ingredient-name {
    grid-column: 1;
}

.ingredient-amount {
    grid-column: 2;
}

.ingredient-unit {
    grid-column: 3;
}

.btn-icon {
    grid-column: 4;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.btn-icon:hover {
    background: var(--danger-color);
    transform: scale(1.1);
}

.recipe-preview {
    margin-top: 2rem;
    padding: 2rem;
    background: var(--bg-secondary);
    border: 2px solid var(--primary-color);
    border-radius: var(--radius-lg);
}

.recipe-preview h4 {
    color: var(--primary-light);
    margin-bottom: 1rem;
}

.recipe-preview .recipe-meta {
    display: flex;
    gap: 2rem;
    margin: 1rem 0;
    flex-wrap: wrap;
}

.recipe-preview .recipe-meta-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
}

.recipe-preview .recipe-meta-item strong {
    color: var(--text-primary);
}

.recipe-ingredients {
    margin: 1.5rem 0;
}

.recipe-ingredients h5 {
    color: var(--primary-light);
    margin-bottom: 0.75rem;
}

.recipe-ingredients ul {
    list-style: none;
    padding: 0;
}

.recipe-ingredients li {
    padding: 0.5rem;
    margin-bottom: 0.25rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--secondary-color);
}

.recipe-instructions {
    margin: 1.5rem 0;
}

.recipe-instructions h5 {
    color: var(--primary-light);
    margin-bottom: 0.75rem;
}

.recipe-instructions p {
    color: var(--text-secondary);
    white-space: pre-wrap;
    line-height: 1.6;
}

.recipe-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.recipes-list {
    margin-top: 3rem;
}

.recipes-list h3 {
    color: var(--primary-light);
    margin-bottom: 1.5rem;
}

.recipe-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    transition: all 0.3s ease;
}

.recipe-card:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-glow), var(--shadow-md);
}

.recipe-card-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 1rem;
}

.recipe-card-title {
    color: var(--primary-light);
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.recipe-card-category {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: var(--secondary-color);
    color: var(--bg-secondary);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.recipe-card-meta {
    display: flex;
    gap: 1.5rem;
    margin: 1rem 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.recipe-card-ingredients {
    margin: 1rem 0;
}

.recipe-card-ingredients summary {
    cursor: pointer;
    color: var(--primary-light);
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.recipe-card-ingredients ul {
    list-style: none;
    padding: 0;
    margin-top: 0.5rem;
}

.recipe-card-ingredients li {
    padding: 0.25rem 0;
    color: var(--text-secondary);
}

.recipe-card-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

#open-chefkoch-btn {
    white-space: nowrap;
    min-width: 100px;
}

.chefkoch-link-box {
    margin: 1.5rem 0;
    padding: 1.5rem;
    background: linear-gradient(135deg, rgba(20, 184, 166, 0.15) 0%, rgba(34, 211, 238, 0.15) 100%);
    border: 2px solid var(--primary-color);
    border-radius: var(--radius-lg);
    text-align: center;
}

.chefkoch-link-box p {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.chefkoch-direct-link {
    display: inline-block;
    padding: 0.875rem 2rem;
    background: var(--primary-color);
    color: var(--bg-secondary);
    text-decoration: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 1.05rem;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-glow);
}

.chefkoch-direct-link:hover {
    background: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow), 0 8px 20px rgba(20, 184, 166, 0.4);
}

.chefkoch-direct-link:active {
    transform: translateY(0);
}

/* ============================================
   Nutrition Table
   ============================================ */

.nutrition-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin: 2rem 0;
    padding: 1.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.nutrition-stat {
    text-align: center;
}

.nutrition-stat-label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.nutrition-stat-value {
    display: block;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary-light);
    text-shadow: 0 0 10px var(--glow-color);
}

.table-container {
    overflow-x: auto;
    margin-top: 2rem;
}

.nutrition-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.nutrition-table thead {
    background: var(--primary-color);
    color: var(--bg-secondary);
}

.nutrition-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.nutrition-table td {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.nutrition-table tbody tr {
    transition: background 0.2s ease;
}

.nutrition-table tbody tr:hover {
    background: var(--bg-card);
}

.nutrition-table tbody tr:last-child td {
    border-bottom: none;
}

.nutrition-table .numeric {
    text-align: right;
    font-weight: 500;
}

.nutrition-table .meal-type-cell {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    background: var(--primary-color);
    color: var(--bg-secondary);
    border-radius: var(--radius-sm);
    display: inline-block;
}

/* ============================================
   Calculators
   ============================================ */

.calculator-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
}

.calculator-card {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

.calculator-card h2 {
    color: var(--primary-light);
    margin-bottom: 0.5rem;
}

.calculator-description {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
}

.calculator-form {
    margin-bottom: 1.5rem;
}

.calculator-result {
    padding: 1.5rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border-left: 4px solid var(--primary-color);
    display: none;
}

.calculator-result.show {
    display: block;
    animation: fadeIn 0.3s ease;
}

.calculator-result h3 {
    color: var(--primary-light);
    margin-bottom: 1rem;
    font-size: 1.25rem;
}

.calculator-result .result-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-light);
    text-shadow: 0 0 10px var(--glow-color);
    margin: 1rem 0;
    text-align: center;
}

.calculator-result .result-category {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    margin: 0.5rem 0;
}

.result-category.underweight {
    background: rgba(34, 211, 238, 0.2);
    color: var(--secondary-color);
    border: 2px solid var(--secondary-color);
}

.result-category.normal {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success-color);
    border: 2px solid var(--success-color);
}

.result-category.overweight {
    background: rgba(251, 191, 36, 0.2);
    color: var(--warning-color);
    border: 2px solid var(--warning-color);
}

.result-category.obese {
    background: rgba(248, 113, 113, 0.2);
    color: var(--danger-color);
    border: 2px solid var(--danger-color);
}

.calculator-result .result-details {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.calculator-result .result-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    color: var(--text-secondary);
}

.calculator-result .result-item strong {
    color: var(--text-primary);
}

.result-recommendation {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* ============================================
   Daily Summary
   ============================================ */

.daily-summary {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 2px solid var(--border-color);
}

.daily-summary h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.daily-totals {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.total-item {
    text-align: center;
}

.meal-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.meal-item {
    padding: 1rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    border-left: 4px solid var(--primary-color);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    transition: all 0.3s ease;
}

.meal-item:hover {
    background: var(--bg-card);
    box-shadow: var(--shadow-glow);
}

.meal-type-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: var(--primary-color);
    color: var(--bg-secondary);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 0 10px var(--glow-color);
}

.meal-time {
    margin-left: auto;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* ============================================
   History Section
   ============================================ */

.history-controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.history-section {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    margin-bottom: 2rem;
}

.history-section h2 {
    color: var(--primary-light);
    margin-bottom: 1.5rem;
}

.filter-controls {
    margin-bottom: 1.5rem;
}

.filter-controls select {
    max-width: 300px;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.history-item {
    display: grid;
    grid-template-columns: 150px 1fr auto;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    border-left: 4px solid var(--primary-color);
    align-items: center;
    transition: all 0.3s ease;
}

.history-item:hover {
    background: var(--bg-card);
    box-shadow: var(--shadow-glow);
}

.history-date {
    font-weight: 600;
    color: var(--primary-light);
}

.history-details {
    color: var(--text-secondary);
}

.history-details strong {
    color: var(--text-primary);
}

.delete-btn {
    background: transparent;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.delete-btn:hover {
    background: var(--danger-color);
    transform: scale(1.1);
}

.delete-btn:focus {
    outline: 2px solid var(--danger-color);
    outline-offset: 2px;
}

/* ============================================
   Empty State
   ============================================ */

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
    font-style: italic;
}

/* ============================================
   Notifications
   ============================================ */

.notification {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--success-color);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1000;
    max-width: 300px;
}

.notification.show {
    transform: translateY(0);
    opacity: 1;
}

/* ============================================
   Footer
   ============================================ */

footer {
    background: var(--bg-card);
    border-top: 2px solid var(--primary-color);
    padding: 1.5rem 0;
    margin-top: auto;
}

footer p {
    margin: 0;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* ============================================
   Responsive Design
   ============================================ */

@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }

    .logo-header {
        gap: 1rem;
    }

    .dragon-logo {
        width: 60px;
        height: 60px;
    }

    .app-title h1 {
        font-size: 1.75rem;
    }

    h2 {
        font-size: 1.25rem;
    }

    .tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .tab-btn {
        min-width: 70px;
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
    }
    
    .tab-multiline {
        font-size: 0.8rem;
        line-height: 1.1;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .stat-value {
        font-size: 2rem;
    }

    .form-container {
        padding: 1.5rem;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .history-item {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .history-controls {
        flex-direction: column;
    }

    .history-controls .btn {
        width: 100%;
    }

    .notification {
        right: 1rem;
        left: 1rem;
        max-width: none;
    }

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

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

    .nutrition-table {
        font-size: 0.85rem;
    }

    .nutrition-table th,
    .nutrition-table td {
        padding: 0.5rem;
    }

    .ingredient-item {
        grid-template-columns: 1fr 80px 80px 40px;
        font-size: 0.9rem;
    }

    .recipe-card-meta {
        flex-direction: column;
        gap: 0.5rem;
    }

    #open-chefkoch-btn {
        min-width: 80px;
        padding: 0.5rem;
        font-size: 0.85rem;
    }

    .chefkoch-direct-link {
        padding: 0.75rem 1.5rem;
        font-size: 0.95rem;
    }
}

@media (max-width: 480px) {
    header {
        padding: 1.5rem 0;
    }

    .logo-header {
        flex-direction: column;
        gap: 0.75rem;
    }

    .dragon-logo {
        width: 50px;
        height: 50px;
    }

    .app-title {
        text-align: center;
    }

    .app-title h1 {
        font-size: 1.5rem;
    }

    main {
        padding: 1rem 0;
    }

    .stat-card {
        padding: 1rem;
    }

    .chart-container {
        padding: 1rem;
    }

    .form-container {
        padding: 1rem;
    }

    .daily-totals {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   Activity & Drinks Section
   ============================================ */

.config-section {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
}

.config-section h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.form-section {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
}

.form-section h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

.summary-card {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

.summary-card h4 {
    color: var(--primary-light);
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.summary-total {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-light);
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.item-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.summary-item:hover {
    background: var(--bg-tertiary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.summary-item span {
    flex: 1;
}

.item-time {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-left: 0.5rem;
}

.delete-btn-small {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    padding: 0.25rem 0.5rem;
    transition: all 0.2s ease;
    opacity: 0.7;
}

.delete-btn-small:hover {
    opacity: 1;
    transform: scale(1.2);
}

.form-hint {
    display: block;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

#steps-km-display {
    color: var(--primary-light);
    font-weight: 600;
}

/* Update stats-grid to support 6 cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* ============================================
   Print Styles
   ============================================ */

@media print {
    header,
    footer,
    .tabs,
    .delete-btn,
    .history-controls,
    .notification {
        display: none;
    }

    .tab-content {
        display: block !important;
    }

    body {
        background: white;
    }

    .stat-card,
    .chart-container,
    .form-container,
    .history-section {
        box-shadow: none;
        border: 1px solid var(--border-color);
        page-break-inside: avoid;
    }
}

/* ============================================
   Accessibility
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Focus visible for keyboard navigation */
:focus-visible {
    outline: 2px solid var(--primary-light);
    outline-offset: 2px;
    box-shadow: var(--shadow-glow);
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --border-color: #000000;
        --text-secondary: #000000;
    }
}
