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

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #8b5cf6;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --dark: #1f2937;
    --gray: #6b7280;
    --light: #f3f4f6;
    --white: #ffffff;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--dark);
    background: var(--light);
}

/* Header */
header {
    background: var(--white);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

nav {
    max-width: 1280px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo a {
    font-size: 1.5rem;
    font-weight: bold;
    text-decoration: none;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

nav ul {
    display: flex;
    gap: 2rem;
    list-style: none;
}

nav ul li a {
    text-decoration: none;
    color: var(--dark);
    transition: color 0.3s;
}

nav ul li a:hover {
    color: var(--primary);
}

.logout-btn {
    color: var(--danger);
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: var(--white);
    padding: 4rem 2rem;
    text-align: center;
}

.hero-content h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.hero-content p {
    font-size: 1.25rem;
    margin-bottom: 2rem;
    opacity: 0.9;
}

/* Buttons */
.btn, .btn-primary, .btn-small {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    text-decoration: none;
    transition: all 0.3s;
    cursor: pointer;
    border: none;
    font-size: 1rem;
}

.btn-primary {
    background: var(--white);
    color: var(--primary);
    font-weight: 600;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
}

.btn {
    background: var(--light);
    color: var(--dark);
}

.btn:hover {
    background: var(--gray);
    color: var(--white);
}

.btn-small {
    padding: 0.4rem 0.8rem;
    font-size: 0.875rem;
    background: var(--primary);
    color: var(--white);
}

.btn-full {
    width: 100%;
    text-align: center;
}

/* Features */
.features {
    max-width: 1280px;
    margin: 4rem auto;
    padding: 0 2rem;
}

.features h2 {
    text-align: center;
    margin-bottom: 3rem;
    font-size: 2rem;
}

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

.feature {
    text-align: center;
    padding: 2rem;
    background: var(--white);
    border-radius: 1rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.feature-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.feature h3 {
    margin-bottom: 0.5rem;
}

/* Product Grid */
.popular {
    max-width: 1280px;
    margin: 4rem auto;
    padding: 0 2rem;
}

.popular h2 {
    text-align: center;
    margin-bottom: 3rem;
    font-size: 2rem;
}

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

.product-card {
    background: var(--white);
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: transform 0.3s, box-shadow 0.3s;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.15);
}

.product-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.product-card h3 {
    padding: 1rem 1rem 0.5rem;
    font-size: 1.25rem;
}

.product-card p {
    padding: 0 1rem;
    color: var(--gray);
    font-size: 0.875rem;
}

.price {
    padding: 0.5rem 1rem;
    font-size: 1.25rem;
    font-weight: bold;
    color: var(--primary);
}

.product-card .btn {
    margin: 1rem;
    display: inline-block;
}

/* Catalog Page */
.catalog-container {
    max-width: 1280px;
    margin: 2rem auto;
    padding: 0 2rem;
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 2rem;
}

.filters {
    background: var(--white);
    padding: 1.5rem;
    border-radius: 1rem;
    height: fit-content;
    position: sticky;
    top: 80px;
}

.filter-section {
    margin-bottom: 2rem;
}

.filter-section h3 {
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.search-form {
    display: flex;
    gap: 0.5rem;
}

.search-form input {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 0.5rem;
}

.category-list {
    list-style: none;
}

.category-list li {
    margin-bottom: 0.5rem;
}

.category-list a {
    text-decoration: none;
    color: var(--gray);
    transition: color 0.3s;
}

.category-list a:hover,
.category-list a.active {
    color: var(--primary);
}

.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: var(--light);
    border-radius: 9999px;
    text-decoration: none;
    font-size: 0.875rem;
    color: var(--gray);
    transition: all 0.3s;
}

.tag:hover,
.tag.active {
    background: var(--primary);
    color: var(--white);
}

.tag.clear {
    background: var(--danger);
    color: var(--white);
}

.products-content {
    background: var(--white);
    padding: 1.5rem;
    border-radius: 1rem;
}

.products-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--light);
}

.products-count {
    color: var(--gray);
}

.empty-catalog {
    text-align: center;
    padding: 4rem;
    color: var(--gray);
}

/* Product Page */
.product-page {
    max-width: 1280px;
    margin: 2rem auto;
    padding: 0 2rem;
}

.product-detail {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    background: var(--white);
    border-radius: 1rem;
    padding: 2rem;
}

.product-main-image {
    width: 100%;
    border-radius: 1rem;
}

.product-info h1 {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.product-tags {
    margin-bottom: 1rem;
}

.product-tags .tag {
    background: var(--light);
    margin-right: 0.5rem;
}

.product-description {
    margin: 1.5rem 0;
    line-height: 1.8;
}

.price-large {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary);
}

.old-price {
    text-decoration: line-through;
    color: var(--gray);
    font-size: 1rem;
}

.generate-form {
    margin-top: 2rem;
}

.upload-area {
    border: 2px dashed #ddd;
    border-radius: 1rem;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    margin-bottom: 1rem;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

.upload-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.upload-text {
    font-size: 1.1rem;
    color: var(--gray);
}

.upload-hint {
    font-size: 0.875rem;
    color: var(--gray);
    margin-top: 0.5rem;
}

.file-list {
    margin-top: 1rem;
}

.file-item {
    background: var(--light);
    padding: 0.5rem;
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
}

.btn-large {
    width: 100%;
    padding: 1rem;
    font-size: 1.1rem;
}

.auth-warning {
    background: #fef3c7;
    border-left: 4px solid var(--warning);
    padding: 1rem;
    border-radius: 0.5rem;
    margin-top: 1rem;
}

.auth-warning a {
    color: var(--warning);
}

.similar-products {
    margin-top: 3rem;
}

.similar-products h2 {
    margin-bottom: 1.5rem;
}

/* Auth Pages */
.auth-page {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    min-height: 100vh;
}

.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 200px);
    padding: 2rem;
}

