/* ========================================
   ALBION CRAFT CALCULATOR v3.0
   craft.css — Crafting calculator layout, item lists, settings
   ======================================== */
/* ============================================
   CRAFT CALCULATOR PAGE STYLES (EN-US PREMIUM)
   ============================================ */
.craft-tables-grid {
    display: flex;
    flex-direction: column;
    gap: 30px;
    margin-top: 25px;
}

.craft-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-card);
    margin-bottom: 25px;
    backdrop-filter: blur(8px);
}

.craft-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    padding-bottom: 16px;
    margin-bottom: 20px;
}

.craft-card-header h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.craft-header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.craft-fetch-btn {
    background: linear-gradient(135deg, var(--gold-primary), var(--gold-dark));
    color: #000;
    border: none;
    border-radius: var(--border-radius-sm);
    padding: 8px 18px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.craft-fetch-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(212, 168, 67, 0.25);
}

.craft-fetch-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.craft-last-update {
    font-size: 12px;
    color: var(--text-muted);
}

/* Mode Selector & Table Input Styles */
.craft-mode-selector {
    display: inline-flex;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 2px;
    gap: 2px;
}

.craft-mode-btn {
    background: transparent;
    border: none;
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    outline: none;
}

.craft-mode-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.02);
}

.craft-mode-btn.active {
    color: #000 !important;
    background: var(--gold-primary) !important;
    font-weight: 700;
}

.craft-table-input {
    width: 90px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    padding: 5px 10px;
    color: var(--text-primary);
    text-align: right;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    outline: none;
    transition: all 0.2s ease;
}

.craft-table-input:hover {
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.05);
}

.craft-table-input:focus {
    border-color: var(--gold-primary);
    background: rgba(255, 255, 255, 0.07);
    box-shadow: 0 0 0 2px rgba(212, 168, 67, 0.15);
}

/* Chrome, Safari, Edge, Opera: Remove number spinner */
.craft-table-input::-webkit-outer-spin-button,
.craft-table-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    appearance: none;
    margin: 0;
}

/* Firefox: Remove number spinner */
.craft-table-input[type=number] {
    -moz-appearance: textfield;
    appearance: textfield;
}

.craft-settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    align-items: flex-start;
}

.craft-setting-group {
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    padding: 14px 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.craft-setting-group label {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
}

.craft-toggle-label {
    flex-direction: row !important;
    align-items: center;
    gap: 10px !important;
    cursor: pointer;
    user-select: none;
    width: 100%;
}

.craft-toggle-label input[type="checkbox"] {
    width: 17px;
    height: 17px;
    accent-color: var(--gold-primary);
    cursor: pointer;
}

.craft-select {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 8px 12px;
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s;
}

.craft-select:focus:not(:disabled) {
    border-color: var(--gold-primary);
}

.craft-select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.craft-input-sm {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 6px 10px;
    color: var(--text-primary);
    font-size: 13px;
    width: 70px;
    outline: none;
}

.craft-input-sm:focus {
    border-color: var(--gold-primary);
}

.craft-spec-input {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 4px;
}

.craft-spec-input label {
    font-size: 12px !important;
    color: var(--text-muted) !important;
    font-weight: 500;
}

.craft-bonus-options {
    display: flex;
    gap: 14px;
    margin-top: 4px;
}

.craft-radio-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px !important;
    cursor: pointer;
}

.craft-badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 4px;
    background: rgba(255,255,255,0.06);
    color: var(--text-muted);
    font-weight: 700;
    margin-left: auto;
}

.craft-badge-green {
    background: rgba(16, 185, 129, 0.12);
    color: #34d399;
}

.craft-rr-display {
    border-left: 3px solid var(--gold-primary);
    padding-left: 16px;
    justify-content: center;
}

.craft-rr-label {
    font-size: 12px;
    color: var(--text-muted);
}

.craft-rr-value {
    font-size: 20px;
    font-weight: 800;
    color: var(--gold-light);
}

/* Tome Card */
.craft-tome-card {
    padding: 16px 24px;
}

.craft-tome-inner {
    display: flex;
    align-items: center;
    gap: 20px;
}

.craft-tome-icon {
    width: 52px;
    height: 52px;
    object-fit: contain;
    filter: drop-shadow(0 2px 8px rgba(0,0,0,0.5));
}

