/* Page decorations */
.tool-container {
    position: relative;
    overflow: hidden;
}

.enchanting-table-decoration {
    position: absolute;
    top: 20px;
    left: -20px;
    width: 80px;
    height: 80px;
    background: linear-gradient(45deg, #4A0E4E, #8B008B, #4A0E4E);
    border: 2px solid #2F1B69;
    transform: rotate(-15deg);
    opacity: 0.8;
    z-index: 0;
    display: none; /* 在大屏幕上才显示 */
    animation: enchant-glow 3s ease-in-out infinite alternate;
    border-radius: 4px;
}

.enchanting-table-decoration::before {
    content: '📚';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
    filter: drop-shadow(0 0 5px #8B008B);
}

.anvil-decoration {
    position: absolute;
    bottom: 30px;
    right: -15px;
    width: 70px;
    height: 70px;
    background: linear-gradient(45deg, #2C2C2C, #5A5A5A, #2C2C2C);
    border: 2px solid #1A1A1A;
    transform: rotate(10deg);
    opacity: 0.8;
    z-index: 0;
    display: none; /* 在大屏幕上才显示 */
    border-radius: 4px;
    position: relative;
}

.anvil-decoration::before {
    content: '🔨';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 20px;
}

@keyframes enchant-glow {
    from {
        box-shadow: 0 0 10px #8B008B;
    }
    to {
        box-shadow: 0 0 20px #8B008B, 0 0 30px #4A0E4E;
    }
}

/* Calculator Container */
.calculator-container {
    position: relative;
    background: var(--minecraft-panel);
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.3);
    border: 2px solid var(--minecraft-secondary);
    z-index: 1;
    border-radius: 2px;
}

.calculator-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAACCAYAAABytg0kAAAAEklEQVQImWNgYGD4z8DAwMAAADgDAKdD8tMAAAAASUVORK5CYII=');
    background-size: 2px 2px;
    opacity: 0.05;
    z-index: -1;
}

.calculator-container h2 {
    color: var(--minecraft-green);
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--minecraft-secondary);
    text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.5);
    text-align: center;
}

/* Calculation Sections */
.calculation-section {
    background: rgba(0, 0, 0, 0.25);
    padding: 2rem;
    margin-bottom: 2rem;
    border: 1px solid var(--minecraft-secondary);
    border-radius: 6px;
    position: relative;
}

.calculation-section h3 {
    color: var(--minecraft-green);
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--minecraft-secondary);
    text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.5);
}

/* Item Setup */
.item-setup {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.input-group label {
    color: var(--minecraft-green);
    font-weight: 500;
    text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.5);
}

.input-group select,
.input-group input {
    background: var(--minecraft-dark);
    border: 2px solid var(--minecraft-secondary);
    color: #E0E0E0;
    padding: 0.75rem;
    border-radius: 4px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.input-group select:focus,
.input-group input:focus {
    outline: none;
    border-color: var(--minecraft-green);
    box-shadow: 0 0 0 2px rgba(68, 189, 50, 0.2);
}

/* Enchantments Grid */
.enchantments-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.enchantment-option {
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid var(--minecraft-secondary);
    border-radius: 6px;
    padding: 1rem;
    transition: all 0.3s ease;
    cursor: pointer;
}

.enchantment-option:hover {
    border-color: var(--minecraft-green);
    background: rgba(68, 189, 50, 0.1);
}

.enchantment-option.selected {
    border-color: var(--minecraft-green);
    background: rgba(68, 189, 50, 0.2);
}

.enchantment-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.enchantment-checkbox {
    width: 18px;
    height: 18px;
    accent-color: var(--minecraft-green);
}

.enchantment-name {
    color: var(--minecraft-green);
    font-weight: 500;
    flex: 1;
}

.enchantment-level {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.enchantment-level label {
    color: #E0E0E0;
    font-size: 0.9rem;
}

.enchantment-level select {
    background: var(--minecraft-dark);
    border: 1px solid var(--minecraft-secondary);
    color: #E0E0E0;
    padding: 0.25rem 0.5rem;
    border-radius: 3px;
    font-size: 0.9rem;
}

/* Selected Enchantments */
.selected-enchantments {
    min-height: 100px;
    background: rgba(0, 0, 0, 0.3);
    border: 2px dashed var(--minecraft-secondary);
    border-radius: 6px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.no-enchantments {
    text-align: center;
    color: var(--minecraft-gray);
    font-style: italic;
    margin: 0;
}

.selected-enchantment {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--minecraft-green);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    margin: 0.25rem;
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.remove-enchantment {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
}

.remove-enchantment:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Calculation Controls */
.calculation-controls {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.minecraft-btn {
    background: var(--minecraft-green);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    box-shadow: 0 4px 0 var(--minecraft-secondary);
    position: relative;
    top: 0;
}

.minecraft-btn:hover {
    background: #3da82a;
    transform: translateY(1px);
    box-shadow: 0 3px 0 var(--minecraft-secondary);
}

.minecraft-btn:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 var(--minecraft-secondary);
}

.minecraft-btn:disabled {
    background: var(--minecraft-gray);
    cursor: not-allowed;
    box-shadow: 0 4px 0 #555;
}

.minecraft-btn:disabled:hover {
    transform: none;
    box-shadow: 0 4px 0 #555;
}

.add-btn {
    background: var(--minecraft-accent);
    box-shadow: 0 4px 0 #cc7700;
}

.add-btn:hover {
    background: #e67e00;
    box-shadow: 0 3px 0 #cc7700;
}

.clear-btn {
    background: #dc3545;
    box-shadow: 0 4px 0 #a71e2a;
}

.clear-btn:hover {
    background: #c82333;
    box-shadow: 0 3px 0 #a71e2a;
}

.calculate-btn {
    background: var(--minecraft-green);
    box-shadow: 0 4px 0 var(--minecraft-secondary);
}

/* Results Section */
.result-section {
    border: 2px solid var(--minecraft-green);
    background: rgba(68, 189, 50, 0.1);
}

.result-display {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 6px;
    padding: 1.5rem;
}

.order-steps {
    margin-bottom: 1.5rem;
}

.enchanting-step {
    background: var(--minecraft-panel);
    border: 1px solid var(--minecraft-secondary);
    border-radius: 6px;
    padding: 1rem;
    margin-bottom: 1rem;
    position: relative;
}

.step-number {
    position: absolute;
    top: -10px;
    left: 15px;
    background: var(--minecraft-green);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: bold;
}

.step-description {
    margin-top: 0.5rem;
    color: #E0E0E0;
    font-size: 1rem;
}

.step-cost {
    color: var(--minecraft-accent);
    font-weight: bold;
    margin-top: 0.5rem;
}

.total-cost {
    text-align: center;
    background: var(--minecraft-panel);
    border: 2px solid var(--minecraft-green);
    border-radius: 6px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.total-cost h4 {
    color: var(--minecraft-green);
    margin: 0;
    font-size: 1.3rem;
}

.total-cost span {
    color: var(--minecraft-accent);
    font-size: 1.5rem;
    font-weight: bold;
}

.copy-btn {
    background: var(--minecraft-secondary);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 1rem;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.copy-btn:hover {
    background: #2d6b1f;
}

/* Info Section */
.info-section {
    background: var(--minecraft-panel);
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.3);
    border: 2px solid var(--minecraft-secondary);
    border-radius: 2px;
}

.info-section h2 {
    color: var(--minecraft-green);
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--minecraft-secondary);
    text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.5);
    text-align: center;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.info-card {
    background: rgba(0, 0, 0, 0.25);
    padding: 1.5rem;
    border-radius: 6px;
    border: 1px solid var(--minecraft-secondary);
}

.info-card h3 {
    color: var(--minecraft-green);
    margin-bottom: 1rem;
    text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.5);
}

.info-card p {
    color: #E0E0E0;
    line-height: 1.6;
    margin-bottom: 1rem;
}

.info-card ul {
    color: #E0E0E0;
    padding-left: 1.5rem;
    margin-bottom: 1rem;
}

.info-card li {
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

.formula {
    background: rgba(68, 189, 50, 0.1);
    border: 1px solid var(--minecraft-green);
    border-radius: 4px;
    padding: 1rem;
    margin-top: 1rem;
    font-family: 'Courier New', monospace;
}

.formula strong {
    color: var(--minecraft-green);
    display: block;
    margin-bottom: 0.5rem;
}

/* Tips Section */
.tips-section {
    background: var(--minecraft-panel);
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.3);
    border: 2px solid var(--minecraft-secondary);
    border-radius: 2px;
}

.tips-section h2 {
    color: var(--minecraft-green);
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--minecraft-secondary);
    text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.5);
    text-align: center;
}

