/* Crafting and shops UI - extracted from inline index.html */

/* Ascension Weapon Glow Animations (applied at ascension 11/15/20) —
   soft aged-gold breathing halo (warm/mystical, not neon flood) */
@keyframes ascend-glow-1 {
    0%, 100% { box-shadow: 0 0 8px rgba(224, 192, 112, 0.26), 0 0 16px rgba(224, 192, 112, 0.12); }
    50% { box-shadow: 0 0 13px rgba(224, 192, 112, 0.38), 0 0 22px rgba(224, 192, 112, 0.18); }
}

@keyframes ascend-glow-2 {
    0%, 100% { box-shadow: 0 0 10px rgba(224, 192, 112, 0.3), 0 0 20px rgba(224, 192, 112, 0.16); }
    50% { box-shadow: 0 0 17px rgba(224, 192, 112, 0.46), 0 0 30px rgba(224, 192, 112, 0.24); }
}

@keyframes ascend-glow-3 {
    0%, 100% { box-shadow: 0 0 12px rgba(224, 192, 112, 0.34), 0 0 26px rgba(224, 192, 112, 0.18); }
    50% { box-shadow: 0 0 22px rgba(224, 192, 112, 0.55), 0 0 40px rgba(224, 192, 112, 0.28); }
}

/* ===== CRAFTING SYSTEM STYLES ===== */
.crafting-modal {
    color: var(--p-ffffff);
    padding: 15px;
}

.crafting-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.crafting-resources {
    display: flex;
    gap: 20px;
}

.crafting-resources span {
    font-size: 1.1em;
}

.crafting-income {
    display: flex;
    align-items: center;
    gap: 10px;
}

.crafting-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.crafting-tabs .tab {
    padding: 10px 20px;
    background: rgba(30, 30, 50, 0.8);
    border: 2px solid var(--ui-teal);
    color: var(--ui-teal);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.crafting-tabs .tab:hover {
    background: rgba(78, 205, 196, 0.2);
}

.crafting-tabs .tab.active {
    background: linear-gradient(135deg, var(--ui-teal), var(--ui-teal-2));
    color: var(--p-ffffff);
}

.workshops-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 20px;
}

/* .workshop-card base styles moved to .sect-card in design-system.css */

.workshop-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 15px;
}

.workshop-icon {
    font-size: 1.5em;
}

.workshop-name {
    font-size: 1.2em;
    font-weight: bold;
}

.workshop-workers {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.workshop-disciples {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
    min-height: 50px;
}

.worker-badge {
    padding: 5px 10px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid;
    border-radius: 6px;
    font-size: 0.9em;
}

.worker-badge .worker-name {
    font-weight: bold;
}

.worker-badge .worker-stats {
    display: flex;
    gap: 8px;
    font-size: 0.85em;
    color: var(--p-aaaaaa);
}

.no-workers {
    color: var(--p-888888);
    font-style: italic;
    width: 100%;
    text-align: center;
    padding: 10px;
}

.workshop-stats {
    display: flex;
    justify-content: space-between;
    color: var(--p-aaaaaa);
    font-size: 0.9em;
    margin-bottom: 10px;
}

.workshop-resources {
    color: var(--p-aaaaaa);
    font-size: 0.9em;
    margin-bottom: 10px;
}

/* .progress-bar/.progress-fill replaced by .sect-bar/.sect-bar__fill */

.shopkeeper-section {
    padding: 15px;
    background: rgba(30, 30, 50, 0.8);
    border: 2px solid var(--ui-gold);
    border-radius: 12px;
}

.shopkeeper-section h3 {
    color: var(--ui-gold);
    margin-bottom: 10px;
}

.shopkeeper-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid;
    border-radius: 8px;
}

.shopkeeper-name {
    font-weight: bold;
    font-size: 1.1em;
}

.shopkeeper-stats {
    display: flex;
    gap: 15px;
    color: var(--p-aaaaaa);
}

.no-shopkeeper {
    text-align: center;
    padding: 15px;
    color: var(--p-aaaaaa);
}

/* Shop Items */
.shop-items {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    max-height: calc(85vh - 200px);
    overflow-y: auto;
}

.shop-item {
    padding: 12px;
    background: rgba(30, 30, 50, 0.8);
    border: 2px solid;
    border-radius: 10px;
    text-align: center;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.shop-item .item-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 8px;
}

.shop-item .item-icon {
    font-size: 1.5em;
}

.shop-item .item-rarity {
    font-weight: bold;
    margin-bottom: 8px;
}

.shop-item .item-stats {
    display: flex;
    justify-content: center;
    gap: 10px;
    font-size: 0.85em;
    color: var(--p-aaaaaa);
    margin-bottom: 8px;
}

.shop-item .item-price {
    font-size: 1.1em;
    margin-bottom: 10px;
}

.shop-empty {
    text-align: center;
    padding: 40px;
    color: var(--p-888888);
}

/* Assignment View */
.assignment-view {
    padding: 10px;
}

.assignment-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.assignment-header h3 {
    margin: 0;
}

.assignment-current, .assignment-available {
    margin-bottom: 20px;
}

.workers-list, .available-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 250px;
    overflow-y: auto;
}

/* Crafting Modal Footer */
.crafting-footer {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: center;
}

