/* Forge Calculator - New Layout */

.forge-calculator-page {
    background: #1a1a1a;
    height: 100vh;
    overflow: hidden;
    color: #e0e0e0;
    display: flex;
    flex-direction: column;
}

/* Header */
.forge-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    background: #0d0d0d;
    border-bottom: 1px solid #333;
}

.forge-logo {
    font-size: 1.3rem;
    font-weight: 700;
    color: #d4a44a;
    text-decoration: none;
    letter-spacing: 1px;
}

.forge-nav {
    display: flex;
    gap: 24px;
}

.forge-nav a {
    color: #888;
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.forge-nav a:hover,
.forge-nav a.active {
    color: #fff;
}

/* Main Layout - 3 Columns */
.forge-main {
    display: grid;
    grid-template-columns: 240px 1fr 380px;
    flex: 1;
    min-height: 0; /* Important for nested flex/grid scrolling */
    gap: 0;
    overflow: hidden;
}

/* Left Sidebar - Forge Chances */
.forge-chances-sidebar {
    background: #141414;
    padding: 16px;
    border-right: 1px solid #333;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

.forge-chances-sidebar .sidebar-header h2 {
    font-size: 0.9rem;
    color: #888;
    margin-bottom: 12px;
    letter-spacing: 1px;
}

.world-toggle {
    margin-bottom: 8px;
}

.world-btn {
    padding: 6px 12px;
    background: #2a2a2a;
    border: 1px solid #444;
    border-radius: 4px;
    color: #fff;
    font-size: 0.8rem;
    cursor: pointer;
}

.world-btn.active {
    background: #3a3a3a;
    border-color: #666;
}

.ore-count-display {
    font-size: 0.8rem;
    color: #666;
    margin-bottom: 16px;
}

/* Chance List */
.chance-list {
    flex: 1;
    overflow-y: auto;
    /* Hide scrollbar but keep scrolling */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}

.chance-list::-webkit-scrollbar {
    display: none; /* Chrome/Safari/Opera */
}

.chance-item {
    margin-bottom: 12px;
}

.chance-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.chance-item-name {
    font-size: 0.9rem;
    color: #e0e0e0;
}

.chance-item-percent {
    font-size: 0.85rem;
    color: #d4a44a;
    font-weight: 600;
}

.chance-bar {
    height: 6px;
    background: #2a2a2a;
    border-radius: 3px;
    overflow: hidden;
}

.chance-bar-fill {
    height: 100%;
    background: #d4a44a;
    border-radius: 3px;
    transition: width 0.3s ease;
}

.chance-bar-fill.optimal {
    background: #22c55e;
}

.chance-bar-fill.craftable {
    background: #3b82f6;
}

.chance-bar-fill.locked {
    background: #444;
}

.chance-bar-fill.warning {
    background: linear-gradient(90deg, #f59e0b 0%, #ef4444 100%);
}

.chance-item-percent.low-chance {
    color: #ef4444;
    font-weight: 700;
}

.chance-item-percent.high-chance {
    color: #20c997;
    font-weight: 700;
}

.chance-item-range {
    font-size: 0.65rem;
    color: #666;
    margin-left: auto;
    margin-right: 8px;
    font-family: monospace;
}

/* Weapon Variants under each type */
.weapon-variants {
    margin-top: 8px;
    padding-left: 8px;
    border-left: 2px solid #333;
}

.weapon-variants.active {
    border-left-color: #d4a44a;
}

.weapon-variants.locked {
    opacity: 0.5;
}

.variant-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 8px;
    margin-bottom: 2px;
    font-size: 0.75rem;
    color: #888;
    background: #1a1a1a;
    border-radius: 3px;
}

.weapon-variants.active .variant-item {
    color: #ccc;
}

.variant-item.limited {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.variant-item.limited .variant-name {
    color: #ef4444;
}

.variant-name {
    font-weight: 500;
}

.variant-chance {
    font-size: 0.7rem;
    color: #666;
    font-family: monospace;
}

.weapon-variants.active .variant-chance {
    color: #d4a44a;
}

.chance-tip {
    margin-top: 16px;
    padding: 12px;
    background: #1a1a1a;
    border-radius: 6px;
    font-size: 0.75rem;
    color: #666;
    line-height: 1.4;
}

/* Saved Builds Section */
.saved-builds-section {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #333;
}

.saved-builds-section h3 {
    font-size: 0.8rem;
    color: #888;
    margin: 0 0 12px 0;
    letter-spacing: 1px;
}

.save-build-form {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
}

.save-build-form input {
    flex: 1;
    padding: 8px 10px;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 4px;
    color: #e0e0e0;
    font-size: 0.8rem;
}

.save-build-form input::placeholder {
    color: #555;
}

.save-build-form input:focus {
    outline: none;
    border-color: #d4a44a;
}

.save-build-btn {
    padding: 8px 10px;
    background: #d4a44a;
    border: none;
    border-radius: 4px;
    color: #000;
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
}

.save-build-btn:hover {
    background: #e0b35a;
}

.saved-builds-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 200px;
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.saved-builds-list::-webkit-scrollbar {
    display: none;
}

.saved-build-item {
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 4px;
    padding: 8px 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.saved-build-item:hover {
    border-color: #d4a44a;
    background: #222;
}

.saved-build-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
}

.saved-build-info {
    flex: 1;
    min-width: 0;
}

.saved-build-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: #e0e0e0;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.saved-build-meta {
    font-size: 0.65rem;
    color: #666;
}

.saved-build-delete {
    padding: 4px 8px;
    background: transparent;
    border: 1px solid #444;
    border-radius: 3px;
    color: #888;
    font-size: 0.65rem;
    cursor: pointer;
    transition: all 0.2s;
}

.saved-build-delete:hover {
    border-color: #ef4444;
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.saved-builds-empty {
    font-size: 0.75rem;
    color: #555;
    text-align: center;
    padding: 16px 8px;
}

/* Center - Forge Preview */
.forge-preview {
    background: #1a1a1a;
    padding: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow: hidden;
    min-height: 0;
}

/* Preview Ring */
.preview-ring {
    width: 100%;
    min-width: 240px;
    max-width: 300px;
    margin-bottom: 6px;
    flex-shrink: 0;
}

.ring-outer {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 50%;
    background: conic-gradient(
        #d4a44a 0deg,
        #d4a44a var(--ring-percent, 0deg),
        #2a2a2a var(--ring-percent, 0deg),
        #2a2a2a 360deg
    );
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ring-inner {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: #1a1a1a;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 20px;
    overflow: hidden;
}

.predicted-weapon {
    margin-bottom: 4px;
}

.predicted-label {
    font-size: 0.55rem;
    color: #666;
    letter-spacing: 1px;
    display: block;
    margin-bottom: 2px;
}

.weapon-name {
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
    margin: 0 0 2px 0;
}

.weapon-chance {
    font-size: 0.9rem;
    color: #d4a44a;
    font-weight: 600;
}

.weapon-stats-preview {
    margin-bottom: 2px;
}

.stat-line {
    font-size: 0.7rem;
    color: #aaa;
    margin: 1px 0;
}

.stat-line span {
    color: #d4a44a;
}

.stat-line.small {
    font-size: 0.6rem;
    color: #666;
}

.variants-list {
    font-size: 0.6rem;
    color: #888;
    margin-bottom: 2px;
    max-width: 100%;
    line-height: 1.1;
}

.traits-preview {
    font-size: 0.55rem;
    color: #666;
    max-width: 100%;
    line-height: 1.1;
}

.traits-preview .no-traits {
    color: #888;
}

.traits-preview .trait-ores {
    color: #d4a44a;
}

/* Selected Ores Section */
.selected-ores-section {
    width: 100%;
    max-width: 500px;
    background: #141414;
    border-radius: 6px;
    padding: 6px 8px;
    margin-bottom: 6px;
    flex-shrink: 0;
}

.selected-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    font-size: 0.7rem;
    color: #888;
}

.click-hint {
    color: #666;
}

.selected-ores-grid {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    min-height: 40px;
    padding: 6px;
    background: #1a1a1a;
    border-radius: 4px;
    border: 1px dashed #333;
}

.selected-ore-item {
    background: #2a2a2a;
    border: 1px solid #444;
    border-radius: 4px;
    padding: 4px 8px;
    text-align: center;
    cursor: pointer;
    min-width: 60px;
    transition: all 0.2s;
}

.selected-ore-item:hover {
    border-color: #d4a44a;
    background: #333;
}

.selected-ore-name {
    font-size: 0.7rem;
    font-weight: 600;
    color: #fff;
    margin-bottom: 1px;
}

.selected-ore-count {
    font-size: 0.65rem;
    color: #d4a44a;
}

.selected-ore-mult {
    font-size: 0.6rem;
    color: #666;
}

.empty-slot {
    color: #444;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.ore-summary {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    font-size: 0.75rem;
    color: #888;
}

.ore-summary strong {
    color: #d4a44a;
}

/* Composition & Traits Row */
.composition-traits-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    width: 100%;
    max-width: 500px;
    margin-bottom: 6px;
    flex-shrink: 0;
}

.composition-box,
.traits-box {
    background: #141414;
    border-radius: 6px;
    padding: 6px 8px;
    border: 1px solid #333;
}

.composition-box h3,
.traits-box h3 {
    font-size: 0.7rem;
    color: #888;
    margin: 0 0 6px 0;
    letter-spacing: 1px;
}

.composition-item {
    font-size: 0.7rem;
    margin-bottom: 3px;
}

.composition-item .ore-name {
    color: #fff;
}

.composition-item .ore-percent {
    color: #888;
}

.empty-hint {
    font-size: 0.7rem;
    color: #555;
    margin: 0;
}

/* Masterwork Section */
.masterwork-section {
    width: 100%;
    max-width: 500px;
    background: #141414;
    border-radius: 6px;
    padding: 6px 8px;
    flex-shrink: 0;
}

.masterwork-section label {
    font-size: 0.75rem;
    color: #e0e0e0;
    display: block;
    margin-bottom: 4px;
}

.masterwork-section label span {
    color: #d4a44a;
    font-weight: 600;
}

.masterwork-section input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #2a2a2a;
    outline: none;
    -webkit-appearance: none;
    cursor: pointer;
}

.masterwork-section input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #d4a44a;
    cursor: pointer;
}

