/* FormulaPrices.com - Enhanced Styles */
body {
    font-family: 'Segoe UI', Roboto, -apple-system, BlinkMacSystemFont, Arial, sans-serif;
    margin: 0;
    padding: 0;
    line-height: 1.6;
    color: #333;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    background-color: #f9f9fb;
}

header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eaeaea;
}

header h1 {
    margin-bottom: 8px;
    color: #2b6cb0;
    font-size: 2.5rem;
    letter-spacing: -0.5px;
}

header p {
    margin-top: 0;
    color: #718096;
    font-size: 1.1rem;
}

.tabs {
    display: flex;
    margin-bottom: 25px;
    border-bottom: none;
    width: 100%;
    gap: 10px;
}

.tab-button {
    flex: 1;
    padding: 14px 20px;
    background-color: white;
    border: none;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    border-radius: 8px;
    text-align: center;
    transition: all 0.2s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    color: #4a5568;
    border: 1px solid #edf2f7;
}

.tab-button.active {
    background-color: #3182ce;
    color: white;
    box-shadow: 0 4px 6px rgba(49, 130, 206, 0.1);
}

.tab-button:hover:not(.active) {
    background-color: #edf2f7;
    transform: translateY(-2px);
}

.tab-content {
    display: none;
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    padding: 20px;
    margin-bottom: 30px;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

/* Filters */
.filters {
    background-color: #f8fafc;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 25px;
    border: 1px solid #edf2f7;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: flex-end;
}

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

.filter-section label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #4a5568;
    font-size: 0.9rem;
}

.filter-section select,
.filter-section input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
    background-color: white;
}

.filter-section select:focus,
.filter-section input:focus {
    border-color: #3182ce;
    outline: none;
    box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.1);
}

.price-filter {
    flex: 2;
    min-width: 200px;
}

.price-inputs {
    display: flex;
    gap: 10px;
    align-items: center;
}

.price-inputs input {
    flex: 1;
}

.price-inputs span {
    color: #718096;
}

.filter-buttons {
    display: flex;
    gap: 10px;
    margin-left: auto;
}

.filter-buttons button {
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

#formula-filter-apply, #diapers-filter-apply {
    background-color: #3182ce;
    color: white;
}

#formula-filter-apply:hover, #diapers-filter-apply:hover {
    background-color: #2c5282;
}

#formula-filter-reset, #diapers-filter-reset {
    background-color: #e2e8f0;
    color: #4a5568;
}

#formula-filter-reset:hover, #diapers-filter-reset:hover {
    background-color: #cbd5e0;
}

/* Table styles */
.results {
    position: relative;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-bottom: 20px;
    background-color: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

th, td {
    padding: 14px 12px;
    text-align: left;
    border-bottom: 1px solid #edf2f7;
}

th {
    background-color: #f7fafc;
    font-weight: 600;
    color: #4a5568;
    cursor: pointer;
    position: relative;
    transition: background-color 0.15s;
    white-space: nowrap;
}

th:hover {
    background-color: #edf2f7;
}

td {
    color: #2d3748;
}

table tbody tr:hover {
    background-color: #f7fafc;
}

.sort-icon {
    font-size: 12px;
    margin-left: 5px;
    opacity: 0.5;
    display: inline-block;
    transition: opacity 0.2s;
}

th.sort-asc .sort-icon::after {
    content: "↑";
}

th.sort-desc .sort-icon::after {
    content: "↓";
}

th.sort-asc .sort-icon, th.sort-desc .sort-icon {
    opacity: 1;
}

.no-results, .loading {
    padding: 30px;
    text-align: center;
    color: #718096;
    font-size: 1.1rem;
}

/* Highlight for lowest price */
.lowest-price {
    background-color: #ebf8ff;
}

.lowest-price td:first-child {
    position: relative;
}

.lowest-price td:first-child::before {
    content: "BEST VALUE";
    position: absolute;
    top: -8px;
    left: 10px;
    background-color: #3182ce;
    color: white;
    font-size: 10px;
    padding: 3px 8px;
    border-radius: 3px;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Comparison Feature Styles */
.comparison-box {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: #2d3748;
    color: white;
    padding: 15px 20px;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
    z-index: 100;
    transition: all 0.3s ease;
}

.comparison-content {
    display: flex;
    align-items: center;
    gap: 15px;
}

#comparison-count {
    font-weight: bold;
    font-size: 1.2em;
}

#compare-button, #clear-comparison {
    padding: 8px 15px;
    border: none;
    border-radius: 5px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

#compare-button {
    background-color: #4299e1;
    color: white;
}

