/* --- GŁÓWNY KONTENER (PRZEZROCZYSTY) --- */
.forge-container {
    background: transparent; /* Usunięto grafikę tła, aby widzieć tło index */
    padding: 10px;
    margin-top: 10px;
    box-sizing: border-box;
    min-height: 400px; 
    width: 100%;
    animation: fadeIn 0.4s ease-out; /* Dodaje płynne przenikanie podczas wczytywania AJAX */
    will-change: opacity, transform; /* Wskazówka dla silnika Chromium, by zoptymalizował animację */
}

.forge-overlay {
    background: rgba(0, 0, 0, 0.4); /* Delikatne przyciemnienie dla czytelności */
    padding: 25px;
    border-radius: 16px;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    border: 1px solid rgba(168, 85, 247, 0.2);
    margin: 0 auto;
    max-width: 500px;
    width: 100%; /* Gwarantuje zajęcie pełnej szerokości natychmiast bez skakania boxów */
    box-sizing: border-box;
}

/* --- NAGŁÓWEK Z GIFEM --- */
.forge-header-area {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 25px;
}

.forge-header-area h2 {
    margin: 0;
    color: #39ff14;
    text-transform: uppercase;
    font-size: 1.8em;
    text-shadow: 0 0 8px rgba(57, 255, 20, 0.4), 2px 2px 4px #000;
}

.forge-gif-icon {
    width: 32px;
    height: 32px; /* Zablokowanie wysokości zapobiega skakaniu nagłówka przed załadowaniem obrazka */
    image-rendering: pixelated;
}
/* --- FORMULARZ I UKŁAD --- */
.forge-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Połączone wiersze dla zachowania responsywności i wyrównania */
.form-row-quad, .form-row-options, .form-row-triple, .form-row-bottom {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); 
    gap: clamp(8px, 1.2vw, 15px);
    align-items: flex-end; /* Spód pól w jednej linii */
    width: 100%;
}

/* Specyficzne nadpisania dla szerszych ekranów (jeśli auto-fit to za mało) */
@media (min-width: 900px) {
    .form-row-triple { grid-template-columns: 1fr 1.2fr 1.2fr; }
    .form-row-bottom { grid-template-columns: 1fr 1fr; }
}

/* --- ELEMENTY FORMULARZA --- */
.input-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.input-group label {
    color: #cbd5e1;
    font-weight: bold;
    font-size: 11px;
    text-transform: uppercase;
    margin-bottom: 4px;
    display: block;
}
.tier-wrapper {
    display: flex;       /* To ustawia elementy obok siebie */
    gap: 15px;           /* Odstęp między "Twój Tier" a "Tier Docelowy" */
    width: 100%;         /* Kontener zajmie całą dostępną szerokość */
}

.tier-wrapper .input-group {
    flex: 1;             /* To sprawia, że oba pola dzielą się miejscem 50/50 */
}

/* Opcjonalnie: upewnij się, że selecty wypełniają całe swoje miejsce */
.forge-select {
    width: 100%;
}
.forge-input, .forge-select, .icon-input-wrapper {
    width: 100%;
    height: 38px; /* Stała wysokość dla wszystkich pól */
    background: rgba(15, 15, 18, 0.9);
    color: #f1f5f9;
    padding: 0 10px;
    border: 1px solid rgba(168, 85, 247, 0.5);
    border-radius: 8px;
    box-sizing: border-box;
    font-size: 14px;
}

.icon-input-wrapper { 
    display: flex; 
    align-items: center; 
    gap: 5px; 
    padding: 0 8px;
}

.icon-input-wrapper img { 
    width: 24px; 
    height: 24px; 
    image-rendering: pixelated; 
}

.icon-input-wrapper input { 
    border: none; 
    background: transparent; 
    color: white; 
    width: 100%; 
    outline: none; 
    height: 100%;
}

.sub-label {
    font-size: 10px;
    color: #888;
    margin-top: -3px;
    margin-bottom: 2px;
    display: block;
}

.label-with-check {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 2px;
}

