/**
 * Heltrett.no - Stylesheet
 * Versjon: 1.0.4
 */

/* Reset og base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --color-primary: #4a7c59;
    --color-primary-light: #6b9b7a;
    --color-primary-dark: #3d6349;
    --color-accent: #8fbc8f;
    --color-secondary: #e8b86d;
    --color-bg: #f5f9f5;
    --color-bg-warm: #fdfcf8;
    --color-white: #ffffff;
    --color-text: #2d3b2d;
    --color-text-light: #5a6b5a;
    --color-border: #d4e4d4;
    --color-error: #c0392b;
    --shadow: 0 4px 15px rgba(74, 124, 89, 0.1);
    --shadow-hover: 0 8px 25px rgba(74, 124, 89, 0.15);
    --radius: 12px;
    --radius-lg: 20px;
}

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', sans-serif;
    line-height: 1.7;
    color: var(--color-text);
    background: linear-gradient(135deg, var(--color-bg) 0%, var(--color-bg-warm) 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Header */
header {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    color: var(--color-white);
    padding: 40px 0;
    text-align: center;
    position: relative;
    overflow: hidden;
}

header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 300px;
    height: 300px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
}

header::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -5%;
    width: 200px;
    height: 200px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 50%;
}

header h1 {
    font-size: 2.8rem;
    margin-bottom: 8px;
    font-weight: 700;
    letter-spacing: -0.5px;
    position: relative;
    z-index: 1;
}

header h1 a {
    color: inherit;
    text-decoration: none;
}

.tagline {
    font-size: 1.15rem;
    opacity: 0.9;
    font-weight: 400;
    position: relative;
    z-index: 1;
}

/* Main */
main {
    flex: 1;
    padding: 50px 0;
}

/* Generator section */
.generator {
    background: var(--color-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 40px;
    margin-bottom: 40px;
    border: 1px solid var(--color-border);
}

.generator h2 {
    color: var(--color-primary);
    margin-bottom: 30px;
    font-size: 1.6rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 12px;
}

.generator h2::before {
    content: '';
    width: 4px;
    height: 28px;
    background: linear-gradient(180deg, var(--color-primary) 0%, var(--color-accent) 100%);
    border-radius: 2px;
}

/* Fieldsets */
fieldset {
    border: none;
    margin-bottom: 30px;
}

legend {
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 16px;
    font-size: 1.05rem;
}

/* Radio buttons */
.radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.radio-label {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    background: var(--color-bg);
    padding: 12px 20px;
    border-radius: 30px;
    border: 2px solid var(--color-border);
    transition: all 0.25s ease;
    font-weight: 500;
}

.radio-label:hover {
    border-color: var(--color-primary-light);
    background: var(--color-white);
    transform: translateY(-2px);
}

.radio-label input {
    display: none;
}

.radio-label input:checked + span {
    color: var(--color-white);
}

.radio-label:has(input:checked) {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    border-color: var(--color-primary);
    box-shadow: 0 4px 12px rgba(74, 124, 89, 0.3);
}

/* Kcal slider */
.kcal-slider {
    display: flex;
    align-items: center;
    gap: 24px;
    background: var(--color-bg);
    padding: 20px 24px;
    border-radius: var(--radius);
}

.kcal-slider input[type="range"] {
    flex: 1;
    height: 8px;
    -webkit-appearance: none;
    background: var(--color-border);
    border-radius: 4px;
    outline: none;
}

.kcal-slider input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 26px;
    height: 26px;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(74, 124, 89, 0.3);
    transition: transform 0.2s;
}

.kcal-slider input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.kcal-slider input[type="range"]::-moz-range-thumb {
    width: 26px;
    height: 26px;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 8px rgba(74, 124, 89, 0.3);
}

.kcal-slider output {
    font-weight: 700;
    color: var(--color-primary);
    min-width: 100px;
    text-align: right;
    font-size: 1.1rem;
}

/* Ingredients grid */
.ingredients-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 30px;
}

.ingredient-category {
    background: var(--color-bg);
    padding: 20px;
    border-radius: var(--radius);
}

.ingredient-category h3 {
    font-size: 1rem;
    color: var(--color-primary);
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 3px solid var(--color-accent);
    font-weight: 600;
}

/* Checkboxes */
.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 10px 0;
    transition: all 0.2s;
}

.checkbox-label input {
    width: 22px;
    height: 22px;
    margin-right: 12px;
    accent-color: var(--color-primary);
    cursor: pointer;
}

.checkbox-label span {
    transition: color 0.2s;
}

.checkbox-label:hover span {
    color: var(--color-primary);
}

/* Generate button */
.btn-generate {
    display: block;
    width: 100%;
    padding: 18px 30px;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--color-white);
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 15px;
    box-shadow: 0 4px 15px rgba(74, 124, 89, 0.3);
}

.btn-generate:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(74, 124, 89, 0.4);
}