.auth-box {
    background: var(--white);
    padding: 2rem;
    border-radius: 1rem;
    width: 100%;
    max-width: 450px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
}

.auth-box h1 {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--dark);
}

.auth-form .form-group {
    margin-bottom: 1.5rem;
}

.auth-form label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.auth-form input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 0.5rem;
    font-size: 1rem;
}

.auth-form input:focus {
    outline: none;
    border-color: var(--primary);
}

.auth-form small {
    display: block;
    margin-top: 0.25rem;
    color: var(--gray);
    font-size: 0.75rem;
}

.auth-links {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--light);
}

.auth-links a {
    color: var(--primary);
    text-decoration: none;
}

/* Cabinet */
.cabinet {
    max-width: 1280px;
    margin: 2rem auto;
    padding: 0 2rem;
}

.cabinet-header {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: var(--white);
    padding: 2rem;
    border-radius: 1rem;
    margin-bottom: 2rem;
}

.cabinet-header h1 {
    margin-bottom: 0.5rem;
}

.cabinet-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.cabinet-stats .stat {
    background: var(--white);
    padding: 1.5rem;
    border-radius: 1rem;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary);
}

.stat-label {
    color: var(--gray);
    margin-top: 0.5rem;
}

.cabinet-orders h2 {
    margin-bottom: 1.5rem;
}

.orders-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.order-card {
    background: var(--white);
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.order-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--light);
    margin-bottom: 1rem;
}

.order-id {
    font-weight: bold;
    font-size: 1.1rem;
}

.order-status {
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.875rem;
}

.status-pending { background: #fef3c7; color: #d97706; }
.status-processing { background: #dbeafe; color: #2563eb; }
.status-completed { background: #d1fae5; color: #059669; }
.status-failed { background: #fee2e2; color: #dc2626; }

.order-product {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.order-product-image {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 0.5rem;
}

.order-product-info h3 {
    margin-bottom: 0.25rem;
}

.order-price {
    font-weight: bold;
    color: var(--primary);
}

.order-results {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--light);
}

.result-images {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.result-image {
    position: relative;
}

.result-image img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 0.5rem;
}

.result-image .btn-small {
    position: absolute;
    bottom: 0.5rem;
    right: 0.5rem;
}

.expiry-info,
.expiry-warning {
    margin-top: 1rem;
    font-size: 0.875rem;
    padding: 0.5rem;
    border-radius: 0.5rem;
}

.expiry-info {
    background: var(--light);
    color: var(--gray);
}

.expiry-warning {
    background: #fee2e2;
    color: var(--danger);
}

.processing-info {
    text-align: center;
    padding: 2rem;
}

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

@keyframes spin {
    to { transform: rotate(360deg); }
}

.empty-orders {
    text-align: center;
    padding: 3rem;
    background: var(--white);
    border-radius: 1rem;
}

/* Footer */
footer {
    background: var(--dark);
    color: var(--white);
    margin-top: 4rem;
}

.footer-content {
    max-width: 1280px;
    margin: 0 auto;
    padding: 3rem 2rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.footer-section h4 {
    margin-bottom: 1rem;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 0.5rem;
}

.footer-section a {
    color: var(--gray);
    text-decoration: none;
}

.footer-section a:hover {
    color: var(--white);
}

.payment-icons span {
    display: inline-block;
    margin-right: 1rem;
    padding: 0.25rem 0.75rem;
    background: rgba(255,255,255,0.1);
    border-radius: 0.5rem;
}

.footer-bottom {
    text-align: center;
    padding: 1.5rem;
    border-top: 1px solid rgba(255,255,255,0.1);
    color: var(--gray);
    font-size: 0.875rem;
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
}

.alert.error {
    background: #fee2e2;
    color: #dc2626;
    border-left: 4px solid #dc2626;
}

.alert.success {
    background: #d1fae5;
    color: #059669;
    border-left: 4px solid #059669;
}

/* Responsive */
@media (max-width: 768px) {
    .mobile-menu-btn {
        display: block;
    }
    
    nav ul {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--white);
        flex-direction: column;
        padding: 1rem;
        gap: 1rem;
        box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    }
    
    nav ul.active {
        display: flex;
    }
    
    .hero-content h1 {
        font-size: 2rem;
    }
    
    .catalog-container {
        grid-template-columns: 1fr;
    }
    
    .filters {
        position: static;
    }
    
    .product-detail {
        grid-template-columns: 1fr;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
    }
}