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

:root {
    --primary-color: #2563eb;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
}

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

header {
    margin-bottom: 40px;
    padding: 30px 20px;
    background: linear-gradient(135deg, var(--primary-color), #1e40af);
    color: white;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-align: left;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

header .subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
}

.timestamp-display {
    background: rgba(255, 255, 255, 0.2);
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 0.85rem;
    text-align: right;
    backdrop-filter: blur(10px);
}

.timestamp-display .timestamp-label {
    font-size: 0.75rem;
    opacity: 0.8;
    margin-bottom: 3px;
}

.timestamp-display .timestamp-value {
    font-weight: 600;
    font-size: 0.9rem;
}

.search-section {
    margin-bottom: 30px;
}

.search-box {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

#searchInput {
    flex: 1;
    padding: 15px 20px;
    font-size: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    outline: none;
    transition: border-color 0.3s;
}

#searchInput:focus {
    border-color: var(--primary-color);
}

.btn-primary {
    padding: 15px 30px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.1s;
}

.btn-primary:hover {
    background-color: #1d4ed8;
}

.btn-primary:active {
    transform: scale(0.98);
}

.help-text {
    color: var(--text-secondary);
    font-size: 0.9rem;
    padding-left: 5px;
}

.refresh-section {
    margin-top: 15px;
    text-align: center;
}

.btn-secondary {
    padding: 10px 25px;
    background-color: #64748b;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.1s;
}

.btn-secondary:hover {
    background-color: #475569;
}

.btn-secondary:active {
    transform: scale(0.98);
}

.btn-secondary:disabled {
    background-color: #94a3b8;
    cursor: not-allowed;
}

.results-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.result-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

.result-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

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

.sku {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary-color);
}

.stock-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.stock-badge.success {
    background-color: #d1fae5;
    color: #065f46;
}

.stock-badge.warning {
    background-color: #fef3c7;
    color: #92400e;
}

.stock-badge.danger {
    background-color: #fee2e2;
    color: #991b1b;
}

.description {
    color: var(--text-secondary);
    margin-bottom: 10px;
    font-size: 0.95rem;
}

.stock-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

.stock-level {
    font-size: 1.1rem;
    font-weight: 600;
}

.category {
    font-size: 0.85rem;
    color: var(--text-secondary);
    background-color: var(--bg-color);
    padding: 4px 10px;
    border-radius: 12px;
}

.no-results {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.no-results-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background-color: var(--card-bg);
    margin: 5% auto;
    padding: 30px;
    border-radius: 16px;
    width: 90%;
    max-width: 800px;
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s;
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.close {
    color: var(--text-secondary);
    float: right;
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

.close:hover {
    color: var(--text-primary);
}

.item-details {
    margin-bottom: 30px;
}

.item-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 15px;
}

.item-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.info-item {
    padding: 15px;
    background-color: var(--bg-color);
    border-radius: 8px;
}

.info-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.info-value {
    font-size: 1.1rem;
    font-weight: 600;
}

.substitutes-section {
    margin-top: 30px;
    padding-top: 30px;
    border-top: 2px solid var(--border-color);
}

.section-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.substitute-card {
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    transition: background-color 0.2s;
}

.substitute-card:hover {
    background-color: #f1f5f9;
}

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

.substitute-sku {
    font-weight: 600;
    color: var(--primary-color);
}

.no-substitutes {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
    background-color: var(--bg-color);
    border-radius: 8px;
}

footer {
    text-align: center;
    margin-top: 60px;
    padding: 20px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

.spinner {
    border: 3px solid var(--border-color);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

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

    .header-content {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .timestamp-display {
        width: 100%;
    }

    header h1 {
        font-size: 1.8rem;
    }

    header .subtitle {
        font-size: 1rem;
    }

    .search-box {
        flex-direction: column;
    }

    .btn-primary {
        width: 100%;
    }

    .results-container {
        grid-template-columns: 1fr;
    }

    .modal-content {
        width: 95%;
        margin: 10% auto;
        padding: 20px;
    }

    .item-title {
        font-size: 1.4rem;
    }

    .item-info {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    header {
        padding: 20px 15px;
    }

    header h1 {
        font-size: 1.5rem;
    }

    .result-card {
        padding: 15px;
    }

    .modal-content {
        padding: 15px;
    }
}
