* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    background-color: #f0f0f0;
    color: #333;
    line-height: 1.6;
}

.tab-container {
    display: flex;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    border-radius: 4px 4px 0 0;
    overflow: hidden;
    background-color: #2c3e50;
}

.tab-btn {
    flex: 1;
    padding: 1rem 1.5rem;
    min-height: 50px;
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s ease;
    text-align: center;
}

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

.tab-btn.active {
    background-color: #3498db;
    color: white;
    font-weight: bold;
}

header {
    background-color: #34495e;
    color: white;
    padding: 1.5rem;
    text-align: center;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    max-width: 1200px;
    margin: 0 auto;
    border-radius: 0 0 4px 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.search-container {
    width: 100%;
    max-width: 500px;
    margin-top: 0.5rem;
    position: relative;
}

.search-input {
    width: 100%;
    padding: 0.75rem 3rem 0.75rem 1rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    outline: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: all 0.2s ease;
}

.clear-search-btn {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 1.2rem;
    color: #666;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 50%;
    transition: all 0.2s ease;
    z-index: 10;
}

.clear-search-btn:hover {
    background-color: rgba(0,0,0,0.1);
    color: #333;
}

.clear-search-btn:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(0,0,0,0.1);
}

.search-input:focus {
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    transform: translateY(-1px);
}

.searchable-select {
    position: relative;
    width: 100%;
}

.search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 0 0 4px 4px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    max-height: 200px;
    overflow-y: auto;
    z-index: 100;
    display: none;
}

.search-dropdown.show {
    display: block;
}

.search-dropdown-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
    border-bottom: 1px solid #f0f0f0;
    color: #333;
}

.search-dropdown-item:hover {
    background-color: #f5f5f5;
}

.search-dropdown-item:last-child {
    border-bottom: none;
}

.search-dropdown-item.highlight {
    background-color: #e3f2fd;
}

.search-dropdown-section {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: #666;
    background-color: #fafafa;
    border-bottom: 1px solid #f0f0f0;
}

header .back-button {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    margin: 0;
    z-index: 10;
    cursor: pointer;
}

main {
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.crate-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
}

.crate-item {
    background-color: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.2s ease;
    cursor: pointer;
}

.crate-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.crate-item h2 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: #333;
}

.back-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(255,255,255,0.2);
    color: white;
    padding: 0.5rem;
    border-radius: 50%;
    text-decoration: none;
    font-size: 1.2rem;
    width: 36px;
    height: 36px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: background-color 0.2s ease;
}

.back-button:hover {
    background-color: rgba(255,255,255,0.3);
}

.back-button:active {
    transform: translateY(-50%) translateX(2px);
    background-color: rgba(255,255,255,0.4);
}

.weapon-section {
    margin-bottom: 2rem;
    background-color: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.section-title {
    padding: 1rem;
    font-size: 1.1rem;
    font-weight: bold;
    text-align: center;
    color: white;
}

.section-title.covert {
    background-color: #ff4757;
}

.section-title.classified {
    background-color: #a55eea;
}

.section-title.restricted {
    background-color: #3742fa;
}

.section-title.milspec {
    background-color: #2ed573;
}

.section-title.ancient {
    background-color: #ffa502;
}

.section-title.consumer {
    background-color: #74b9ff;
}

.section-title.industrial {
    background-color: #81ecec;
}

.weapon-list {
    padding: 1rem;
}

.weapon-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    border-bottom: 1px solid #eee;
}

.weapon-info {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    flex: 1;
}

.weapon-name {
    font-weight: 600;
    font-size: 1rem;
    color: #333;
    flex: 1;
}

.weapon-wear-range {
    font-weight: 500;
    font-size: 0.9rem;
    color: #666;
    background-color: #f5f5f5;
    padding: 0.15rem 0.5rem;
    border-radius: 12px;
}

.weapon-item:last-child {
    border-bottom: none;
}

.wear-input {
    width: 90px;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-align: center;
    font-size: 1rem;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.wear-input:focus {
    outline: none;
    border-color: #333;
    box-shadow: 0 0 0 2px rgba(51, 51, 51, 0.2);
}

.calculator-container {
    background-color: white;
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.calculator-section h2 {
    font-size: 1.3rem;
    margin-bottom: 0.8rem;
    color: #333;
}

.calculator-section p {
    margin-bottom: 1rem;
    color: #666;
}

.calculator-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1rem;
}

.weapon-crate-container {
    background-color: #f9f9f9;
    padding: 1rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    margin-bottom: 1rem;
}

.weapon-crate-container h3 {
    margin-top: 0;
    margin-bottom: 0.8rem;
    color: #333;
    font-size: 1rem;
}

.form-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.8rem;
}

.form-group label {
    min-width: 30px;
    font-weight: bold;
    color: #333;
    white-space: nowrap;
    font-size: 0.9rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
    width: 100%;
    box-sizing: border-box;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #333;
    box-shadow: 0 0 0 2px rgba(51, 51, 51, 0.2);
}

#calculate-btn {
    padding: 0.75rem 1.5rem;
    background-color: #333;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

#calculate-btn:hover {
    background-color: #555;
}

.calculator-results {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
}

.calculator-results h3 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: #333;
}

.weapon-results {
    margin-top: 1rem;
}

.weapon-results ul {
    list-style-type: disc;
    padding-left: 2rem;
    margin-top: 0.5rem;
}

.weapon-results li {
    margin-bottom: 0.5rem;
    color: #333;
}

@media (max-width: 768px) {
    header {
        padding: 0.8rem;
    }
    
    header .back-button {
        left: 0.8rem;
        width: 32px;
        height: 32px;
        font-size: 1.1rem;
    }
    
    header h1 {
        font-size: 1.2rem;
    }
    
    .tab-container {
        gap: 0;
    }
    
    .tab-btn {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }
    
    main {
        padding: 1rem;
    }
    
    .crate-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .crate-item {
        padding: 1.25rem;
    }
    
    .crate-item h2 {
        font-size: 1.1rem;
    }
    
    .weapon-section {
        margin-bottom: 1.5rem;
    }
    
    .section-title {
        padding: 0.8rem;
        font-size: 1rem;
    }
    
    .weapon-list {
        padding: 0.8rem;
    }
    
    .weapon-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
        padding: 0.6rem;
    }
    
    .weapon-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.3rem;
        width: 100%;
    }
    
    .weapon-wear-range {
        font-size: 0.85rem;
        padding: 0.1rem 0.4rem;
    }
    
    .wear-input {
        align-self: flex-end;
        width: 85px;
        padding: 0.4rem;
        font-size: 0.9rem;
    }
    
    .calculator-container {
        padding: 1.5rem;
    }
    
    .calculator-section h2 {
        font-size: 1.3rem;
    }
    
    h2 {
        font-size: 1.2rem;
        margin-bottom: 1rem;
    }
}