/* Main stylesheet that imports all modular CSS files */

@import 'base/variables.css';
@import 'base/reset.css';
@import 'base/typography.css';
@import 'base/layout.css';
@import 'components/buttons.css';
@import 'components/forms.css';
@import 'components/tabs.css';
@import 'components/nav.css';
@import 'components/cards.css';
@import 'components/product-cards.css';
@import 'components/pagination.css';
@import 'components/cart.css';
@import 'components/modals.css';
@import 'components/scanner.css';
@import 'utils/utilities.css';
@import 'utils/responsive.css';

/* Add these CSS rules at the end of your stylesheet */

/* Ensure free products container is visible when it has items */
#free-products-container:not(.hidden) {
  display: block !important; /* Force display */
  visibility: visible !important;
  opacity: 1 !important;
}

/* Fix for free products visibility */
#free-products-grid {
  min-height: 50px;
}

/* Same for paid products container */
#paid-products-container:not(.hidden) {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

/* Fix for hidden products container - more specific selector */
.products-container:not(.hidden) {
  display: block !important;
}

/* Make sure product grids are visible */
.products-grid {
  min-height: 100px; /* Ensure grid has height */
}

/* Ensure section is visible */
#products-section:not(.hidden) {
  display: block !important;
}

/* Additional dark theme specific improvements */

/* Add subtle glow to primary actions in dark mode */
.dark-theme .primary-button {
    box-shadow: 0 2px 8px rgba(124, 125, 255, 0.25);
}

.dark-theme .primary-button:hover {
    box-shadow: 0 2px 12px rgba(124, 125, 255, 0.4);
}

/* Improve modal contrast */
.dark-theme .modal {
    backdrop-filter: blur(4px);
}

.dark-theme .modal-content {
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35), 0 0 0 1px var(--border);
}

/* Improve product cards */
.dark-theme .product-card {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

/* Remove or override the transform hover effect on product cards */
.dark-theme .product-card:hover {
    transform: none; /* Remove the translateY hover effect */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(124, 125, 255, 0.2);
    /* Keep the shadow for distinction but remove the movement */
}

/* Improve dark mode inputs */
.dark-theme input, 
.dark-theme select, 
.dark-theme textarea {
    background-color: #1a1e2e;
    color: var(--foreground);
    border-color: var(--input-border);
}

.dark-theme input:focus, 
.dark-theme select:focus, 
.dark-theme textarea:focus {
    box-shadow: 0 0 0 2px rgba(124, 125, 255, 0.3);
    border-color: var(--primary);
}

/* Improve visibility of search controls in dark mode */
.dark-theme .search-controls {
    background-color: #1e2130;
    border: 1px solid #353a54;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Improve scan info cards */
.dark-theme .scan-info-card {
    background-color: #1a1e2e;
    border: 1px solid #353a54;
    transition: all 0.3s ease;
}

.dark-theme .scan-info-card:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Improve active tab appearance */
.dark-theme .tab.active .tab-content {
    background-color: var(--primary);
    box-shadow: 0 2px 8px rgba(124, 125, 255, 0.3);
}

/* Improve toggle button appearance */
.dark-theme #theme-toggle-btn {
    color: #ffcc66;
}

.dark-theme #theme-toggle-btn:hover {
    color: #ffd580;
    background-color: rgba(255, 204, 102, 0.1);
}

