:root {
    --bg: #0e0e10;
    --surface: #18181c;
    --surface-hover: #222228;
    --border: #2a2a30;
    --border-light: #3a3a42;
    --text: #e8e8ec;
    --text-muted: #8888a0;
    --text-dim: #55556a;
    --accent: #ff2d55;
    --accent-hover: #ff4d6f;
    --mono: 'JetBrains Mono', monospace;
    --sans: 'DM Sans', sans-serif;
    --radius: 12px;
    --radius-sm: 8px;

    /* Kolory per sekcja */
    --accent-ooh:     #ff2d55;
    --accent-ooh-h:   #ff4d6f;
    --accent-dig:     #2189FF;
    --accent-dig-h:   #45a0ff;
    --accent-prt:     #7B68EE;
    --accent-prt-h:   #9480f5;
}

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

html, body {
    min-height: 100vh;
    font-family: var(--sans);
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

.app {
    max-width: 520px;
    margin: 0 auto;
    padding: 40px 20px 30px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ── Header ── */
.app-header {
    margin-bottom: 32px;
    position: relative;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.header-text {
    flex-shrink: 0;
}

.header-plane {
    flex: 1;
    max-width: 200px;
    height: auto;
    object-fit: contain;
    /* Subtelny drop-shadow żeby samolot się "unosił" nad tłem */
    filter: drop-shadow(0 4px 20px rgba(0,0,0,0.4));
    /* Delikatne kołysanie */
    animation: planeFloat 4s ease-in-out infinite;
}

@keyframes planeFloat {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50%      { transform: translateY(-6px) rotate(-1deg); }
}

@media (max-width: 480px) {
    .header-plane {
        max-width: 150px;
    }
}

.version-tag {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--text-dim);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 12px;
}

.app-header h1 {
    font-size: 42px;
    font-weight: 600;
    line-height: 1.05;
    letter-spacing: -0.03em;
    color: var(--text);
}

.subtitle {
    margin-top: 10px;
    font-size: 14px;
    font-weight: 300;
    color: var(--text-muted);
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

/* ── Calculator Card ── */
.calculator-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
}

.results-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
    animation: slideUp 0.3s ease;
}

/* ── Type Selector ── */
.type-selector {
    display: flex;
    gap: 4px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    padding: 4px;
    margin-bottom: 24px;
}

.type-btn {
    flex: 1;
    padding: 10px 16px;
    background: transparent;
    border: none;
    border-radius: 6px;
    font-family: var(--sans);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
}

.type-btn:hover {
    color: var(--text);
}

.type-btn.active {
    background: var(--surface-hover);
    color: var(--text);
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

/* Aktywna zakładka — kolor per sekcja */
.type-btn[data-type="OOH"].active     { color: var(--accent-ooh); }
.type-btn[data-type="DIGITAL"].active { color: var(--accent-dig); }
.type-btn[data-type="PRINT"].active   { color: var(--accent-prt); }

/* Przycisk Oblicz — kolor per panel */
#ooh-calculator     .calc-btn { background: var(--accent-ooh); }
#ooh-calculator     .calc-btn:hover { background: var(--accent-ooh-h); }
#digital-calculator .calc-btn { background: var(--accent-dig); }
#digital-calculator .calc-btn:hover { background: var(--accent-dig-h); }
#print-calculator   .calc-btn { background: var(--accent-prt); }
#print-calculator   .calc-btn:hover { background: var(--accent-prt-h); }

/* Input focus — kolor per panel (nadpisuje --accent globalny) */
#ooh-calculator     input:focus,
#ooh-calculator     select:focus { border-color: var(--accent-ooh); }
#digital-calculator input:focus,
#digital-calculator select:focus { border-color: var(--accent-dig); }
#print-calculator   input:focus,
#print-calculator   select:focus { border-color: var(--accent-prt); }

/* ── Panels ── */
.calc-panel {
    display: none;
    animation: fadeIn 0.2s ease;
}

.calc-panel.active {
    display: block;
}

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

/* ── Inputs ── */
.input-row {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.input-group {
    flex: 1;
    margin-bottom: 12px;
}

.input-group.full-width {
    width: 100%;
}

label {
    display: block;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 6px;
}

.input-with-unit {
    position: relative;
}

.input-with-unit input {
    width: 100%;
    padding: 12px 40px 12px 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: var(--mono);
    font-size: 15px;
    transition: border-color 0.2s;
}

.input-with-unit input:focus {
    outline: none;
    border-color: var(--accent);
}

.input-with-unit input::placeholder {
    color: var(--text-dim);
}

.unit {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-family: var(--mono);
    font-size: 11px;
    color: var(--text-dim);
    pointer-events: none;
}

select {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: var(--sans);
    font-size: 14px;
    cursor: pointer;
    transition: border-color 0.2s;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%238888a0' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
}

select:focus {
    outline: none;
    border-color: var(--accent);
}

select optgroup {
    font-weight: 600;
    color: var(--text-muted);
    background: var(--surface);
}

select option {
    background: var(--surface);
    color: var(--text);
    padding: 8px;
}

/* ── Calculate Button ── */
.calc-btn {
    width: 100%;
    padding: 14px;
    background: var(--accent);
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--sans);
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    margin-top: 4px;
}

.calc-btn:hover {
    background: var(--accent-hover);
}

.calc-btn:active {
    transform: scale(0.98);
}

/* ── Results Panel ── */
@keyframes slideUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.result-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 20px;
}

.stat {
    flex: 1;
    min-width: 100px;
    padding: 12px 14px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.stat-label {
    display: block;
    font-size: 10px;
    font-weight: 500;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 4px;
}

.stat-value {
    display: block;
    font-family: var(--mono);
    font-size: 15px;
    font-weight: 500;
    color: var(--text);
}

/* ── Grid Preview ── */
.grid-preview {
    background: #fff;
    border-radius: var(--radius-sm);
    padding: 4px;
    margin-bottom: 16px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.grid-preview img {
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: 4px;
}

.grid-preview svg {
    max-width: 100%;
    height: auto;
    display: block;
}

#svgContainer:empty {
    display: none;
}

/* ── Download ── */
.download-actions {
    text-align: center;
}

.download-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    background: transparent;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    font-family: var(--sans);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    transition: all 0.2s;
}

.download-btn:hover {
    border-color: var(--text-muted);
    color: var(--text);
}

/* ── Footer ── */
.app-footer {
    margin-top: auto;
    padding-top: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-dim);
}

.footer-sep {
    opacity: 0.3;
}

.cheil-logo {
    height: 12px;
    width: auto;
    color: var(--text-dim);
    transition: color 0.2s;
    position: relative;
    top: 0.5px;
}

.cheil-logo:hover {
    color: var(--text-muted);
}

/* ── Remove number input spinners ── */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input[type="number"] { -moz-appearance: textfield; }

/* ── Responsive ── */
@media (max-width: 480px) {
    .app { padding: 24px 16px 20px; }
    .app-header h1 { font-size: 32px; }
    .input-row { flex-direction: column; gap: 0; }
    .result-stats { flex-direction: column; gap: 8px; }
}