/* btn-collect / btn-buy kept for any legacy callers */
.btn-collect {
    padding: 6px 12px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9em;
    background: linear-gradient(135deg, var(--ui-gold), var(--p-ffb347));
    color: var(--ui-navy-1);
    font-weight: bold;
}

.btn-collect:hover {
    background: linear-gradient(135deg, var(--p-ffe44d), var(--p-ffc966));
}

/* Sell Resources View */
.sell-resources-container {
    padding: 20px;
}

.sell-resources-container h3 {
    text-align: center;
    margin-bottom: 20px;
    color: var(--p-f0f0f0);
}

.sell-resources-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    max-width: 800px;
    margin: 0 auto;
}

.sell-resource-card {
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 20px;
}

.sell-resource-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sell-resource-icon {
    font-size: 2em;
}

.sell-resource-name {
    font-size: 1.3em;
    font-weight: bold;
    color: var(--p-f0f0f0);
}

.sell-resource-info {
    margin-bottom: 15px;
}

.sell-resource-available,
.sell-resource-price,
.sell-resource-total {
    padding: 5px 0;
    color: var(--p-cccccc);
}

.sell-resource-total {
    font-weight: bold;
    color: var(--ui-gold);
}

.sell-resource-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sell-amount-input {
    width: 100%;
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.3);
    color: var(--p-ffffff);
    font-size: 1em;
}

.sell-buttons {
    display: flex;
    gap: 8px;
}

.btn-sell-preset {
    flex: 1;
    padding: 8px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--p-ffffff);
    cursor: pointer;
    transition: all 0.3s;
}

.btn-sell-preset:hover {
    background: rgba(255, 255, 255, 0.2);
}

.btn-sell {
    padding: 12px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--ui-success), var(--p-16a34a));
    color: var(--p-ffffff);
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-sell:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--p-2dd269), var(--p-1eb855));
}

.btn-sell:disabled {
    background: rgba(100, 100, 100, 0.5);
    cursor: not-allowed;
}

/* Subtalent & Skill Display (Disciple Details) */
.subtalent-skill-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.subtalent-skill-box {
    padding: 15px;
    background: rgba(30, 30, 50, 0.8);
    border: 2px solid;
    border-radius: 10px;
}

.subtalent-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.subtalent-icon {
    font-size: 1.4em;
}

.subtalent-name {
    font-weight: bold;
    font-size: 1.1em;
}

.subtalent-info {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.subtalent-label {
    color: var(--p-aaaaaa);
}

.subtalent-value {
    font-weight: bold;
}

.subtalent-bonus {
    color: var(--ui-success);
    font-size: 0.9em;
}

.skill-info {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.skill-label {
    color: var(--p-aaaaaa);
}

.skill-value {
    font-weight: bold;
    font-size: 1.2em;
}

.skill-progress-container {
    height: 8px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 5px;
}

.skill-progress-bar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s ease;
}

.skill-xp-text {
    text-align: center;
    font-size: 0.85em;
    color: var(--p-888888);
}

/* Shop Category Tabs */
.shop-category-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
}

.category-tab {
    padding: 10px 20px;
    background: rgba(30, 30, 50, 0.8);
    border: 2px solid var(--p-666666);
    border-radius: 8px;
    color: var(--p-aaaaaa);
    font-size: 1em;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.category-tab:hover {
    border-color: var(--p-888888);
    color: var(--p-ffffff);
}

.category-tab.active {
    background: linear-gradient(135deg, rgba(78, 205, 196, 0.2), rgba(69, 183, 170, 0.2));
    border-color: var(--ui-teal);
    color: var(--ui-teal);
}

/* Improved Shop Item Cards */
.shop-item .item-name {
    font-weight: bold;
    font-size: 1em;
    margin-bottom: 5px;
}

.shop-item .stat-row {
    display: flex;
    justify-content: center;
    font-size: 0.9em;
    margin: 3px 0;
}

.shop-item .stat-row.damage span,
.shop-item .stat-row.defense span {
    font-weight: bold;
    color: var(--ui-teal);
}

.shop-item .stat-row.realm {
    color: var(--p-888888);
    font-size: 0.8em;
}

/* Pill specific styling */
.pill-item .item-stats {
    text-align: center;
}

@media (max-width: 768px), (max-height: 500px) and (pointer: coarse) {
    .crafting-footer {
        padding: 4px;
    }

    .workshops-container {
        grid-template-columns: 1fr !important;
        gap: 8px;
    }

    /* Compact workshop card padding on mobile (overrides .sect-card default) */
    .workshop-card {
        padding: 8px;
    }

    /* Tighten the vertical rhythm so the whole pavilion (workers + intensity + output +
       cost) fits in a single screen with minimal scrolling. */
    .workshop-header {
        padding: 6px 8px;
        margin-bottom: 8px;
    }
    .workshop-name { font-size: 1.05em; }
    .workshop-workers { margin-bottom: 6px; }
    .workshop-worker-slots { margin: 6px 0; }
    .workshop-stats {
        flex-direction: column;
        gap: 2px;
        margin-bottom: 6px;
        font-size: 0.82em;
    }
    .workshop-resources { margin-bottom: 6px; font-size: 0.82em; }
    .workshop-intensity { margin: 6px 0; }
}
