:root {
    --bg-dark: #050505;
    --red-primary: #E60000;
    --red-hover: #ff1a1a;
    --text-white: #ffffff;
    --glass-panel: rgba(18, 18, 18, 0.85);
    --border-color: #333;
}

body {
    background-color: var(--bg-dark);
    font-family: 'Poppins', sans-serif;
    color: var(--text-white);
}

/* --- KONTENER GŁÓWNY --- */
.converter-page {
    padding-top: 190px; /* Odstęp od navbara */
    padding-bottom: 100px;
    position: relative;
    overflow: hidden;
    min-height: 100vh;
}

/* --- TŁO: CZERWONA MGŁAWICA --- */
.nebula-glow {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: radial-gradient(circle at 50% 30%, rgba(230, 0, 0, 0.15) 0%, transparent 60%);
    pointer-events: none; z-index: -1;
}
.nebula-core {
    position: absolute; top: 40%; left: 50%;
    transform: translate(-50%, -50%);
    width: 600px; height: 600px;
    background: radial-gradient(circle, rgba(230, 0, 0, 0.25) 0%, transparent 70%);
    filter: blur(80px);
    z-index: -2;
    animation: pulseRed 6s infinite ease-in-out;
}
@keyframes pulseRed {
    0%, 100% { opacity: 0.6; transform: translate(-50%, -50%) scale(1); }
    50% { opacity: 0.9; transform: translate(-50%, -50%) scale(1.1); }
}

/* --- HERO (KOMPAKTOWE) --- */
.converter-hero { 
    text-align: center; 
    margin-bottom: 25px; /* Mniejszy margines dolny */
    padding: 0 20px; 
}

.compact-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

