/* ==========================================================================
   AGRO-FLEX: TRAKTORZYSTA CSS – GRA EDUKACYJNA DLA INF.03
   Autor i twórca metodyki: Paweł Paśko (PPASKO)
   Portal: egzamin.men | Kwalifikacja INF.03 CKE
   ========================================================================== */

:root {
    --bg-main: #0c1220;
    --bg-card: #141e33;
    --bg-editor: #080d19;
    --border-color: rgba(148, 163, 184, 0.2);
    --gold: #f59e0b;
    --emerald: #10b981;
    --wine: #9b2226;
    --sky: #38bdf8;
    --text-primary: #f8fafc;
    --text-muted: #94a3b8;
    --font-sans: 'Inter', -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

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

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

/* GÓRNY PASEK GRY */
.game-topbar {
    background: #101828;
    border-bottom: 1px solid var(--border-color);
    padding: 12px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.back-link {
    color: var(--gold);
    text-decoration: none;
    font-weight: 700;
    font-size: 0.88rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 6px;
    transition: all 0.2s;
}

.back-link:hover {
    background: var(--gold);
    color: #000;
}

.game-title-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.game-logo-badge {
    font-weight: 900;
    font-size: 1.15rem;
    color: #fff;
}

.game-logo-badge span {
    color: var(--gold);
}

.level-indicator {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 5px 12px;
    border-radius: 6px;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--emerald);
}

/* GŁÓWNY OBSZAR GRY */
.game-container {
    max-width: 1280px;
    margin: 20px auto;
    padding: 0 20px;
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 1.25fr;
    gap: 24px;
    width: 100%;
}

/* LEWY PANEL: EDYTOR I WSKAZÓWKI */
.editor-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.level-mission-box {
    margin-bottom: 18px;
}

.mission-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--gold);
    margin-bottom: 6px;
}

.mission-desc {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.cke-tip-box {
    background: rgba(16, 185, 129, 0.1);
    border-left: 3px solid var(--emerald);
    padding: 10px 14px;
    border-radius: 0 6px 6px 0;
    font-size: 0.82rem;
    margin: 14px 0 18px;
}

.cke-tip-box strong {
    color: var(--emerald);
}

/* EDYTOR CSS */
.code-editor-wrapper {
    background: var(--bg-editor);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 14px 18px;
    font-family: var(--font-mono);
    font-size: 0.88rem;
    margin-bottom: 14px;
}

.code-prefix {
    color: #94a3b8;
    margin-bottom: 6px;
}

.css-input-area {
    width: 100%;
    background: transparent;
    border: none;
    outline: none;
    color: var(--sky);
    font-family: var(--font-mono);
    font-size: 0.92rem;
    resize: none;
    height: 70px;
    line-height: 1.5;
}

.code-suffix {
    color: #94a3b8;
    margin-top: 6px;
}

/* PIGUŁKI AUTOCOMPLETE DLA SZYBKIEGO KLIKANIA */
.quick-pills-row {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-bottom: 18px;
}

.pill-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    width: 100%;
    margin-bottom: 2px;
}

.css-pill {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--sky);
    font-family: var(--font-mono);
    font-size: 0.74rem;
    padding: 4px 9px;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.15s;
}

.css-pill:hover {
    background: rgba(56, 189, 248, 0.2);
    border-color: var(--sky);
    color: #fff;
    transform: translateY(-1px);
}

/* PRZYCISKI AKCJI */
.game-controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-run-check {
    flex: 1;
    background: var(--gold);
    color: #000;
    font-weight: 800;
    font-size: 0.92rem;
    padding: 12px 18px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn-run-check:hover {
    background: #d97706;
    transform: translateY(-1px);
}

.btn-hint {
    background: var(--bg-editor);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    font-weight: 700;
    font-size: 0.85rem;
    padding: 12px 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-hint:hover {
    color: var(--text-primary);
    border-color: var(--gold);
}

.btn-next-level {
    display: none;
    background: var(--emerald);
    color: #ffffff;
    font-weight: 800;
    font-size: 0.92rem;
    padding: 12px 20px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-next-level:hover {
    background: #059669;
    transform: translateY(-1px);
}

/* PRAWY PANEL: POLE UPRAWNE / PODWÓRZE (SYMULACJA FLEXBOX) */
.farm-panel {
    background: #162438;
    border: 2px solid var(--border-color);
    border-radius: 14px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
    min-height: 480px;
}

.farm-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    font-size: 0.82rem;
    color: var(--text-muted);
}

/* RZECZYWISTY KONTENER FLEXBOX */
.farm-field-stage {
    flex: 1;
    background: 
        radial-gradient(circle at 50% 50%, rgba(245, 158, 11, 0.05), transparent 70%),
        repeating-linear-gradient(45deg, rgba(0,0,0,0.06), rgba(0,0,0,0.06) 10px, transparent 10px, transparent 20px),
        #111c2e;
    border: 2px dashed rgba(148, 163, 184, 0.25);
    border-radius: 12px;
    position: relative;
    padding: 16px;
    min-height: 380px;
    display: flex; /* Baza Flexbox */
}

/* WARSTWA DOCELOWYCH STANOWISK (CELE PARKINGOWE) */
.parking-targets-layer {
    position: absolute;
    top: 16px;
    left: 16px;
    right: 16px;
    bottom: 16px;
    display: flex;
    pointer-events: none;
    z-index: 1;
}

.parking-spot {
    width: 90px;
    height: 90px;
    border: 2px dashed rgba(245, 158, 11, 0.5);
    background: rgba(245, 158, 11, 0.06);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-family: var(--font-mono);
    color: var(--gold);
    font-weight: 700;
}

/* TRAKTORY GRACZA */
.tractors-layer {
    position: absolute;
    top: 16px;
    left: 16px;
    right: 16px;
    bottom: 16px;
    display: flex;
    z-index: 2;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.tractor-item {
    width: 90px;
    height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.4));
}

.tractor-svg {
    width: 76px;
    height: 76px;
}

/* EFEKT SUKCESU */
.win-banner {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(16, 185, 129, 0.95);
    color: #fff;
    padding: 18px 28px;
    border-radius: 12px;
    font-size: 1.15rem;
    font-weight: 800;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    z-index: 10;
    animation: popIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes popIn {
    0% { transform: translate(-50%, -50%) scale(0.6); opacity: 0; }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

/* STOPKA */
.game-footer {
    border-top: 1px solid var(--border-color);
    background: #090e1a;
    padding: 16px 24px;
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
}

@media (max-width: 920px) {
    .game-container { grid-template-columns: 1fr; }
    .farm-panel { min-height: 420px; }
}
