:root {
    --primary-color: #007bff;
    --primary-dark: #0056b3;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --white: #ffffff;
    --gray-100: #f8f9fa;
    --gray-200: #e9ecef;
    --gray-300: #dee2e6;
    --gray-400: #ced4da;
    --gray-500: #adb5bd;
    --gray-600: #6c757d;
    --gray-700: #495057;
    --gray-800: #343a40;
    --gray-900: #212529;
    --font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    --border-radius: 8px;
    --box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

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

body {
    font-family: var(--font-family);
    line-height: 1.6;
    color: var(--gray-800);
    background-color: var(--gray-100);
}

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

/* Header */
header {
    background: var(--white);
    box-shadow: var(--box-shadow);
    padding: 15px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

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

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
    text-decoration: none;
}

.search-form {
    display: flex;
    width: 400px;
}

.search-form input {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius) 0 0 var(--border-radius);
    font-size: 1rem;
}

.search-form button {
    padding: 10px 20px;
    background: var(--primary-color);
    color: var(--white);
    border: none;
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
    cursor: pointer;
    font-size: 1rem;
}

.search-form button:hover {
    background: var(--primary-dark);
}

/* Main Content */
main {
    padding: 30px 0;
}

/* Flash Messages */
.flash {
    padding: 12px 15px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    font-weight: 500;
}

.flash.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.flash.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.flash.warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

/* Filters */
.filters {
    background: var(--white);
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    margin-bottom: 30px;
}

.filters form {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.filter-group {
    flex: 1;
    min-width: 150px;
}

.filter-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: var(--gray-700);
}

.filter-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius);
    font-size: 1rem;
    background: var(--white);
}

/* Products Grid */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
}

.product-card {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    overflow: hidden;
    transition: var(--transition);
}

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

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

.product-image.placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gray-200);
    color: var(--gray-500);
    font-style: italic;
}

.product-info {
    padding: 20px;
}

.product-code {
    display: inline-block;
    background: var(--primary-color);
    color: var(--white);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: bold;
    margin-bottom: 10px;
}

.product-name {
    font-size: 1.1rem;
    margin-bottom: 10px;
    color: var(--gray-800);
    line-height: 1.4;
}

.product-discount {
    display: inline-block;
    background: var(--danger-color);
    color: var(--white);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: bold;
    margin-bottom: 10px;
}

.product-price {
    margin-bottom: 15px;
}

.original-price {
    text-decoration: line-through;
    color: var(--gray-500);
    font-size: 0.9rem;
    margin-right: 8px;
}

.current-price {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--danger-color);
}

.product-meta {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.platform, .category, .rating, .sales {
    font-size: 0.85rem;
    color: var(--gray-600);
}

.platform {
    background: var(--gray-200);
    padding: 2px 8px;
    border-radius: 4px;
}

.affiliate-link {
    display: block;
    text-align: center;
    background: var(--primary-color);
    color: var(--white);
    padding: 10px;
    border-radius: var(--border-radius);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
}

.affiliate-link:hover {
    background: var(--primary-dark);
}

/* Product Detail */
.product-detail {
    display: flex;
    gap: 40px;
    background: var(--white);
    padding: 30px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

.product-detail-image {
    flex: 1;
}

.product-detail-image img {
    width: 100%;
    border-radius: var(--border-radius);
}

.product-detail-info {
    flex: 1;
}

.product-detail-info h1 {
    font-size: 1.8rem;
    margin-bottom: 20px;
    color: var(--gray-800);
}

.product-description {
    margin: 30px 0;
    padding: 20px;
    background: var(--gray-100);
    border-radius: var(--border-radius);
}

.product-description h3 {
    margin-bottom: 10px;
    color: var(--gray-700);
}

.affiliate-button {
    display: block;
    width: 100%;
    text-align: center;
    background: var(--success-color);
    color: var(--white);
    padding: 15px;
    border-radius: var(--border-radius);
    text-decoration: none;
    font-weight: bold;
    font-size: 1.1rem;
    transition: var(--transition);
}

.affiliate-button:hover {
    background: #218838;
}

.back-link {
    margin-top: 30px;
}

.back-link a {
    color: var(--primary-color);
    text-decoration: none;
}

.back-link a:hover {
    text-decoration: underline;
}

/* Admin Panel */
.admin-section {
    background: var(--white);
    padding: 30px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    margin-bottom: 30px;
}

.admin-form .form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.admin-form .form-group {
    flex: 1;
    margin-bottom: 20px;
}

.admin-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--gray-700);
}

.admin-form input,
.admin-form select,
.admin-form textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-family: inherit;
}

.admin-form input:focus,
.admin-form select:focus,
.admin-form textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
}

.btn-primary {
    display: inline-block;
    background: var(--primary-color);
    color: var(--white);
    padding: 12px 24px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table th,
.admin-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}

.admin-table th {
    background: var(--gray-100);
    font-weight: 600;
    color: var(--gray-700);
}

.admin-table tr:hover {
    background: var(--gray-50);
}

.btn-small {
    display: inline-block;
    padding: 6px 12px;
    background: var(--secondary-color);
    color: var(--white);
    border-radius: 4px;
    text-decoration: none;
    font-size: 0.85rem;
    margin-right: 5px;
}

.btn-small:hover {
    background: #5a6268;
}

.btn-affiliate {
    background: var(--success-color);
}

.btn-affiliate:hover {
    background: #218838;
}

/* Login Page */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: var(--gray-100);
}

.login-form {
    background: var(--white);
    padding: 40px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    width: 100%;
    max-width: 400px;
}

.login-form h2 {
    text-align: center;
    margin-bottom: 30px;
    color: var(--gray-800);
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--gray-700);
}

.login-form input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius);
    font-size: 1rem;
}

.login-form button {
    width: 100%;
    padding: 12px;
    background: var(--primary-color);
    color: var(--white);
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.login-form button:hover {
    background: var(--primary-dark);
}

/* Responsive Design */
@media (max-width: 768px) {
    header .container {
        flex-direction: column;
        gap: 15px;
    }
    
    .search-form {
        width: 100%;
    }
    
    .filters form {
        flex-direction: column;
    }
    
    .product-grid {
        grid-template-columns: 1fr;
    }
    
    .product-detail {
        flex-direction: column;
    }
    
    .admin-form .form-row {
        flex-direction: column;
    }
    
    .admin-table {
        display: block;
        overflow-x: auto;
    }
}
