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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1412E2 0%, #D800AB 20%, #FF0070 40%, #FF6C44 60%, #FFBA3A 80%, #F9F871 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
}

header {
    text-align: center;
    color: white;
    margin-bottom: 40px;
}

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

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

main {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
}

@media (min-width: 768px) {
    main {
        grid-template-columns: 1fr 2fr;
    }
}

.add-item-section,
.items-section {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.add-item-section h2,
.items-section h2 {
    background: linear-gradient(135deg, #1412E2 0%, #FF0070 50%, #FFBA3A 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 20px;
    font-size: 1.5rem;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: #FF0070;
}

.btn-add {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #1412E2 0%, #D800AB 25%, #FF0070 50%, #FF6C44 75%, #FFBA3A 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-add:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 0, 112, 0.4);
}

.btn-add:active {
    transform: translateY(0);
}

.items-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.empty-message {
    text-align: center;
    color: #999;
    padding: 40px 20px;
    font-style: italic;
}

.item-card {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    border-left: 4px solid #FF0070;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.item-card:hover {
    transform: translateX(5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.item-info {
    flex: 1;
}

.item-name {
    font-size: 1.2rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

.item-details {
    display: flex;
    gap: 20px;
    color: #666;
}

.store-name {
    font-weight: 500;
}

.item-price {
    color: #FF0070;
    font-weight: 700;
    font-size: 1.1rem;
}

.btn-remove {
    padding: 8px 16px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.2s, transform 0.2s;
}

.btn-remove:hover {
    background: #c82333;
    transform: scale(1.05);
}

.btn-remove:active {
    transform: scale(0.95);
}

.btn-add:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.stores-container {
    margin-top: 15px;
}

.stores-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
}

.store-card {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #FF6C44;
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s, background-color 0.2s;
    cursor: pointer;
}

.store-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(255, 108, 68, 0.3);
}

.store-card.selected {
    background: linear-gradient(135deg, rgba(212, 18, 226, 0.1) 0%, rgba(255, 0, 112, 0.1) 100%);
    border-left: 4px solid #FF0070;
    box-shadow: 0 3px 10px rgba(255, 0, 112, 0.3);
}

.store-checkbox-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    width: 100%;
}

.store-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #FF0070;
}

.store-card .store-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: #333;
}

/* Price Comparison Table */
.comparison-table-wrapper {
    overflow-x: auto;
    margin-top: 20px;
}

.comparison-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.comparison-table thead {
    background: linear-gradient(135deg, #1412E2 0%, #D800AB 25%, #FF0070 50%, #FF6C44 75%, #FFBA3A 100%);
    color: white;
}

.comparison-table th,
.comparison-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.comparison-table th {
    font-weight: 600;
    font-size: 0.95rem;
}

.comparison-table th.best-store {
    background: linear-gradient(135deg, #FF0070 0%, #FFBA3A 100%);
    position: relative;
}

.comparison-table th.best-store::after {
    content: '⭐';
    margin-left: 5px;
}

.comparison-table tbody tr:hover {
    background: #f8f9fa;
}

.comparison-table .item-name-cell {
    font-weight: 600;
    color: #333;
}

.comparison-table td.best-store {
    background: #d4edda;
    color: #155724;
    font-weight: 600;
}

.comparison-table .total-row {
    background: #f8f9fa;
    border-top: 2px solid #FF0070;
}

.comparison-table .total-row td {
    padding: 16px;
    font-size: 1.1rem;
    border-bottom: none;
}

.comparison-table .total-label {
    font-weight: 700;
    color: #333;
}

.comparison-table .best-total {
    background: linear-gradient(135deg, #FF0070 0%, #FFBA3A 100%);
    color: white;
    font-size: 1.2rem;
}

.best-store-banner {
    margin-top: 20px;
    padding: 15px 20px;
    background: linear-gradient(135deg, #FFBA3A 0%, #F9F871 100%);
    border-radius: 8px;
    text-align: center;
    font-size: 1.1rem;
    color: #333;
    box-shadow: 0 3px 10px rgba(255, 186, 58, 0.3);
}

.best-store-banner .trophy {
    font-size: 1.5rem;
    margin-right: 8px;
}

.best-store-banner strong {
    background: linear-gradient(135deg, #FF0070 0%, #FF6C44 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.price-disclaimer {
    margin-top: 15px;
    padding: 12px 15px;
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    border-radius: 6px;
    font-size: 0.9rem;
    color: #856404;
    text-align: left;
}

.price-disclaimer strong {
    color: #856404;
}

.price-cell {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.price-amount {
    font-size: 1rem;
    font-weight: 600;
}

.product-details {
    font-size: 0.75rem;
    color: #666;
    font-style: italic;
    line-height: 1.2;
}

.comparison-table td.best-store .product-details {
    color: #0d4721;
}

/* Product Link Styling */
.product-link {
    color: #1412E2;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s, text-decoration 0.2s;
    cursor: pointer;
}

.product-link:hover {
    color: #FF0070;
    text-decoration: underline;
}

.comparison-table td.best-store .product-link {
    color: #0d4721;
}

.comparison-table td.best-store .product-link:hover {
    color: #155724;
    text-decoration: underline;
}

@media (max-width: 768px) {
    .comparison-table th,
    .comparison-table td {
        padding: 8px 12px;
        font-size: 0.9rem;
    }

    .best-store-banner {
        font-size: 1rem;
        padding: 12px 15px;
    }

    .product-details {
        font-size: 0.7rem;
    }
}

/* Loading Animation */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.loading-overlay.active {
    display: flex;
}

.loading-content {
    background: white;
    padding: 40px 60px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    max-width: 400px;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    margin: 0 auto 20px;
    position: relative;
}

.loading-spinner::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #FF0070;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-text {
    font-size: 1.2rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
    background: linear-gradient(135deg, #1412E2 0%, #FF0070 50%, #FFBA3A 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.loading-subtext {
    font-size: 0.9rem;
    color: #666;
}

/* Animated dots for loading text */
.loading-dots::after {
    content: '';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% { content: ''; }
    40% { content: '.'; }
    60% { content: '..'; }
    80%, 100% { content: '...'; }
}

/* Shopping cart animation */
.cart-animation {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    position: relative;
}

.cart-animation::before {
    content: '🛒';
    font-size: 50px;
    position: absolute;
    animation: bounce 1s ease-in-out infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-15px); }
}

.progress-bar-container {
    width: 100%;
    height: 6px;
    background: #f0f0f0;
    border-radius: 10px;
    overflow: hidden;
    margin-top: 20px;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(135deg, #1412E2 0%, #D800AB 25%, #FF0070 50%, #FF6C44 75%, #FFBA3A 100%);
    border-radius: 10px;
    width: 0%;
    animation: progress 3s ease-in-out infinite;
}

@keyframes progress {
    0% { width: 0%; }
    50% { width: 70%; }
    100% { width: 100%; }
}