/* Animacja Pływania (Float) */
.floating-icon {
    font-size: 2.5rem; /* Mniejsza ikona */
    color: var(--red-primary);
    filter: drop-shadow(0 0 20px var(--red-primary));
    animation: floatIcon 4s ease-in-out infinite;
    margin-bottom: 5px;
}
@keyframes floatIcon {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.converter-hero h1 { 
    font-size: 2.2rem; /* Mniejszy tytuł */
    font-weight: 800; 
    margin-bottom: 5px; 
    line-height: 1.1; 
}
.text-gradient { 
    background: linear-gradient(90deg, #fff, var(--red-primary)); 
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; 
}
.converter-hero p { 
    color: #888; 
    font-size: 0.9rem; 
    max-width: 600px; 
    margin: 0 auto; 
}

/* --- PANEL SZKLANY --- */
.converter-interface { display: flex; justify-content: center; padding: 0 20px; }

.glass-panel {
    background: var(--glass-panel);
    backdrop-filter: blur(25px);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 24px;
    padding: 35px; /* Trochę mniej paddingu */
    width: 100%; max-width: 800px;
    box-shadow: 0 20px 80px rgba(0,0,0,0.7);
    display: flex; flex-direction: column; gap: 20px;
    position: relative;
    /* Przygotowanie pod animacje 3D */
    transform-style: preserve-3d;
    perspective: 1000px;
}
.glass-panel::after {
    content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 3px;
    background: linear-gradient(90deg, transparent, var(--red-primary), transparent);
}

/* --- GRID AGENTÓW --- */
.agent-selector-label { font-size: 0.85rem; color: #bbb; margin-bottom: -10px; font-weight: 600; padding-left: 5px; }
.agent-selector-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px; margin-bottom: 10px;
}

.agent-option {
    background: #0f0f0f; border: 1px solid #333; border-radius: 12px;
    padding: 10px; cursor: pointer; transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    position: relative; height: 85px;
}
/* Efekt Pop-up przy najechaniu */
.agent-option:hover { 
    border-color: var(--red-primary); 
    background: #161616; 
    transform: translateY(-5px) scale(1.05); 
    z-index: 2;
    box-shadow: 0 10px 20px rgba(0,0,0,0.3);
}

.agent-option img { width: 30px; height: 30px; object-fit: contain; margin-bottom: 6px; border-radius: 6px; }
.agent-option span { font-size: 0.75rem; color: #aaa; font-weight: 500; }

.agent-option.active {
    background: linear-gradient(145deg, #2a0505 0%, #000 100%);
    border-color: var(--red-primary);
    box-shadow: 0 0 15px rgba(230,0,0,0.3) inset;
}
.agent-option.active span { color: #fff; }
.check-icon { position: absolute; top: 5px; right: 5px; color: var(--red-primary); font-size: 0.8rem; display: none; }
.agent-option.active .check-icon { display: block; }

.raw-option .icon-box { font-size: 1.4rem; color: #fff; margin-bottom: 5px; }

/* --- INPUT --- */
.input-group { position: relative; display: flex; align-items: center; }
.input-icon { position: absolute; left: 20px; color: #666; font-size: 1.1rem; }
.input-group input {
    width: 100%; background: #050505; border: 1px solid #333;
    padding: 18px 50px 18px 50px; border-radius: 14px;
    color: #fff; font-size: 0.95rem; font-family: 'Poppins', sans-serif; transition: 0.3s;
}
.input-group input:focus { border-color: var(--red-primary); outline: none; box-shadow: 0 0 25px rgba(230,0,0,0.2); transform: scale(1.01); }
.paste-btn { position: absolute; right: 15px; background: none; border: none; color: #666; cursor: pointer; font-size: 1.2rem; transition: 0.3s; }
.paste-btn:hover { color: #fff; }

/* --- BUTTON --- */
.convert-btn {
    background: var(--red-primary); color: #fff; border: none;
    padding: 18px; border-radius: 14px; font-size: 1.1rem; font-weight: 700;
    cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 10px;
    transition: 0.3s; text-transform: uppercase; letter-spacing: 1px;
}
.convert-btn:hover { background: var(--red-hover); transform: translateY(-2px); box-shadow: 0 10px 30px rgba(230, 0, 0, 0.4); }
.convert-btn:active { transform: scale(0.98); }

/* --- WYNIK --- */
.result-container {
    background: #0a0a0a; border: 1px solid #222; border-radius: 14px;
    padding: 20px; margin-top: 15px; animation: slideIn 0.4s ease-out;
}
.status-bar { display: flex; justify-content: space-between; margin-bottom: 12px; font-size: 0.85rem; color: #ccc; }
.text-green { color: #00E676; margin-right: 5px; }
.detected-platform { background: #1a1a1a; padding: 2px 8px; border-radius: 4px; font-family: monospace; color: #888; }

.result-link-box { display: flex; gap: 10px; margin-bottom: 15px; }
.result-link-box input { width: 100%; background: #141414; border: 1px solid #333; color: #ddd; padding: 10px; border-radius: 8px; font-size: 0.85rem; }
.action-icon-btn { background: #222; border: 1px solid #333; color: #fff; width: 45px; border-radius: 8px; cursor: pointer; transition: 0.3s; }
.action-icon-btn:hover { background: #333; border-color: #555; }

.open-btn {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    background: #fff; color: #000; text-decoration: none; padding: 14px;
    border-radius: 10px; font-weight: 700; transition: 0.3s; text-transform: uppercase; font-size: 0.9rem;
}
.open-btn:hover { background: #e0e0e0; transform: scale(1.02); }

/* --- ERROR --- */
.error-msg {
    color: #ff4081; background: rgba(255,64,129,0.1); border: 1px solid rgba(255,64,129,0.3);
    padding: 12px; border-radius: 10px; text-align: center; margin-top: 15px; font-size: 0.9rem;
}

/* --- SEO --- */
.seo-info { text-align: center; margin-top: 60px; padding: 0 20px; }
.seo-info h2 { font-size: 1.5rem; margin-bottom: 15px; color: #fff; }

/* ==========================================================================
   SEKCJA HISTORII KONWERSJI
   ========================================================================== */
.converter-history {
    display: flex;
    justify-content: center;
    padding: 0 20px;
    margin-top: 40px;
}

.history-panel {
    background: rgba(18, 18, 18, 0.6);
    backdrop-filter: blur(20px);
    border: 1px solid #2C2C2C;
    border-radius: 20px;
    padding: 25px;
    width: 100%;
    max-width: 800px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #2C2C2C;
    padding-bottom: 15px;
}

.history-header h2 {
    font-size: 1.2rem;
    color: #fff;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.history-header h2 i {
    color: var(--red-primary);
}

.history-actions {
    display: flex;
    gap: 15px;
    align-items: center;
}

.history-select {
    background: #050505;
    color: #fff;
    border: 1px solid #333;
    padding: 8px 12px;
    border-radius: 8px;
    font-family: 'Poppins', sans-serif;
    font-size: 0.85rem;
    cursor: pointer;
    outline: none;
    transition: 0.3s;
}

.history-select:focus {
    border-color: var(--red-primary);
}

.history-clear-btn {
    background: transparent;
    color: #808080;
    border: 1px solid #333;
    padding: 8px 15px;
    border-radius: 8px;
    font-family: 'Poppins', sans-serif;
    font-size: 0.85rem;
    cursor: pointer;
    transition: 0.3s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.history-clear-btn:hover {
    color: #FF4081; /* Błąd / usunięcie z palety */
    border-color: #FF4081;
    background: rgba(255, 64, 129, 0.1);
}

/* Lista historii */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 5px;
}

/* Niestandardowy pasek przewijania */
.history-list::-webkit-scrollbar { width: 6px; }
.history-list::-webkit-scrollbar-track { background: #050505; border-radius: 4px; }
.history-list::-webkit-scrollbar-thumb { background: #333; border-radius: 4px; }
.history-list::-webkit-scrollbar-thumb:hover { background: var(--red-primary); }

.empty-history {
    text-align: center;
    color: #808080;
    padding: 30px 0;
    font-size: 0.95rem;
    font-style: italic;
}

/* Pojedynczy element historii */
.history-item {
    background: #1E1E1E; /* Tło wiersza */
    border: 1px solid #2C2C2C;
    border-radius: 12px;
    padding: 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    transition: all 0.3s ease;
    animation: slideIn 0.3s ease-out forwards;
}

.history-item:hover {
    border-color: #555;
    background: #242424;
}

/* Przypięty element */
.history-item.is-pinned {
    border-color: var(--red-primary);
    background: linear-gradient(90deg, rgba(230, 0, 0, 0.05) 0%, #1E1E1E 50%);
    box-shadow: 0 0 10px rgba(230, 0, 0, 0.1) inset;
}

.history-item-left {
    display: flex;
    align-items: center;
    gap: 15px;
    min-width: 150px;
}

.history-agent-logo {
    width: 35px;
    height: 35px;
    border-radius: 8px;
    background: #050505;
    padding: 4px;
    border: 1px solid #333;
    object-fit: contain;
}

.history-meta {
    display: flex;
    flex-direction: column;
}

.history-route {
    font-size: 0.8rem;
    color: #fff;
    font-weight: 600;
}

.history-route i {
    color: #808080;
    font-size: 0.7rem;
    margin: 0 4px;
}

.history-date {
    font-size: 0.7rem;
    color: #808080;
    margin-top: 2px;
}

.history-item-mid {
    flex: 1;
    overflow: hidden;
}

.history-link-input {
    width: 100%;
    background: transparent;
    border: none;
    color: #aaa;
    font-family: monospace;
    font-size: 0.85rem;
    outline: none;
    text-overflow: ellipsis;
    cursor: text;
}

.history-item-right {
    display: flex;
    gap: 8px;
}

.hist-btn {
    background: #2C2C2C;
    border: 1px solid transparent;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: 0.2s;
    font-size: 0.85rem;
}

.hist-btn:hover { background: #444; }

.hist-btn.pin-btn:hover { color: var(--red-primary); }
.hist-btn.pin-btn.active { 
    color: var(--red-primary); 
    background: rgba(230, 0, 0, 0.15); 
    border-color: var(--red-primary); 
}

.hist-btn.del-btn:hover { color: #FF4081; }

/* RWD dla historii */
@media (max-width: 768px) {
    .history-item {
        flex-direction: column;
        align-items: stretch;
    }
    .history-item-mid { margin: 10px 0; }
    .history-item-right { justify-content: flex-end; }
    .history-header { flex-direction: column; gap: 15px; align-items: flex-start; }
    .history-actions { width: 100%; justify-content: space-between; }
}