/* Add subtle gradient to cart button */
.dark-theme .floating-cart-button {
    background: linear-gradient(135deg, #7c7dff 0%, #6366f1 100%);
    box-shadow: 0 4px 12px rgba(124, 125, 255, 0.3);
}

.dark-theme .floating-cart-button:hover {
    background: linear-gradient(135deg, #9e9eff 0%, #818cf8 100%);
    box-shadow: 0 6px 16px rgba(124, 125, 255, 0.4);
}

/* Improved dark mode scrollbars */
.dark-theme ::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.dark-theme ::-webkit-scrollbar-track {
    background: #1a1e2e;
}

.dark-theme ::-webkit-scrollbar-thumb {
    background: #353a54;
    border-radius: 5px;
}

.dark-theme ::-webkit-scrollbar-thumb:hover {
    background: #454c6e;
}

/* Improve dark mode icons */
.dark-theme .scan-info h3 i,
.dark-theme .action-button i,
.dark-theme .control-button i {
    color: var(--primary);
}

/* Smooth theme transition for all elements */
* {
    transition: background-color 0.3s ease, 
                color 0.3s ease, 
                border-color 0.3s ease, 
                box-shadow 0.3s ease;
}

/* Improve heading colors for dark mode */
.dark-theme h1, 
.dark-theme h2, 
.dark-theme h3, 
.dark-theme .section-title,
.dark-theme .page-title {
    color: var(--primary-foreground);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Specific styling for main section headers */
.dark-theme .scanner-title,
.dark-theme #products-section h2,
.dark-theme #free-products-container h2,
.dark-theme #paid-products-container h2 {
    color: var(--primary);
    font-weight: 600;
}

/* For "Shopify Store Scanner" main title */
.dark-theme .main-title, 
.dark-theme .app-title,
.dark-theme header h1 {
    background: linear-gradient(135deg, #9e9eff 0%, #7c7dff 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    font-weight: 700;
    text-shadow: none;
}

/* For section headers ("Free Products", "Paid Products") */
.dark-theme .products-heading,
.dark-theme .section-heading {
    color: #adb5bd;
    font-weight: 600;
    letter-spacing: 0.02em;
}

/* Make active/selected text more prominent */
.dark-theme .active-heading,
.dark-theme .selected-title {
    color: var(--primary);
    font-weight: 700;
}

/* Additional text color adjustments for dark theme */

/* Fix Scan Information card text colors */
.dark-theme .scan-info-card p,
.dark-theme .scan-info-card .info-text,
.dark-theme .scan-info-card .card-content,
.dark-theme .scan-info-card .scan-details,
.dark-theme .scan-info-card .info-value {
    color: var(--primary-foreground);
}

.dark-theme .scan-info-card .info-label,
.dark-theme .scan-info-card .label-text {
    color: var(--muted);
}

/* Make dropdown three dots white instead of black */
.dark-theme .dropdown-toggle,
.dark-theme .menu-toggle,
.dark-theme .tab-dropdown,
.dark-theme .options-menu-button,
.dark-theme .three-dots-menu {
    color: var(--primary-foreground);
}

.dark-theme .dropdown-toggle:hover,
.dark-theme .menu-toggle:hover,
.dark-theme .tab-dropdown:hover,
.dark-theme .options-menu-button:hover,
.dark-theme .three-dots-menu:hover {
    color: var(--primary);
}

/* Fix product card text colors to match dropdown text */
.dark-theme .product-card .product-title,
.dark-theme .product-card .product-name {
    color: var(--primary-foreground);
}

.dark-theme .product-card .product-description,
.dark-theme .product-card .product-detail,
.dark-theme .product-card .product-meta,
.dark-theme .product-card p {
    color: var(--muted);
}

.dark-theme .product-card .product-price {
    color: var(--primary);
    font-weight: 600;
}

/* Ensure all dropdown text is consistent */
.dark-theme .dropdown-menu,
.dark-theme .dropdown-item,
.dark-theme .menu-item {
    color: var(--primary-foreground);
}

/* Make sure all important content is visible */
.dark-theme .content-text,
.dark-theme .description-text,
.dark-theme .important-info {
    color: var(--primary-foreground);
}

/* Fix cart preview text colors in dark mode */
.dark-theme .cart-preview,
.dark-theme .cart-dropdown,
.dark-theme .floating-cart {
    color: var(--primary-foreground);
}

.dark-theme .cart-item,
.dark-theme .cart-product-name,
.dark-theme .cart-product-title,
.dark-theme .cart-total,
.dark-theme .cart-subtotal,
.dark-theme .cart-quantity {
    color: var(--primary-foreground);
}

.dark-theme .cart-item-price,
.dark-theme .cart-price {
    color: var(--primary);
    font-weight: 600;
}

.dark-theme .cart-meta,
.dark-theme .cart-item-metadata,
.dark-theme .cart-options {
    color: var(--muted);
}

.dark-theme .empty-cart-message {
    color: var(--muted);
}

.dark-theme .cart-header,
.dark-theme .cart-footer {
    border-color: var(--border);
}

/* Comprehensive fix for all grey text in dark mode */
.dark-theme p,
.dark-theme span,
.dark-theme div,
.dark-theme li,
.dark-theme small {
    color: var(--foreground);
}

/* Fix form labels and helper text */
.dark-theme label,
.dark-theme .form-label,
.dark-theme .helper-text,
.dark-theme .input-hint {
    color: var(--muted);
}

/* Fix placeholders */
.dark-theme ::placeholder {
    color: var(--muted);
    opacity: 0.7;
}

/* Fix breadcrumb and navigation text */
.dark-theme .breadcrumb,
.dark-theme .breadcrumb-item,
.dark-theme .nav-link:not(.active) {
    color: var(--muted);
}

.dark-theme .breadcrumb-item.active,
.dark-theme .nav-link.active {
    color: var(--primary);
}

/* Fix table text */
.dark-theme table,
.dark-theme th,
.dark-theme td {
    color: var(--foreground);
    border-color: var(--border);
}

.dark-theme thead th {
    color: var(--primary-foreground);
    background-color: var(--secondary);
}

.dark-theme .table-striped tr:nth-child(even) {
    background-color: rgba(0, 0, 0, 0.1);
}

/* Fix notification and alert text */
.dark-theme .notification,
.dark-theme .alert {
    color: var(--primary-foreground);
}

/* Fix status indicators */
.dark-theme .status-indicator,
.dark-theme .badge {
    color: var(--primary-foreground);
}

/* Fix dropdown arrow colors in dark mode */
.dark-theme select,
.dark-theme .custom-select,
.dark-theme .select-wrapper,
.dark-theme .filter-dropdown,
.dark-theme .price-filter,
.dark-theme .sort-dropdown {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 12px;
}

/* Ensure dropdown arrows in filter controls are visible */
.dark-theme .filter-control::after,
.dark-theme .dropdown-toggle::after,
.dark-theme .select-arrow::after {
    border-color: var(--foreground) transparent transparent;
}

/* Additional fix for SVG arrows if used */
.dark-theme .arrow-icon svg,
.dark-theme .dropdown-icon svg,
.dark-theme .select-icon svg {
    fill: var(--foreground);
    stroke: var(--foreground);
}

/* Fix any icon-based arrows */
.dark-theme .dropdown-icon,
.dark-theme .select-icon,
.dark-theme .filter-icon {
    color: var(--foreground);
}

/* Fix out-of-stock text visibility in dark mode */
.dark-theme .out-of-stock,
.dark-theme .product-unavailable,
.dark-theme .stock-status-out,
.dark-theme .sold-out,
.dark-theme option[disabled],
.dark-theme .disabled-option,
.dark-theme .unavailable-option {
    color: var(--out-of-stock) !important; /* Use the out-of-stock red color from variables */
    opacity: 0.9 !important; /* Ensure it's not faded out too much */
    text-decoration: line-through; /* Add strikethrough to indicate unavailability */
}

/* Ensure dropdown items with out-of-stock status are visible */
.dark-theme select option[disabled],
.dark-theme .dropdown-menu .disabled,
.dark-theme .select-option.unavailable {
    background-color: rgba(255, 126, 134, 0.15); /* Slight red background tint */
    color: var(--out-of-stock) !important;
    font-style: italic; /* Additional visual distinction */
}

/* Make sure no text in dropdowns blends with background */
.dark-theme select option,
.dark-theme .dropdown-menu .dropdown-item,
.dark-theme .select-option {
    color: var(--foreground);
    background-color: var(--card-background);
}

/* History Page Styles */

.history-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.history-item {
    background-color: var(--card-background);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: var(--card-shadow);
    transition: all 0.2s ease;
}

.history-item:hover {
    box-shadow: var(--card-shadow-hover);
}

.history-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.history-store-name {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
}

.history-timestamp {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.history-item-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.history-item-stats {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.stat-group {
    display: flex;
    gap: 1.5rem;
}

.stat {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.stat-value {
    font-size: 1.1rem;
    font-weight: 600;
}

.history-url {
    font-size: 0.9rem;
    color: var(--text-secondary);
    word-break: break-all;
    margin-top: 0.5rem;
}

.history-item-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-xl) var(--space-lg);
    text-align: center;
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: var(--space-md);
    color: var (--text-secondary);
}

/* Additional History Page Styling */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.section-actions {
    display: flex;
    gap: 0.75rem;
}

.history-item {
    background-color: var(--card-background);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: 0 2px 5px var(--card-shadow);
    margin-bottom: 1.5rem;
    transition: all 0.2s ease;
    border: 1px solid var(--border);
}

.history-item:hover {
    box-shadow: 0 4px 12px var(--shadow);
    border-color: var(--primary);
}

.history-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.5rem;
}

.history-store-name {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--foreground);
}

.history-timestamp {
    font-size: 0.85rem;
    color: var(--muted);
}

.history-item-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.history-item-stats {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.stat-group {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.stat {
    display: flex;
    flex-direction: column;
    min-width: 80px;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--muted);
}

.stat-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--foreground);
}

.history-url {
    font-size: 0.9rem;
    color: var(--muted);
    word-break: break-all;
    margin-top: 0.5rem;
}

.history-item-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-xl) var(--space-lg);
    text-align: center;
    background-color: var(--card-background);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin: var(--space-xl) 0;
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: var(--space-md);
    color: var(--muted);
}