.btn-loading {
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Daily tip section */
.daily-tip {
    background: var(--color-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 40px;
    border-left: 5px solid var(--color-accent);
    border: 1px solid var(--color-border);
    border-left: 5px solid var(--color-accent);
}

.daily-tip h2 {
    color: var(--color-primary);
    margin-bottom: 20px;
    font-size: 1.4rem;
    font-weight: 600;
}

.tip-content {
    white-space: pre-wrap;
    line-height: 1.9;
}

/* Recipe result page */
.recipe-result {
    background: var(--color-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 40px;
    border: 1px solid var(--color-border);
}

.recipe-result h2 {
    color: var(--color-primary);
    margin-bottom: 15px;
    font-size: 1.8rem;
}

.recipe-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 25px;
    padding-bottom: 25px;
    border-bottom: 2px solid var(--color-bg);
}

.recipe-meta span {
    background: var(--color-bg);
    padding: 8px 16px;
    border-radius: 25px;
    font-size: 0.9rem;
    color: var(--color-text-light);
    font-weight: 500;
}

.meta-category {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%) !important;
    color: var(--color-white) !important;
}

.recipe-content {
    white-space: pre-wrap;
    line-height: 1.9;
    margin-bottom: 30px;
}

.recipe-actions {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.btn-back, .btn-print {
    padding: 14px 28px;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.25s ease;
}

.btn-back {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    color: var(--color-white);
    border: none;
    box-shadow: 0 4px 12px rgba(74, 124, 89, 0.25);
}

.btn-back:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(74, 124, 89, 0.35);
}

.btn-print {
    background: var(--color-white);
    color: var(--color-primary);
    border: 2px solid var(--color-primary);
}

.btn-print:hover {
    background: var(--color-bg);
}

/* Error section */
.error-section {
    background: var(--color-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 50px;
    text-align: center;
    border: 1px solid var(--color-border);
    border-left: 5px solid var(--color-error);
}

.error-section h2 {
    color: var(--color-error);
    margin-bottom: 15px;
}

.error-message {
    color: var(--color-text-light);
    margin-bottom: 25px;
}

/* Footer */
footer {
    background: linear-gradient(135deg, var(--color-primary-dark) 0%, #2d4a35 100%);
    color: var(--color-white);
    padding: 30px 0;
    text-align: center;
    margin-top: auto;
}

footer p {
    opacity: 0.85;
    font-size: 0.95rem;
}

/* Breadcrumb */
.breadcrumb {
    margin-bottom: 25px;
    font-size: 0.9rem;
    color: var(--color-text-light);
}

.breadcrumb a {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 500;
}

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

/* Tips list */
.tips-list {
    background: var(--color-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 40px;
    border: 1px solid var(--color-border);
}

.tips-list h2 {
    color: var(--color-primary);
    margin-bottom: 30px;
    font-size: 1.6rem;
}

.tips-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
}

.tip-card {
    background: var(--color-bg);
    border-radius: var(--radius);
    padding: 25px;
    border: 1px solid var(--color-border);
    transition: all 0.3s ease;
}

.tip-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
    border-color: var(--color-accent);
}

.tip-card h3 {
    margin-bottom: 12px;
    font-size: 1.15rem;
}

.tip-card h3 a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color 0.2s;
}

.tip-card h3 a:hover {
    color: var(--color-primary-dark);
}

.tip-card .tip-intro {
    font-size: 0.95rem;
    color: var(--color-text-light);
    margin-bottom: 18px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.6;
}

.tip-card .tip-meta {
    margin-bottom: 18px;
}

.tip-card .tip-meta span {
    font-size: 0.85rem;
    margin-right: 12px;
    color: var(--color-text-light);
}

.btn-read-more {
    display: inline-block;
    padding: 10px 20px;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    color: var(--color-white);
    text-decoration: none;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.25s ease;
}

.btn-read-more:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(74, 124, 89, 0.3);
}

/* Tip detail styles */
.tip-title {
    color: var(--color-primary);
    margin-bottom: 12px;
    font-size: 1.5rem;
}

.tip-intro {
    color: var(--color-text-light);
    margin-bottom: 25px;
    font-style: italic;
    font-size: 1.05rem;
    line-height: 1.7;
}

.tip-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 30px;
}

.tip-meta span {
    background: var(--color-bg);
    padding: 8px 16px;
    border-radius: 25px;
    font-size: 0.9rem;
    color: var(--color-text-light);
    font-weight: 500;
}

.tip-ingredients {
    background: linear-gradient(135deg, var(--color-bg) 0%, #e8f0e8 100%);
    padding: 25px;
    border-radius: var(--radius);
    margin-bottom: 25px;
    line-height: 1.9;
    border-left: 4px solid var(--color-accent);
}

.tip-recipe {
    line-height: 1.9;
    margin-bottom: 30px;
}

.tip-actions {
    margin-top: 30px;
    padding-top: 25px;
    border-top: 2px solid var(--color-bg);
}

.btn-all-tips {
    display: inline-block;
    padding: 14px 28px;
    background: linear-gradient(135deg, var(--color-secondary) 0%, #d4a55a 100%);
    color: var(--color-white);
    text-decoration: none;
    border-radius: var(--radius);
    font-weight: 600;
    transition: all 0.25s ease;
    box-shadow: 0 4px 12px rgba(232, 184, 109, 0.3);
}

.btn-all-tips:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(232, 184, 109, 0.4);
}

/* Tip/Recipe images */
.tip-image {
    margin-bottom: 25px;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.tip-image img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
}

.tip-card-image {
    display: block;
    margin: -25px -25px 20px -25px;
    border-radius: var(--radius) var(--radius) 0 0;
    overflow: hidden;
}

.tip-card-image img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.tip-card:hover .tip-card-image img {
    transform: scale(1.05);
}

/* Print styles */
@media print {
    header, footer, .recipe-actions, .recipe-meta, .tip-actions {
        display: none;
    }

    .recipe-result, .daily-tip {
        box-shadow: none;
        padding: 0;
        border: none;
    }
}

/* Responsive */
@media (max-width: 600px) {
    header {
        padding: 30px 0;
    }

    header h1 {
        font-size: 2.2rem;
    }

    .generator, .daily-tip, .recipe-result, .tips-list {
        padding: 25px;
        border-radius: var(--radius);
    }

    .radio-group {
        flex-direction: column;
    }

    .radio-label {
        justify-content: center;
    }

    .kcal-slider {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }

    .kcal-slider output {
        text-align: center;
    }

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

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