.skill-btn-forge {
    display: block;      /* Przycisk musi być blokiem, żeby margin: auto zadziałał */
    width: 20%;
    margin: 10px auto 0; /* 10px góra, auto boki, 0 dół */
    padding: 12px;


    
    /* Kolory i Obramowanie */
    background: rgba(15, 15, 18, 0.8);
    border: 1px solid rgba(168, 85, 247, 0.5);
    border-radius: 8px;
    color: #39ff14;
    text-shadow: 0 0 8px rgba(57, 255, 20, 0.4);
    
    /* Typografia */
    font-weight: bold;
    text-transform: uppercase; /* Opcjonalnie: nadaje charakteru przyciskom akcji */
    letter-spacing: 1px;
    
    /* Interakcja */
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.skill-btn-forge:hover { 
    background: #39ff14; 
    color: #000; 
    box-shadow: 0 0 15px rgba(57, 255, 20, 0.6);
    transform: translateY(-2px); /* Delikatne uniesienie */
}

.skill-btn-forge:active {
    transform: translateY(0); /* Efekt wciśnięcia */
}

/* Opcjonalny efekt "błysku" przy najechaniu */
.skill-btn-forge::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        120deg,
        transparent,
        rgba(255, 255, 255, 0.2),
        transparent
    );
    transition: 0.5s;
}

.skill-btn-forge:hover::before {
    left: 100%;
}

/* --- WYNIKI --- */
.forge-results-grid {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 25px;
    width: 100%;
}

.result-card {
    background: rgba(15, 15, 18, 0.9);
    border: 1px solid rgba(168, 85, 247, 0.2);
    border-radius: 12px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    width: 100%;
    box-sizing: border-box;
    backdrop-filter: blur(8px);
    transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.result-card:hover {
    transform: translateY(-3px);
    border-color: rgba(168, 85, 247, 0.6);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5);
}

/* Ukrywaj domyślnie tylko w kalkulatorach wymagających aktywacji (np. Kuźnia) */
.forge-results-grid .result-card:not(.active) {
    display: none;
}

.result-card.active { 
    display: flex; 
    border-color: #a855f7; 
}

.result-card h3 {
    text-align: center;
    color: #39ff14;
    text-shadow: 0 0 8px rgba(57, 255, 20, 0.3);
    font-size: 0.9em;
    margin: 0 0 10px 0;
    text-transform: uppercase;
    border-bottom: 1px solid rgba(168, 85, 247, 0.3);
    padding-bottom: 8px;
}

.card-content-row {
    display: grid;
    grid-template-columns: 1.5fr 1.5fr 1fr 1.5fr;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    transition: background 0.3s ease;
    box-sizing: border-box;
}

.card-content-row:hover {
    background: rgba(168, 85, 247, 0.15);
}

.result-items, .result-resources {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85em;
    color: #fff;
}

.main-item-info {
    font-size: 0.85em;
    color: #aaa;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.fee-section {
    color: #e0d1b1;
    font-size: 0.8em;
    text-align: center;
    border-left: 1px solid rgba(168, 85, 247, 0.2);
    border-right: 1px solid rgba(168, 85, 247, 0.2);
    padding: 0 5px;
}

.total-section { text-align: right; }
.total-section label { display: block; font-size: 0.65em; color: #e0d1b1; }

.result-value {
    font-size: 1.15em;
    color: #39ff14;
    text-shadow: 0 0 8px rgba(57, 255, 20, 0.3);
    font-weight: bold;
    white-space: nowrap;
}

/* --- RESPONSYWNOŚĆ WYNIKÓW --- */
@media (max-width: 800px) {
    .card-content-row { grid-template-columns: 1fr 1fr; gap: 20px; }
    .fee-section { border: none; text-align: left; padding: 0; }
    .total-section { grid-column: span 2; border-top: 1px solid #3a2d1a; padding-top: 10px; }
}

/* --- RESET SPINNERÓW --- */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type=number] {
  -moz-appearance: textfield;
}