#compare-button:hover {
    background-color: #3182ce;
}

#compare-button:disabled {
    background-color: #a0aec0;
    cursor: not-allowed;
}

#clear-comparison {
    background-color: #718096;
    color: white;
}

#clear-comparison:hover {
    background-color: #4a5568;
}

.compare-cell {
    text-align: center;
}

.compare-label {
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.compare-checkbox {
    margin-right: 5px;
    width: 18px;
    height: 18px;
    accent-color: #3182ce;
}

/* Modal styles */
.modal {
    display: flex;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.75);
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.active {
    opacity: 1;
}

.modal-content {
    background-color: white;
    border-radius: 12px;
    width: 90%;
    max-width: 1000px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.modal.active .modal-content {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid #e2e8f0;
}

.modal-header h2 {
    margin: 0;
    color: #2d3748;
    font-size: 1.5rem;
}

.close {
    font-size: 28px;
    color: #a0aec0;
    cursor: pointer;
    transition: color 0.2s;
}

.close:hover {
    color: #2d3748;
}

.modal-body {
    padding: 25px;
}

.comparison-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.comparison-table th, 
.comparison-table td {
    padding: 12px 15px;
    border: 1px solid #e2e8f0;
}

.comparison-table th {
    background-color: #f7fafc;
    font-weight: 600;
    color: #4a5568;
}

.comparison-table tr:nth-child(even) {
    background-color: #f7fafc;
}

.hidden {
    display: none !important;
}

/* Price history chart styles */
.small-button {
    font-size: 0.8em;
    padding: 5px 10px;
    margin-top: 5px;
    background-color: #edf2f7;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    color: #4a5568;
}

.small-button:hover {
    background-color: #e2e8f0;
    color: #2d3748;
}

/* Footer styles */
footer {
    text-align: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eaeaea;
    color: #718096;
    font-size: 0.9rem;
}

/* Responsive styles */
@media (max-width: 768px) {
    .filters {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-section, .price-filter {
        width: 100%;
    }
    
    .filter-buttons {
        margin-left: 0;
        width: 100%;
    }
    
    th, td {
        padding: 10px 8px;
    }
    
    .tab-button {
        padding: 10px 15px;
        font-size: 14px;
    }
    
    header h1 {
        font-size: 2rem;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }
    
    .tab-content {
        padding: 15px 10px;
    }
    
    table {
        font-size: 13px;
    }
    
    th, td {
        padding: 8px 5px;
    }
    
    .comparison-box {
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        border-radius: 0;
    }
    
    .comparison-content {
        justify-content: center;
    }
}

/* Marketplace Selector Styles */
.marketplace-selector {
    background-color: white;
    border-radius: 10px;
    padding: 15px 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 15px;
}

.marketplace-select-label {
    font-weight: 600;
    color: #4a5568;
    font-size: 0.95rem;
    margin-right: 5px;
}

.marketplace-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    flex: 1;
}

.marketplace-option {
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.9rem;
    color: #4a5568;
    text-decoration: none;
    transition: all 0.2s;
    border: 1px solid #e2e8f0;
    white-space: nowrap;
}

.marketplace-option:hover {
    background-color: #edf2f7;
    color: #2d3748;
}

.marketplace-option.active {
    background-color: #ebf8ff;
    border-color: #bee3f8;
    color: #2b6cb0;
    font-weight: 600;
}

@media (max-width: 768px) {
    .marketplace-selector {
        padding: 12px 15px;
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .marketplace-options {
        width: 100%;
        justify-content: flex-start;
    }
}

@media (max-width: 480px) {
    .marketplace-option {
        padding: 6px 10px;
        font-size: 0.8rem;
    }
}

/* Add spacing between flag emoji and text */
.marketplace-option {
    display: flex;
    align-items: center;
    gap: 6px;
}