.craft-tome-info {
    flex: 1;
}

.craft-tome-info h3 {
    margin: 0 0 6px 0;
    font-size: 15px;
    color: var(--text-secondary);
}

.craft-tome-price {
    font-size: 20px;
    font-weight: 800;
    color: var(--gold-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.craft-tome-price.no-data {
    color: var(--text-muted);
    font-size: 14px;
}

.craft-tome-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
}

.craft-age-badge, .craft-city-badge {
    font-size: 12px;
    color: var(--text-muted);
}

/* Tables */
.craft-table-card {
    padding: 24px;
}

.craft-table-wrap {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.craft-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 900px;
}

.craft-table th {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-secondary);
    padding: 14px 16px;
    text-align: left;
    border-bottom: 2px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.01);
}

.craft-table td {
    padding: 12px 16px;
    font-size: 13px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    vertical-align: middle;
}

.craft-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.col-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
}

.craft-item-icon {
    width: 36px;
    height: 36px;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 6px;
    padding: 2px;
}

.tier-label {
    color: var(--text-primary);
}

.ench-dot {
    display: inline-block;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 700;
}

.ench-0 { color: rgba(255,255,255,0.2); }
.ench-1 { background: rgba(167, 139, 250, 0.15); color: #c084fc; }
.ench-2 { background: rgba(248, 113, 113, 0.15); color: #f87171; }
.ench-3 { background: rgba(74, 222, 128, 0.15); color: #4ade80; }
.ench-4 { background: rgba(96, 165, 250, 0.15); color: #60a5fa; }

.col-num {
    font-variant-numeric: tabular-nums;
    text-align: right !important;
}

.col-total {
    font-weight: 700;
    color: var(--text-primary);
}

.col-profit {
    font-weight: 700;
}

.col-margin {
    font-weight: 600;
}

.col-age {
    text-align: right;
    color: var(--text-muted);
    font-size: 12px;
}

/* Profit Row Coloring */
.profit-pos {
    background: rgba(16, 185, 129, 0.04);
}
.profit-pos:hover {
    background: rgba(16, 185, 129, 0.07) !important;
}
.col-profit.profit-pos, .col-margin.profit-pos {
    color: #34d399;
}

.profit-neg {
    background: rgba(239, 68, 68, 0.02);
}
.profit-neg:hover {
    background: rgba(239, 68, 68, 0.04) !important;
}
.col-profit.profit-neg, .col-margin.profit-neg {
    color: #f87171;
}

/* Ranking Card */
.craft-ranking-card {
    margin-top: 25px;
}

.craft-ranking-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.craft-rank-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 20px;
    border-radius: var(--border-radius-md);
    background: rgba(0,0,0,0.15);
    border: 1px solid rgba(255,255,255,0.04);
}

.craft-rank-item.rank-pos {
    border-left: 4px solid #34d399;
}

.craft-rank-item.rank-neg {
    border-left: 4px solid #f87171;
}

.rank-medal {
    font-size: 18px;
}

.craft-rank-icon {
    width: 36px;
    height: 36px;
    object-fit: contain;
}

.rank-name {
    flex: 1;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
}

.rank-profit {
    font-size: 15px;
    font-weight: 800;
}

.rank-pos .rank-profit { color: #34d399; }
.rank-neg .rank-profit { color: #f87171; }

.rank-margin {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    min-width: 60px;
    text-align: right;
}

.craft-empty {
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
    padding: 24px 0;
}

/* === Albion Craft Calculator Premium Overhaul Additions === */
.craft-dashboard-header {
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 16px;
}

.craft-dashboard-header h1 {
    font-family: 'Cinzel', serif;
    font-size: 24px;
    color: var(--gold-primary);
    text-shadow: 0 0 10px rgba(212, 168, 67, 0.15);
    margin-bottom: 4px;
}

.craft-dashboard-header p {
    font-size: 14px;
    color: var(--text-secondary);
}

.craft-top-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
    margin-bottom: 25px;
    align-items: stretch;
}

@media (max-width: 1024px) {
    .craft-top-layout {
        grid-template-columns: 1fr;
    }
}

.craft-tome-icon-wrap {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.3);
}

.craft-rank-item {
    justify-content: space-between !important;
}

.rank-left, .rank-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.rank-right {
    gap: 20px;
}

/* Custom Toggle Switch for Craft Settings */
.craft-setting-group .toggle-switch {
    position: relative;
    width: 40px;
    height: 20px;
    cursor: pointer;
    display: inline-block;
}

.craft-setting-group .toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.craft-setting-group .toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: var(--border-accent);
    transition: .3s;
    border-radius: 20px;
}

.craft-setting-group .toggle-slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}

.craft-setting-group input:checked + .toggle-slider {
    background-color: var(--gold-primary);
}

.craft-setting-group input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

/* ============================================
   CRAFT QUALITY SELECTOR
   ============================================ */
.craft-quality-selector {
    display: flex;
    gap: 4px;
    background: rgba(0,0,0,0.2);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 8px;
    padding: 3px;
}

.craft-quality-btn {
    width: 34px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    background: transparent;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
    opacity: 0.45;
    filter: grayscale(0.6);
}

.craft-quality-btn:hover {
    opacity: 0.8;
    filter: grayscale(0.2);
    background: rgba(255,255,255,0.05);
    transform: scale(1.1);
}

.craft-quality-btn.active {
    opacity: 1;
    filter: grayscale(0);
    transform: scale(1.1);
}

/* Quality 1 — Normal (gray/white) */
.craft-quality-btn.active.quality-1 {
    border-color: rgba(200, 200, 200, 0.4);
    background: rgba(200, 200, 200, 0.1);
    box-shadow: 0 0 8px rgba(200, 200, 200, 0.15);
}

/* Quality 2 — Good (green) */
.craft-quality-btn.active.quality-2 {
    border-color: rgba(74, 222, 128, 0.5);
    background: rgba(74, 222, 128, 0.12);
    box-shadow: 0 0 8px rgba(74, 222, 128, 0.2);
}

/* Quality 3 — Outstanding (blue) */
.craft-quality-btn.active.quality-3 {
    border-color: rgba(96, 165, 250, 0.5);
    background: rgba(96, 165, 250, 0.12);
    box-shadow: 0 0 8px rgba(96, 165, 250, 0.2);
}

/* Quality 4 — Excellent (purple) */
.craft-quality-btn.active.quality-4 {
    border-color: rgba(192, 132, 252, 0.5);
    background: rgba(192, 132, 252, 0.12);
    box-shadow: 0 0 8px rgba(192, 132, 252, 0.2);
}

/* Quality 5 — Masterpiece (gold) */
.craft-quality-btn.active.quality-5 {
    border-color: rgba(251, 191, 36, 0.5);
    background: rgba(251, 191, 36, 0.12);
    box-shadow: 0 0 8px rgba(251, 191, 36, 0.2);
}

.craft-quality-name {
    font-size: 10px !important;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* ============================================
   CRAFT QUANTITY CARD
   ============================================ */
.craft-quantity-card {
    padding: 20px 28px;
    margin-bottom: 25px;
    border-left: 4px solid var(--gold-primary);
    background: linear-gradient(135deg, rgba(212, 168, 67, 0.04), rgba(0,0,0,0.15));
}

.craft-quantity-inner {
    display: flex;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
}

.craft-quantity-left {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
    min-width: 240px;
}

.craft-quantity-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    background: linear-gradient(135deg, rgba(212, 168, 67, 0.15), rgba(212, 168, 67, 0.05));
    border: 1px solid rgba(212, 168, 67, 0.2);
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(212, 168, 67, 0.1);
    flex-shrink: 0;
}

.craft-quantity-info h3 {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 4px 0;
}

.craft-quantity-info p {
    font-size: 12px;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.4;
}

.craft-quantity-controls {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.craft-qty-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.04);
    color: var(--text-secondary);
    border-radius: 8px;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    padding: 0;
    line-height: 1;
}

