/* 
 * 🏛️ ATLAS-CIV-CLICKER | CSS-MODUL: MARKETPLACE
 * 
 * MENSCH: Modulare Stile für den Direkthandel, Fernhandel und die Markt-Navigation.
 * KI: @ui-upgrade @ui-render @nova-v3.8 @single-source-of-truth
 */

/* --- Markt-Tabs & Navigation --- */
.market-tabs {
    border-bottom: 2px solid rgba(255, 255, 255, 0.05);
    margin-bottom: 2rem;
    display: flex;
    justify-content: center;
    gap: 1.5rem;
}

.tab-btn {
    background: transparent;
    border: none;
    padding: 1rem 2rem;
    color: var(--text-secondary);
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
    font-size: 1.1rem;
}

.tab-btn:hover {
    color: #fff;
    background: rgba(255,255,255,0.03);
}

.tab-btn.active {
    color: var(--color-gold);
    border-bottom-color: var(--color-gold);
}

/* --- Ressourcen-Auswahl Grid --- */
.market-selection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 15px;
    margin-bottom: 2.5rem;
}

.res-select-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 15px 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

.res-select-card:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-3px);
}

/* MENSCH: Hocheffektives Kontrast-Design für aktive Auswahl */
.res-select-card.active {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    border-color: #fff;
    box-shadow: 0 10px 25px rgba(217, 119, 6, 0.4), inset 0 0 15px rgba(255, 255, 255, 0.2);
    transform: translateY(-5px) scale(1.05);
}

.res-select-card .material-symbols-outlined {
    font-size: 1.8rem;
    opacity: 0.8;
    transition: all 0.3s ease;
}

.res-select-card.active .material-symbols-outlined,
.res-select-card.active .res-name,
.res-select-card.active .res-amount {
    color: #1a1a1a !important; /* MENSCH: Dunkler Text auf Gold für perfekte Lesbarkeit */
    opacity: 1;
}

.res-select-card .res-name {
    font-size: 0.7rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.5;
}

.res-select-card .res-amount {
    font-size: 0.9rem;
    font-weight: 800;
    color: #fff;
    background: rgba(0,0,0,0.2);
    padding: 3px 10px;
    border-radius: 20px;
    margin-top: 2px;
}

/* --- Handels-Aktionsbereich --- */
.market-trade-area {
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 2.5rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
}

/* MENSCH: Desktop-Optimierung gegen "Leere" Ansicht */
@media (min-width: 1024px) {
    .market-trade-area-content {
        display: grid;
        grid-template-columns: 1.2fr 0.8fr;
        gap: 3rem;
        align-items: center;
    }

    .market-action-row {
        padding: 0 !important;
        border-right: 1px solid rgba(255,255,255,0.05);
        padding-right: 3rem !important;
    }

    .portion-selector {
        flex-direction: column;
        gap: 10px;
        margin: 0 !important;
    }

    .btn-portion {
        width: 100%;
        padding: 12px !important;
    }
}

.market-preview-box {
    background: rgba(0,0,0,0.3);
    padding: 20px;
    border-radius: 16px;
    text-align: center;
    margin-bottom: 2rem;
    border: 1px solid rgba(255,255,255,0.03);
}

.market-action-row input[type=range] {
    -webkit-appearance: none;
    width: 100%;
    background: transparent !important;
    padding: 0 !important;
    margin: 25px 0;
    cursor: pointer;
}

.market-action-row input[type=range]::-webkit-slider-runnable-track {
    width: 100%;
    height: 18px; /* Noch etwas dicker */
    background: rgba(255, 255, 255, 0.15); /* Hellere Basis */
    border: 2px solid rgba(255, 255, 255, 0.3); /* Klare Kante */
    border-radius: 12px;
    box-shadow: inset 0 3px 8px rgba(0,0,0,0.7);
    cursor: pointer;
}

.market-action-row input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 42px; /* Größerer Knopf */
    width: 42px;
    border-radius: 50%;
    background: radial-gradient(circle, #fff 10%, #f59e0b 80%); /* Strahlender kaiserlicher Kern */
    box-shadow: 0 0 30px rgba(245, 158, 11, 1), 0 8px 20px rgba(0,0,0,0.8);
    margin-top: -14px; /* Perfekte Zentrierung */
    border: 5px solid #fff; /* Fette weiße Umrandung */
    cursor: grab;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.market-action-row input[type=range]::-webkit-slider-thumb:active {
    cursor: grabbing;
    transform: scale(0.85);
    box-shadow: 0 0 40px rgba(245, 158, 11, 1);
}

/* Firefox Support */
.market-action-row input[type=range]::-moz-range-track {
    width: 100%;
    height: 18px;
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
}

.market-action-row input[type=range]::-moz-range-thumb {
    height: 38px;
    width: 38px;
    border-radius: 50%;
    background: radial-gradient(circle, #fff 10%, #f59e0b 80%);
    border: 5px solid #fff;
    box-shadow: 0 0 25px rgba(245, 158, 11, 0.9);
}

.portion-selector {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin: 1rem 0 2rem 0;
    flex-wrap: wrap; 
}

.yield-banner-v4 {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), rgba(0,0,0,0.4));
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 16px;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    min-height: 70px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.yield-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--color-gold);
    font-weight: 800;
}