.active-section {
    display: block;
}

.icon-button {
    background: transparent;
    border: none;
    font-size: 1.2rem;
    padding: var(--space-sm);
    cursor: pointer;
    color: var(--foreground);
    border-radius: var(--radius);
    transition: background-color 0.2s ease, color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.icon-button:hover {
    background-color: var(--secondary-hover);
    color: var(--primary);
    text-decoration: none;  /* Add this line to prevent underline on hover */
}

/* Dark theme specific adjustments for history */
.dark-theme .history-item {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.dark-theme .history-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
    border-color: var(--primary);
}

.dark-theme .empty-state {
    background-color: var(--card-background);
    border-color: var(--border);
}

.dark-theme .history-store-name,
.dark-theme .stat-value {
    color: var(--primary-foreground);
}

.dark-theme .stat-label,
.dark-theme .history-timestamp,
.dark-theme .history-url {
    color: var(--muted);
}

/* Responsive adjustments for history page */
@media (max-width: 768px) {
    .history-item {
        padding: 1rem;
    }
    
    .stat-group {
        gap: 1rem;
    }
    
    .history-item-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .history-item-actions button {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .section-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .stat-group {
        flex-direction: column;
        gap: 0.5rem;
    }
}

/* Header layout handled in base/layout.css and utils/responsive.css */