.craft-qty-btn:hover:not(:disabled) {
    border-color: var(--gold-primary);
    color: var(--gold-primary);
    background: rgba(212, 168, 67, 0.1);
    transform: scale(1.05);
}

.craft-qty-btn:active:not(:disabled) {
    transform: scale(0.95);
}

.craft-qty-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.craft-qty-input {
    width: 80px;
    height: 36px;
    text-align: center;
    background: rgba(0,0,0,0.3);
    border: 2px solid rgba(212, 168, 67, 0.3);
    border-radius: 8px;
    color: var(--gold-light);
    font-size: 16px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    outline: none;
    transition: all 0.2s ease;
}

.craft-qty-input:focus {
    border-color: var(--gold-primary);
    box-shadow: 0 0 0 3px rgba(212, 168, 67, 0.15);
    background: rgba(0,0,0,0.4);
}

/* Remove spinner arrows */
.craft-qty-input::-webkit-outer-spin-button,
.craft-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    appearance: none;
    margin: 0;
}
.craft-qty-input[type=number] {
    -moz-appearance: textfield;
    appearance: textfield;
}

.craft-quantity-presets {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.craft-qty-preset {
    min-width: 44px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.03);
    color: var(--text-muted);
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0 10px;
}

.craft-qty-preset:hover {
    border-color: rgba(212, 168, 67, 0.3);
    color: var(--gold-light);
    background: rgba(212, 168, 67, 0.06);
}

