/* Modern, clean styling for the Factoriopedia */
:root {
    --primary-color: #2c5aa0;
    --secondary-color: #ff6b35;
    --background-color: #1a2332;
    --card-background: #ffffff;
    --text-color: #333333;
    --text-light: #666666;
    --border-color: #e1e5e9;
    --hover-color: #f1f3f4;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px 0;
    border-bottom: 2px solid var(--border-color);
}

header h1 {
    color: var(--primary-color);
    margin: 0 0 10px 0;
    font-size: 2.5rem;
}

header p {
    color: var(--text-light);
    margin: 0;
    font-size: 1.1rem;
}

nav {
    margin-bottom: 20px;
}

nav a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    transition: all 0.2s ease;
}

nav a:hover {
    background-color: var(--hover-color);
    border-color: var(--primary-color);
}

.search-section {
    margin-bottom: 20px;
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: center;
}

#search-input {
    flex: 1;
    min-width: 250px;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 16px;
    transition: border-color 0.2s ease;
}

#search-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.filters {
    display: flex;
    gap: 10px;
}

.filters select {
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: white;
    font-size: 14px;
    cursor: pointer;
}

.stats {
    margin-bottom: 20px;
    font-size: 14px;
    color: var(--text-light);
}

.loading {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
    font-size: 1.1rem;
}

.items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}

.item-card {
    background: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow);
    text-align: center;
    min-height: 100px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.item-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    border-color: var(--primary-color);
}

.item-card h3 {
    margin: 8px 0 6px 0;
    color: var(--primary-color);
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.2;
}

.item-card .item-type,
.unlock-tech {
    background: var(--secondary-color);
    color: white;
    padding: 2px 6px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 500;
    text-transform: uppercase;
    display: inline-block;
    margin-top: auto;
    border-left: none;
}

.unlock-tech strong {
    color: var(--primary-color);
}

.item-icon {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 8px;
    display: block;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.item-icon-placeholder {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #e0e0e0, #f5f5f5);
    border-radius: 4px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: var(--text-light);
    border: 1px dashed var(--border-color);
    flex-shrink: 0;
}

/* Item Details Page */
.item-details {
    background: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.item-header {
    background: linear-gradient(135deg, var(--primary-color), #1e4085);
    color: white;
    padding: 30px;
    display: flex;
    align-items: center;
    gap: 20px;
    min-height: 80px;
}

.item-header-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.item-header-icon-img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.item-header-icon-placeholder {
    width: 80px;
    height: 80px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
    border: 2px dashed rgba(255, 255, 255, 0.3);
}

.item-header-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.item-header h2 {
    margin: 0 0 10px 0;
    font-size: 2.2rem;
}

.item-info {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.item-type {
    background: rgba(255, 255, 255, 0.2);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    text-transform: uppercase;
}

.item-id {
    font-family: 'Courier New', monospace;
    background: rgba(255, 255, 255, 0.1);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
}

.item-content {
    padding: 0;
}

.section {
    border-bottom: 1px solid var(--border-color);
    padding: 25px 30px;
}

.section:last-child {
    border-bottom: none;
}

.section h3 {
    margin: 0 0 20px 0;
    color: var(--primary-color);
    font-size: 1.4rem;
}

.recipes-list {
    display: grid;
    gap: 15px;
}

.recipe-card {
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 20px;
    background: #fafbfc;
    transition: all 0.2s ease;
}

.recipe-card:hover {
    border-color: var(--primary-color);
    background: white;
}

.recipe-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.recipe-name {
    background-color: #1a2332;
    font-weight: 600;
    color: white;
    font-size: 1.1rem;
    padding: 4px 8px;
    border-radius: 4px;
}


.crafting-entity,
.recipe-time {
    color: var(--primary-color);
    font-size: 1.1rem;
    font-weight: 500;
}

.recipe-flow {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.ingredients,
.results {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 120px;
}

.ingredients-label,
.results-label {
    font-weight: 600;
    color: var(--text-light);
    font-size: 14px;
    text-transform: uppercase;
    text-align: left;
}

.ingredient-item,
.result-item {
    background: white;
    border: 1px solid var(--border-color);
    padding: 8px 12px;
    border-radius: 4px;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    transition: all 0.2s ease;
    text-align: left;
    gap: 8px;
}

.ingredient-item:hover,
.result-item:hover {
    border-color: var(--primary-color);
    background: var(--hover-color);
}

.item-amount {
    background: #001f3f;
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: bold;
    min-width: 25px;
    text-align: center;
}

.item-name-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.item-name-link:hover {
    text-decoration: underline;
}

.arrow {
    font-size: 50px;
    color: var(--text-light);
}


.no-data {
    text-align: center;
    color: var(--text-light);
    font-style: italic;
    padding: 40px 20px;
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    header h1 {
        font-size: 2rem;
    }

    .search-section {
        flex-direction: column;
        align-items: stretch;
    }

    #search-input {
        min-width: auto;
    }

    .filters {
        justify-content: center;
    }

    .items-grid {
        grid-template-columns: 1fr;
    }

    .recipe-flow {
        flex-direction: column;
        align-items: stretch;
    }

    .item-header {
        padding: 20px;
    }

    .item-header h2 {
        font-size: 1.8rem;
    }

    .section {
        padding: 20px;
    }
}