/* ==========================================================================
   Generator „Danie dnia" — style interfejsu
   Paleta z templatki (te same kolory rysujemy później na canvas w danie-dnia.js)
   ========================================================================== */

:root {
    --bg:    #F5F1E9; /* Tło */
    --green: #3F4636; /* Ciemna zieleń */
    --gold:  #B08A4A; /* Złoto */
    --field: #FAF8F3; /* Jasne pole */
    --text:  #2D2D2D; /* Tekst */
    --gray:  #777777; /* Szare dodatki */

    --font-title: 'Montserrat', 'Poppins', sans-serif;
    --font-body:  'Montserrat', 'Inter', sans-serif;
}

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

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ===== Pasek górny ===== */
.topbar {
    background: var(--green);
    color: var(--field);
    padding: 14px 26px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.topbar .brand {
    font-family: var(--font-title);
    font-weight: 600;
    color: var(--gold);
    font-size: 1.15rem;
}

.topbar-actions { display: flex; gap: 10px; }

.nav-btn {
    border: 1px solid rgba(245, 241, 233, 0.35);
    color: var(--field);
    padding: 7px 14px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.9rem;
    transition: border-color 0.2s, color 0.2s, background 0.2s;
}
.nav-btn:hover { border-color: var(--gold); color: var(--gold); }

/* ===== Układ: edytor + podgląd ===== */
.layout {
    flex: 1;
    display: grid;
    grid-template-columns: minmax(360px, 1fr) auto;
    gap: 30px;
    padding: 30px;
    align-items: start;
}

.editor {
    background: var(--field);
    border: 1px solid #e6ded0;
    border-radius: 14px;
    padding: 26px;
}

.editor h1 {
    font-family: var(--font-title);
    font-weight: 600;
    font-size: 1.5rem;
    margin-bottom: 8px;
}

.editor .lead { color: var(--gray); font-size: 0.95rem; margin-bottom: 22px; }

/* ===== Dania (zdjęcie + opis) ===== */
.dishes { display: flex; flex-direction: column; gap: 18px; }

.dish {
    position: relative;
    display: grid;
    grid-template-columns: 130px 1fr;
    gap: 16px;
    padding: 16px;
    padding-top: 26px;
    border: 1px solid #e6ded0;
    border-radius: 12px;
    background: #fffdfa;
}

.dish-no {
    position: absolute;
    top: 8px;
    left: 16px;
    font-family: var(--font-title);
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--gold);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* ===== Dropzone / upload ===== */
.dropzone {
    position: relative;
    aspect-ratio: 4 / 3;
    border: 2px dashed #cdbfa8;
    border-radius: 10px;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    overflow: hidden;
    transition: border-color 0.2s, background 0.2s;
    text-align: center;
}
.dropzone:hover,
.dropzone:focus-visible { border-color: var(--gold); outline: none; }
.dropzone.dragover { border-color: var(--gold); background: #efe7d8; }

.dropzone-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    color: var(--gray);
    padding: 6px;
    pointer-events: none;
}
.dz-icon { font-size: 1.6rem; color: var(--gold); line-height: 1; }
.dz-text { font-size: 0.72rem; line-height: 1.3; }

.dropzone-filled { position: absolute; inset: 0; }
.thumb { width: 100%; height: 100%; object-fit: cover; display: block; }

.thumb-remove {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 26px;
    height: 26px;
    border: none;
    border-radius: 50%;
    background: rgba(45, 45, 45, 0.78);
    color: #fff;
    cursor: pointer;
    font-size: 0.8rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.thumb-remove:hover { background: #b03a3a; }

/* ===== Pola formularza ===== */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 0.82rem; color: var(--gray); }

.field textarea,
.field input[type="text"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d8ccb6;
    border-radius: 9px;
    background: var(--field);
    color: var(--text);
    font-family: inherit;
    font-size: 0.95rem;
    resize: vertical;
    transition: border-color 0.2s;
}
.field textarea:focus,
.field input[type="text"]:focus { outline: none; border-color: var(--gold); }

.dish .field { margin-top: 0; }
#form > .field { margin-top: 20px; }

/* ===== Przyciski akcji ===== */
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }

.btn {
    padding: 12px 22px;
    border: 1px solid var(--green);
    border-radius: 10px;
    background: var(--field);
    color: var(--green);
    font-family: var(--font-title);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border-color 0.2s, opacity 0.2s;
}
.btn:hover:not(:disabled) { background: #ece3d3; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-primary { background: var(--green); color: var(--field); border-color: var(--green); }
.btn-primary:hover:not(:disabled) { background: #333a2c; }

.btn-ghost { border-color: #cdbfa8; color: var(--gray); background: transparent; }

.hint { margin-top: 12px; font-size: 0.85rem; min-height: 1.2em; }
.hint.error { color: #b03a3a; }
.hint.ok { color: var(--green); }

/* ===== Podgląd canvas ===== */
.preview { display: flex; justify-content: center; position: sticky; top: 30px; }

#canvas {
    /* Podgląd skalowany — natywny rozmiar płótna to 1080×1920 */
    width: 300px;
    height: 533px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
    background: var(--field);
}

/* ===== Responsywność ===== */
@media (max-width: 900px) {
    .layout { grid-template-columns: 1fr; }
    .preview { order: -1; position: static; }
}

/* Telefony — układ pionowy: zdjęcie nad polem opisu, duże pola tekstu */
@media (max-width: 640px) {
    .layout { padding: 16px; gap: 18px; }
    .editor { padding: 18px; }

    /* Każde danie: zdjęcie u góry, opis pod spodem (pełna szerokość) */
    .dish {
        grid-template-columns: 1fr;
        gap: 14px;
        padding-top: 30px;
    }

    /* Zdjęcie pełnej szerokości, ale o umiarkowanej wysokości */
    .dropzone {
        aspect-ratio: auto;
        height: 180px;
    }

    /* Większe pole opisu */
    .dish .desc { min-height: 130px; }

    /* font-size ≥ 16px zapobiega automatycznemu przybliżeniu pola na iOS */
    .field textarea,
    .field input[type="text"] { font-size: 16px; }

    /* Podgląd dopasowany do szerokości ekranu */
    #canvas {
        width: 100%;
        max-width: 300px;
        height: auto;
        aspect-ratio: 1080 / 1920;
    }

    /* Przyciski na pełną szerokość, łatwiejsze do trafienia */
    .actions .btn { flex: 1 1 100%; }
}