.craft-qty-preset.active {
    border-color: var(--gold-primary);
    background: rgba(212, 168, 67, 0.18);
    color: var(--gold-primary);
    box-shadow: 0 0 10px rgba(212, 168, 67, 0.15);
    font-weight: 800;
}

/* Quantity Badge (shown in table headers & ranking) */
.craft-qty-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(212, 168, 67, 0.2), rgba(212, 168, 67, 0.08));
    border: 1px solid rgba(212, 168, 67, 0.35);
    color: var(--gold-primary);
    border-radius: 20px;
    padding: 2px 10px;
    font-size: 12px;
    font-weight: 800;
    margin-left: 10px;
    vertical-align: middle;
    letter-spacing: 0.3px;
    animation: badgePulse 2s ease-in-out infinite;
}

@keyframes badgePulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(212, 168, 67, 0.2); }
    50% { box-shadow: 0 0 0 4px rgba(212, 168, 67, 0); }
}

/* Responsive */
@media (max-width: 768px) {
    .craft-quantity-inner {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
    }

    .craft-quantity-left {
        min-width: 0;
    }

    .craft-quantity-controls {
        justify-content: center;
    }

    .craft-quantity-presets {
        justify-content: center;
    }
}

/* === CRAFT HUB TABS === */
.craft-main-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
}

.craft-main-tab {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 12px 24px;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-base);
    display: flex;
    align-items: center;
    gap: 8px;
    backdrop-filter: blur(8px);
}

.craft-main-tab:hover {
    background: rgba(212, 168, 67, 0.04);
    border-color: var(--gold-dark);
    color: var(--text-primary);
}

.craft-main-tab.active {
    background: rgba(212, 168, 67, 0.12);
    border-color: var(--gold-primary);
    color: var(--gold-primary);
    box-shadow: 0 4px 20px rgba(212, 168, 67, 0.1);
}

/* === CRAFT SUB TABS (Pills) === */
.craft-sub-tabs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 8px;
    scrollbar-width: thin;
}

.craft-sub-tab {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 20px;
    padding: 8px 16px;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
}

.craft-sub-tab:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.12);
}

.craft-sub-tab.active {
    background: var(--gold-primary);
    color: #000;
    border-color: var(--gold-primary);
    box-shadow: 0 2px 10px rgba(212, 168, 67, 0.2);
}

.craft-filter-pill.active {
    background: rgba(212, 168, 67, 0.15) !important;
    border-color: var(--gold-primary) !important;
    color: var(--gold-primary) !important;
    box-shadow: 0 2px 8px rgba(212, 168, 67, 0.1);
}

/* Weapon Sub-pills Styling */
.craft-weapon-pill {
    padding: 6px 12px;
    font-size: 11px;
    font-weight: 700;
    border-radius: 20px;
    border: 1px solid rgba(255,255,255,0.06);
    background: rgba(255,255,255,0.01);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
}

.craft-weapon-pill:hover {
    background: rgba(255,255,255,0.04);
    color: var(--text-secondary);
}

.craft-weapon-pill.active {
    background: rgba(212, 168, 67, 0.15) !important;
    border-color: var(--gold-primary) !important;
    color: var(--gold-primary) !important;
    box-shadow: 0 2px 8px rgba(212, 168, 67, 0.1);
}
