/* --- Perusasetukset ja pehmeä skrollaus --- */
html {
    scroll-behavior: smooth;
}

:root {
    --primary: #4a6741;
    --accent: #f4a261;
    --bg: #f9fbf9;
    --text: #2d3436;
    --white: #ffffff;
    --shadow: 0 10px 20px rgba(0,0,0,0.05);
    --tip-bg: #fff9e6; /* Keltainen sävy vinkkilaatikolle */
}

body {
    font-family: 'Poppins', sans-serif;
    margin: 0;
    background: var(--bg);
    color: var(--text);
    overflow-x: hidden;
}

/* --- Header --- */
header {
    background: var(--white);
    color: var(--primary);
    padding: 20px 5%;
    box-shadow: var(--shadow);
    border-bottom: 3px solid var(--accent);
    display: flex;
    align-items: center;
    justify-content: space-between; /* Levittää logon vasemmalle ja valikon oikealle */
    gap: 20px;
    flex-wrap: wrap;
}

footer {
	background: #f8f8f8;
	padding: 10px 10px;
	font-size: 0.8rem;
	color: #888;
	text-align: center;
	border-top: 1px solid #eee;
}

.header-logo { height: 100px; width: auto; display: block; }
header h1 { 
    font-family: 'Playfair Display', serif; 
    font-size: 2rem; 
    margin: 0; 
    font-weight: bold; 
    flex-grow: 1; /* Antaa otsikon viedä tilaa, jotta napit pysyvät oikealla */
}

/* --- Ehdota reseptiä -painike (UUSI) --- */
.ehdotus-linkki {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    padding: 8px 18px;
    border: 2px solid var(--primary);
    border-radius: 20px;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.ehdotus-linkki:hover {
    background-color: var(--primary);
    color: white;
}

/* --- Vinkit-pudotusvalikko --- */
.vinkit-dropdown { position: relative; display: inline-block; }
.vinkit-nappi {
    background-color: var(--accent);
    color: white;
    padding: 12px 25px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    transition: transform 0.2s;
}

.vinkit-nappi:hover { transform: translateY(-2px); box-shadow: 0 4px 8px rgba(0,0,0,0.1); }
.vinkit-sisalto {
    display: none;
    position: absolute;
    right: 0;
    background-color: white;
    min-width: 220px;
    box-shadow: 0px 8px 16px rgba(0,0,0,0.1);
    border-radius: 12px;
    z-index: 1001;
    overflow: hidden;
    border: 1px solid #eee;
}

.vinkit-sisalto div {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.9rem;
}

.vinkit-sisalto div:hover { background-color: #f9fbf9; color: var(--primary); }
.vinkit-dropdown:hover .vinkit-sisalto { display: block; }

/* --- Reseptisarakkeet --- */
.container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    padding: 20px 5%;
}

.column h2 {
    font-family: 'Playfair Display', serif;
    color: var(--primary);
    font-size: 1.4rem;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 5px;
}

/* --- Reseptikortit --- */
.card {
    background: var(--white);
    margin-bottom: 8px;
    padding: 10px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    border: 1px solid #f0f0f0;
    font-weight: 500;
}

.card.new-recipe {
    background-color: #e6f7ff;
    border: 1px solid #91d5ff;
}

/* jos haluat myös vinkkilistaan */
#vinkit-lista .new-recipe {
    background-color: #e6f7ff;
}

.card.new-recipe::after {
    content: "Uusi";
    display: inline-block;
    margin-left: 8px;
    font-size: 0.7rem;
    color: white;
    background: #52c41a;
    padding: 2px 6px;
    border-radius: 10px;
}

.card:hover { border-color: var(--accent); transform: translateY(-3px); box-shadow: 0 5px 15px rgba(0,0,0,0.1); }

/* --- Modal / Resepti-ikkuna --- */
#recipeModal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.4); /* Tummennettu paremman kontrastin vuoksi */
    backdrop-filter: blur(8px);
    display: none;
    justify-content: center;
    align-items: flex-start;
    z-index: 2000;
    overflow-y: auto;
    padding: 20px 0;
}

#modalContent {
    background: var(--white);
    border-radius: 20px;
    width: 95%;
    max-width: 800px;
    margin: auto;
    position: relative;
    overflow: hidden;
}

#closeBtn {
    position: absolute;
    top: 15px;
    right: 15px;
    cursor: pointer;
    font-size: 35px;
    background: rgba(255,255,255,0.8);
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    z-index: 100;
}

.recipeLayout { display: flex; }
.recipeText { flex: 1.5; padding: 30px; }
.recipeImageContainer { flex: 1; }
.recipeImage { width: 100%; height: 100%; object-fit: cover; min-height: 350px; }

/* Ulkoinen linkki modalin sisällä */
.recipe-external-link {
    display: inline-block;
    color: var(--primary);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid var(--primary);
    padding: 5px 12px;
    border-radius: 6px;
    transition: all 0.2s ease;
    margin-bottom: 10px;
}

.recipe-external-link:hover {
    background-color: var(--primary);
    color: white;
}

/* Vinkkilaatikko modalin sisällä */
.extra-tip-box {
    background-color: var(--tip-bg);
    border-left: 4px solid var(--accent);
    padding: 15px;
    margin-top: 20px;
    border-radius: 4px;
}

.servings-info {
    display: inline-block;
    background: #f0f2ee;
    color: var(--primary);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 15px;
}

/* --- Ehdotuslomake --- */
#palaute {
    scroll-margin-top: 40px; /* Jättää tilaa yläreunaan kun skrollataan lomakkeeseen */
}

.ehdotus-container {
    padding: 60px 5%;
    background: #f0f2ee;
    display: flex;
    justify-content: center;
    margin-top: 40px;
}

.ehdotus-kortti {
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: var(--shadow);
    max-width: 800px;
    width: 100%;
    text-align: center;
}

.ehdotus-kortti h2 {
    color: var(--primary);
    font-family: 'Playfair Display', serif;
    font-size: 2rem;
    margin-bottom: 5px;
}

.ehdotus-kortti p {
    color: #666;
    margin-bottom: 10px;
}

.input-ryhma {
    display: flex;
    gap: 5px;
    margin-bottom: 15px;
}

.ehdotus-kortti input, 
.ehdotus-kortti textarea {
    width: 100%;
    padding: 5px;
    border: 1px solid #ddd;
    border-radius: 10px;
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    box-sizing: border-box;
    background: #f9f9f9;
    transition: border-color 0.3s;
    margin-bottom: 5px;
}

.ehdotus-kortti input:focus, 
.ehdotus-kortti textarea:focus {
    outline: none;
    border-color: var(--accent);
    background: white;
}

.laheta-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 15px 40px;
    border-radius: 30px;
    cursor: pointer;
    font-weight: 600;
    font-size: 16px;
    transition: all 0.3s ease;
    margin-top: 10px;
}

.laheta-btn:hover {
    background: #3a5233;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

/* --- Mobiiliresponsiivisuus --- */
@media (max-width: 768px) {
    header { 
        flex-direction: column; 
        text-align: center; 
    }
    .ehdotus-linkki { margin: 10px 0; }
    .vinkit-dropdown { margin-left: 0; width: 100%; }
    .vinkit-nappi { width: 100%; }
    
    .recipeLayout { flex-direction: column-reverse; }
    .recipeImage { height: 250px; }
}

@media (max-width: 600px) {
    .input-ryhma {
        flex-direction: column;
        gap: 15px;
    }
}