.tips-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.tip-card {
    background: rgba(0, 0, 0, 0.25);
    padding: 1.5rem;
    border-radius: 6px;
    border: 1px solid var(--minecraft-secondary);
    transition: all 0.3s ease;
}

.tip-card:hover {
    border-color: var(--minecraft-green);
    background: rgba(68, 189, 50, 0.1);
}

.tip-card h3 {
    color: var(--minecraft-green);
    margin-bottom: 1rem;
    text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.5);
}

.tip-card p {
    color: #E0E0E0;
    line-height: 1.6;
    margin: 0;
}

/* Examples Section */
.examples-section {
    background: var(--minecraft-panel);
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.3);
    border: 2px solid var(--minecraft-secondary);
    border-radius: 2px;
}

.examples-section h2 {
    color: var(--minecraft-green);
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--minecraft-secondary);
    text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.5);
    text-align: center;
}

.examples-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
}

.example-card {
    background: rgba(0, 0, 0, 0.25);
    padding: 1.5rem;
    border-radius: 6px;
    border: 1px solid var(--minecraft-secondary);
}

.example-card h3 {
    color: var(--minecraft-green);
    margin-bottom: 1rem;
    text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.5);
}

.example-enchantments {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.enchant-tag {
    background: var(--minecraft-accent);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 500;
}

.example-order h4 {
    color: var(--minecraft-green);
    margin-bottom: 1rem;
}

.example-order ol {
    color: #E0E0E0;
    padding-left: 1.5rem;
    margin-bottom: 1rem;
}

.example-order li {
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

.total-cost-example {
    color: var(--minecraft-accent);
    font-weight: bold;
    text-align: center;
    margin: 0;
    padding: 0.5rem;
    background: rgba(255, 140, 0, 0.1);
    border-radius: 4px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .calculator-container {
        padding: 1rem;
    }
    
    .calculation-section {
        padding: 1rem;
    }
    
    .item-setup {
        grid-template-columns: 1fr;
    }
    
    .enchantments-grid {
        grid-template-columns: 1fr;
    }
    
    .calculation-controls {
        flex-direction: column;
    }
    
    .minecraft-btn {
        width: 100%;
    }
    
    .info-grid {
        grid-template-columns: 1fr;
    }
    
    .tips-grid {
        grid-template-columns: 1fr;
    }
    
    .examples-container {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 992px) {
    .enchanting-table-decoration,
    .anvil-decoration {
        display: block;
    }
}

/* Animation for result appearance */
.result-section {
    animation: slideInUp 0.5s ease-out;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading state */
.calculating {
    opacity: 0.7;
    pointer-events: none;
}

.calculating::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 4px solid var(--minecraft-secondary);
    border-top: 4px solid var(--minecraft-green);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}