:root {
    --primary-color: #00ff9d;
    --secondary-color: #00ccff;
    --background-color: #1a1a1a;
    --card-background: #2d2d2d;
    --text-color: #ffffff;
    --text-secondary: #b3b3b3;
    --border-color: #404040;
    --hover-color: #00ccff;
    --success-color: #00ff9d;
    --error-color: #ff4757;
    --warning-color: #ffa502;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    line-height: 1.6;
    margin: 0;
    padding: 20px;
    color: var(--text-color);
    background-color: var(--background-color);
    min-height: 100vh;
}

.container {
    background: var(--card-background);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    max-width: 1000px;
    margin: 0 auto;
    animation: fadeIn 0.5s ease-in;
}

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

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

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

@keyframes slideIn {
    from { transform: translateX(-100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Loading States */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--background-color);
}

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

.loading-text {
    color: var(--text-secondary);
    font-size: 1.1rem;
    text-align: center;
}

/* Error States */
.error-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--background-color);
    text-align: center;
    padding: 2rem;
}

.error-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.error-message {
    color: var(--error-color);
    font-size: 1.2rem;
    margin-bottom: 2rem;
    max-width: 500px;
}

.retry-button {
    background: var(--primary-color);
    color: var(--background-color);
    border: none;
    padding: 1rem 2rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.3s ease;
    font-family: inherit;
}

.retry-button:hover {
    background: var(--hover-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 255, 157, 0.2);
}

.error-text {
    color: var(--error-color);
    font-size: 0.85rem;
    margin-top: 0.5rem;
    animation: slideIn 0.3s ease-out;
}

h1 {
    color: var(--primary-color);
    margin-bottom: 2rem;
    text-align: center;
    font-size: 2rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 0 0 10px rgba(0, 255, 157, 0.3);
}

.form-group {
    margin-bottom: 2rem;
    position: relative;
}

label {
    display: block;
    margin-bottom: 0.75rem;
    font-weight: 500;
    color: var(--primary-color);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

select, input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    background-color: var(--background-color);
    color: var(--text-color);
    font-family: inherit;
    transition: all 0.3s ease;
}

select:focus, input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(0, 255, 157, 0.2);
}

input:disabled {
    background-color: #404040;
    color: #b3b3b3;
    cursor: not-allowed;
}

.help-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
    position: relative;
}

.help-trigger {
    color: var(--secondary-color);
    text-decoration: none;
    border-bottom: 1px dashed var(--secondary-color);
    cursor: help;
    transition: all 0.3s ease;
}

.help-trigger:hover {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.help-image-container {
    position: absolute;
    left: 0;
    top: 100%;
    z-index: 1000;
    display: none;
    margin-top: 0.5rem;
    background: var(--card-background);
    padding: 0.5rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    animation: fadeIn 0.3s ease-out;
}

.help-trigger:hover + .help-image-container {
    display: block;
}

.help-image {
    max-width: 100%;
    border-radius: 4px;
    display: block;
}

.result {
    margin-top: 2rem;
    padding: 1.5rem;
    background: var(--background-color);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    display: block;
}

.link-container {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 0.5rem;
}

.result a {
    color: var(--success-color);
    text-decoration: none;
    word-break: break-all;
    font-family: monospace;
    font-size: 0.8rem;
    padding: 0.5rem;
    background: rgba(0, 255, 157, 0.1);
    border-radius: 4px;
    flex: 1;
    transition: all 0.3s ease;
}

.result a:hover {
    background: rgba(0, 255, 157, 0.2);
}

.copy-button {
    background: var(--primary-color);
    color: var(--background-color);
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.3s ease;
    font-family: inherit;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}

.copy-button:hover {
    background: var(--hover-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 255, 157, 0.2);
}

.copy-button:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 255, 157, 0.5);
}

.copy-button.copied {
    background: var(--success-color);
    animation: pulse 0.6s ease-in-out;
}

.copy-button.copied::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    animation: shimmer 0.6s ease-in-out;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

.brand-logo {
    text-align: center;
    margin-bottom: 2rem;
    padding: 1rem;
    background: var(--background-color);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    animation: fadeIn 0.5s ease-in;
}

.brand-logo img {
    height: 40px;
    width: auto;
    margin-bottom: 0.5rem;
    filter: brightness(0) invert(1);
    transition: all 0.3s ease;
}

.brand-logo img:hover {
    transform: scale(1.05);
}

.brand-logo span {
    display: block;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

#brandInput {
    display: none;
}

#brandInput.visible {
    display: block;
}

#brandInput input {
    font-family: monospace;
    letter-spacing: 0.5px;
}

.brand-selector,
.brand-input {
    display: none;
}

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

.product-item {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    background: var(--background-color);
    position: relative;
    overflow: hidden;
}

.product-item:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(0, 255, 157, 0.3);
}

.product-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary-color);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.product-item:hover {
    transform: translateY(-2px);
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(0, 255, 157, 0.1);
}

.product-item:hover::before {
    transform: scaleX(1);
}

.product-item.selected {
    border-color: var(--primary-color);
    background-color: rgba(0, 255, 157, 0.05);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 255, 157, 0.2);
}

.product-item.selected::before {
    transform: scaleX(1);
}

.product-item.selected::after {
    content: '✓';
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: var(--primary-color);
    color: var(--background-color);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: bold;
    animation: fadeIn 0.3s ease-in;
}

.product-item img {
    width: 80px;
    height: 80px;
    object-fit: contain;
    margin-bottom: 1rem;
    filter: drop-shadow(0 0 8px rgba(0, 255, 157, 0.2));
    background: var(--card-background);
    padding: 0.5rem;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.product-item:hover img {
    transform: scale(1.1);
    filter: drop-shadow(0 0 12px rgba(0, 255, 157, 0.4));
}

.product-item .product-name {
    font-weight: 600;
    margin: 0.75rem 0;
    color: var(--primary-color);
    transition: all 0.3s ease;
}

.product-item:hover .product-name {
    color: var(--hover-color);
}

.product-item .product-description {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.4;
}

.generate-button {
    display: none;
}

.footer {
    text-align: center;
    margin-top: 2rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .container {
        padding: 1rem;
    }
    
    .product-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .product-item {
        padding: 1rem;
    }
    
    .product-item img {
        width: 60px;
        height: 60px;
    }
    
    h1 {
        font-size: 1.5rem;
    }
    
    .link-container {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .copy-button {
        width: 100%;
        margin-top: 0.5rem;
    }
    
    .help-image-container {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        max-width: 90vw;
        max-height: 90vh;
        z-index: 9999;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0.5rem;
        margin: 0.5rem;
    }
    
    .product-grid {
        gap: 0.5rem;
    }
    
    .form-group {
        margin-bottom: 1rem;
    }
    
    h1 {
        font-size: 1.2rem;
        margin-bottom: 1rem;
    }
}

/* Touch device improvements */
@media (hover: none) and (pointer: coarse) {
    .product-item:hover {
        transform: none;
    }
    
    .product-item:active {
        transform: scale(0.98);
    }
    
    .copy-button:hover {
        transform: none;
    }
    
    .copy-button:active {
        transform: scale(0.95);
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --border-color: #ffffff;
        --text-secondary: #ffffff;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