.yield-value {
    font-size: 1.5rem;
    font-weight: 900;
    color: #fff;
    text-align: right;
    text-shadow: 0 2px 10px rgba(245, 158, 11, 0.5);
}

.yield-error {
    font-size: 0.7rem;
    color: #f87171;
    font-weight: 400;
    margin-top: 4px;
}

.btn-premium-trade {
    width: 100%;
    background: linear-gradient(180deg, #f59e0b 0%, #d97706 100%) !important;
    color: #000 !important;
    font-weight: 900 !important;
    height: 56px !important;
    font-size: 1.1rem !important;
    text-transform: uppercase;
    letter-spacing: 2px;
    border-radius: 12px !important;
    box-shadow: 0 10px 30px rgba(217, 119, 6, 0.3) !important;
    margin-top: 1.5rem !important;
    border: none !important;
    cursor: pointer;
    transition: all 0.2s ease !important;
}

.btn-premium-trade:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 40px rgba(217, 119, 6, 0.4) !important;
}

.btn-premium-trade:active {
    transform: translateY(2px);
}

.btn-portion {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.7);
    padding: 10px 18px;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 65px;
}

.btn-portion:hover, .btn-portion.active {
    background: rgba(245, 158, 11, 0.2);
    color: var(--color-gold);
    border-color: var(--color-gold);
}

.handels-slot-active {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(30, 41, 59, 0.6)) !important;
    border-color: rgba(245, 158, 11, 0.3) !important;
}

@media (max-width: 768px) {
    .market-tabs {
        gap: 0.5rem;
    }
    .tab-btn {
        padding: 0.8rem 1rem;
        font-size: 0.9rem;
    }
    .market-trade-area {
        padding: 1rem;
    }
}

/* --- Marktplatz Banner & Dekoration (Nova v3.8) --- */
.market-banner {
    position: relative;
    overflow: hidden;
    border-radius: 20px;
    background: #0f172a;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.market-banner:hover {
    border-color: rgba(245, 158, 11, 0.3);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
}

.market-banner img {
    width: 100%;
    height: auto;
    transition: all 0.8s ease;
    opacity: 0.8;
}

.market-banner:hover img {
    transform: scale(1.05);
    opacity: 1;
}

.market-banner-compact {
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 16px;
    padding: 1.2rem 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 2rem;
    width: 100% !important;
    box-sizing: border-box !important; /* MENSCH: Zwingend erforderlich für volle Breite */
}

/* 🏛️ HARMONISIERUNG: Mobile Straffung für alle Views */
@media (max-width: 600px) {
    .market-banner-compact {
        padding: 0.6rem 1rem !important;
        margin-bottom: 1.2rem !important;
        border-radius: 12px;
    }
    
    .market-banner-compact h2 {
        font-size: 1.4rem !important;
    }
}

/* --- Handels-Optionen (Karten) --- */
.trade-option {
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 18px;
    padding: 2rem;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
}

.trade-option:hover {
    transform: translateY(-10px);
    border-color: var(--color-gold);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5), 0 0 15px rgba(245, 158, 11, 0.1);
}
/* --- Marktplatz Quick-Buttons (v2.1) --- */
.quick-btns {
    display: flex;
    gap: 0.4rem;
    margin-top: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.btn-q {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    font-size: 0.75rem;
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-q:hover {
    background: rgba(245, 158, 11, 0.1);
    color: var(--color-gold);
    border-color: var(--color-gold);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.15);
}

.btn-q-plus {
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.2);
    color: #4ade80;
}

.btn-q-plus:hover {
    background: rgba(34, 197, 94, 0.2);
    border-color: #22c55e;
    color: #fff;
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.2);
}

.btn-q-minus {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

.btn-q-minus:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: #ef4444;
    color: #fff;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
}

.btn-q:active {
    transform: translateY(0);
}

/* --- Dynamische Namensanzeige im Dashboard --- */
.user-header-name {
    font-size: 0.7rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--text-secondary);
    opacity: 0.7;
    line-height: 1;
    margin-bottom: 4px;
    text-align: center;
}
#header-user-alias:empty ~ .user-header-suffix {
    display: none;
}