.masterwork-range {
    display: flex;
    justify-content: space-between;
    margin-top: 4px;
    font-size: 0.7rem;
    color: #888;
}

.masterwork-range span span {
    color: #d4a44a;
}

/* Right Sidebar - Ore Selection */
.ore-selection-sidebar {
    background: #141414;
    padding: 16px;
    border-left: 1px solid #333;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

.ore-selection-sidebar .sidebar-header {
    margin-bottom: 12px;
}

.ore-selection-sidebar .sidebar-header h2 {
    font-size: 0.9rem;
    color: #888;
    margin-bottom: 12px;
    letter-spacing: 1px;
}

.ore-selection-sidebar input[type="text"] {
    width: 100%;
    padding: 10px 12px;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 4px;
    color: #e0e0e0;
    font-size: 0.85rem;
}

.ore-selection-sidebar input[type="text"]::placeholder {
    color: #555;
}

/* Ore Grid */
.ore-grid {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding: 8px 0;
    align-content: start;
    /* Hide scrollbar but keep scrolling */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}

.ore-grid::-webkit-scrollbar {
    display: none; /* Chrome/Safari/Opera */
}

.ore-grid-item {
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 6px;
    padding: 12px 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 60px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.ore-grid-item:hover {
    border-color: #d4a44a;
    background: #222;
}

.ore-grid-item.selected {
    border-color: #d4a44a;
    background: #2a2518;
}

.ore-grid-item .ore-name {
    font-size: 0.75rem;
    color: #e0e0e0;
    font-weight: 600;
    margin-bottom: 4px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.2;
}

.ore-grid-item .ore-mult {
    font-size: 0.75rem;
    color: #d4a44a;
    font-weight: 500;
}

.ore-grid-item .ore-selected-badge {
    font-size: 0.7rem;
    color: #22c55e;
    margin-top: 4px;
    font-weight: 600;
}

/* Mode Toggle */
.mode-toggle {
    display: flex;
    gap: 8px;
    padding-top: 12px;
    border-top: 1px solid #333;
    margin-top: 12px;
}

.mode-toggle .mode-btn {
    flex: 1;
    padding: 10px;
    background: #2a2a2a;
    border: 1px solid #444;
    border-radius: 4px;
    color: #888;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.mode-toggle .mode-btn:hover {
    border-color: #666;
    color: #fff;
}

.mode-toggle .mode-btn.active {
    background: #d4a44a;
    border-color: #d4a44a;
    color: #000;
}

.mode-toggle .mode-btn.armor-active {
    background: #20c997;
    border-color: #20c997;
    color: #000;
}

/* Armor Mode Styling */
.chance-item.armor-mode .chance-bar-fill.optimal {
    background: linear-gradient(90deg, #20c997 0%, #17a085 100%);
}

.chance-item.armor-mode .chance-bar-fill.craftable {
    background: linear-gradient(90deg, #3dd9a8 0%, #20c997 100%);
}

.ring-outer.armor-mode {
    background: conic-gradient(
        #20c997 0deg,
        #20c997 var(--ring-percent, 0deg),
        #333 var(--ring-percent, 0deg),
        #333 360deg
    );
}

/* Ore Trait Tooltip (Rechtsklick) */
.ore-trait-tooltip {
    position: fixed;
    background: #1a1a1a;
    border: 1px solid #d4a44a;
    border-radius: 8px;
    padding: 12px 16px;
    max-width: 300px;
    z-index: 10000;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    animation: tooltipFadeIn 0.15s ease-out;
    pointer-events: none;
}

@keyframes tooltipFadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ore-trait-tooltip .tooltip-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid #333;
}

.ore-trait-tooltip .tooltip-ore-name {
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
}

.ore-trait-tooltip .tooltip-rarity {
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    font-weight: 600;
}

.ore-trait-tooltip .tooltip-rarity.common { background: #6b7280; color: #fff; }
.ore-trait-tooltip .tooltip-rarity.uncommon { background: #22c55e; color: #fff; }
.ore-trait-tooltip .tooltip-rarity.rare { background: #3b82f6; color: #fff; }
.ore-trait-tooltip .tooltip-rarity.epic { background: #a855f7; color: #fff; }
.ore-trait-tooltip .tooltip-rarity.legendary { background: #f59e0b; color: #000; }
.ore-trait-tooltip .tooltip-rarity.mythical { background: #ef4444; color: #fff; }
.ore-trait-tooltip .tooltip-rarity.relic { background: #ec4899; color: #fff; }
.ore-trait-tooltip .tooltip-rarity.divine { background: linear-gradient(135deg, #fbbf24, #f59e0b); color: #000; }

.ore-trait-tooltip .tooltip-stats {
    display: flex;
    gap: 16px;
    margin-bottom: 8px;
    font-size: 0.85rem;
}

.ore-trait-tooltip .tooltip-stat {
    color: #888;
}

.ore-trait-tooltip .tooltip-stat span {
    color: #d4a44a;
    font-weight: 600;
}

.ore-trait-tooltip .tooltip-trait {
    font-size: 0.85rem;
    color: #e0e0e0;
    line-height: 1.4;
    padding: 8px;
    background: #222;
    border-radius: 4px;
    border-left: 3px solid #d4a44a;
}

.ore-trait-tooltip .tooltip-trait-type {
    display: inline-block;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 3px;
    margin-bottom: 6px;
    text-transform: uppercase;
    font-weight: 600;
}

.ore-trait-tooltip .tooltip-trait-type.weapon { background: #ef4444; color: #fff; }
.ore-trait-tooltip .tooltip-trait-type.armor { background: #3b82f6; color: #fff; }
.ore-trait-tooltip .tooltip-trait-type.both { background: #a855f7; color: #fff; }

.ore-trait-tooltip .no-trait {
    font-size: 0.85rem;
    color: #666;
    font-style: italic;
}

/* Responsive */
@media (max-width: 1200px) {
    .forge-main {
        grid-template-columns: 200px 1fr 280px;
    }
}

@media (max-width: 900px) {
    .forge-main {
        grid-template-columns: 1fr;
    }

    .forge-chances-sidebar,
    .ore-selection-sidebar {
        display: none;
    }
}
