/* Modern iHerb Price Tracker Styles */

/* CSS Variables */
[data-theme="light"], :root {
    /* Colors */
    --primary-color: #FF6B35;
    --primary-dark: #E85A2A;
    --secondary-color: #004E89;
    --accent-color: #F7931E;
    /* Brand CTA palette (logo light-orange matched) */
    --cta-100: #FFD1A3;   /* light peach for gradient start */
    --cta-400: #F79A2E;   /* mid */
    --cta-500: #F7931E;   /* brand accent (logo text) */
    --cta-600: #E98300;   /* hover/dark */
    --success-color: #10B981;
    --warning-color: #F59E0B;
    --danger-color: #EF4444;
    
    /* Neutrals */
    --text-primary: #1F2937;
    --text-secondary: #6B7280;
    --text-tertiary: #9CA3AF;
    --text-accent: #2563EB; /* calm blue for variant info */
    --bg-primary: #FFFFFF;
    --bg-secondary: #F9FAFB;
    --bg-tertiary: #F3F4F6;
    --border-color: #E5E7EB;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    
    /* Typography */
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-mono: 'SF Mono', Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
    
    /* Spacing */
    --container-max: 1280px;
    --header-height: 64px;
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 200ms ease;
    --transition-slow: 300ms ease;
}

/* Dark Mode Variables */
[data-theme="dark"] {
    --text-primary: #F9FAFB;
    --text-secondary: #D1D5DB;
    --text-tertiary: #9CA3AF;
    --bg-primary: #111827;
    --bg-secondary: #1F2937;
    --bg-tertiary: #374151;
    --border-color: #374151;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.6), 0 10px 10px -5px rgba(0, 0, 0, 0.5);
}

/* Stock Status Color Override for Dark Mode */
[data-theme="dark"] .stock-status.in-stock {
    background: rgba(16, 185, 129, 0.2) !important;
}

[data-theme="dark"] .stock-status.out-of-stock {
    background: rgba(239, 68, 68, 0.2) !important;
}

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    overflow-x: hidden;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.5;
    color: var(--text-primary);
    background-color: var(--bg-secondary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Header Styles */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-base);
}

.header-container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 24px;
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--text-primary);
}

.logo-img {
    height: 40px;
    width: auto;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
    max-width: 100%;
    object-fit: contain;
}

.logo svg {
    width: 40px;
    height: 40px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.logo-text {
    font-size: 20px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-link {
    padding: 8px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    transition: all var(--transition-fast);
}

.nav-link:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.nav-link.active {
    color: var(--primary-color);
    background: rgba(255, 107, 53, 0.1);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.theme-toggle {
    width: 40px;
    height: 40px;
    border: none;
    background: var(--bg-tertiary);
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.theme-toggle:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.sun-icon, .moon-icon {
    width: 20px;
    height: 20px;
}

[data-theme="light"] .moon-icon,
[data-theme="dark"] .sun-icon {
    display: none;
}

/* Container */
.container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 24px;
}

/* Hero Section */
.hero-section {
    padding: 48px 0;
    background: var(--bg-primary);
    margin-bottom: 48px;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border-bottom: 1px solid var(--border-color);
}

.hero-section::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(255, 107, 53, 0.1) 0%, transparent 70%);
    pointer-events: none;
}

.hero-content {
    position: relative;
    z-index: 1;
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 24px;
}

.hero-title {
    font-size: 48px;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 16px;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--primary-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    display: block;
    font-size: 20px;
    font-weight: 400;
    color: var(--text-secondary);
    margin-top: 8px;
}

/* Search Container */
.search-container {
    margin: 32px 0;
}

.search-box {
    position: relative;
    max-width: 600px;
    margin: 0 auto;
}

.search-input {
    width: 100%;
    height: 56px;
    padding: 0 140px 0 56px;
    font-size: 16px;
    border: 2px solid var(--border-color);
    border-radius: 16px;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: all var(--transition-base);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(255, 107, 53, 0.1);
}

.search-icon {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-tertiary);
    pointer-events: none;
}

.search-button {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    height: 40px;
    padding: 0 24px;
    background: var(--cta-500);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
}

.search-button:hover {
    background: var(--cta-600);
    transform: translateY(-50%) scale(1.05);
}

.search-filters {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 16px;
    flex-wrap: wrap;
}

.filter-chip {
    padding: 8px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.filter-chip:hover {
    background: var(--bg-secondary);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.filter-chip.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

/* Section Styles */
section {
    margin-bottom: 64px;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.section-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 12px;
}

.section-icon {
    color: var(--primary-color);
}

.section-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all var(--transition-fast);
}

.section-link:hover {
    gap: 8px;
}

/* Hot Deals Grid */
.hot-deals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
}

/* Product Card */
.product-card {
    background: var(--bg-primary);
    border-radius: 16px;
    overflow: hidden;
    transition: all var(--transition-base);
    cursor: pointer;
    position: relative;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: transparent;
}

/* .product-card.hot-deal 스타일 제거 - 빨간색 테두리 제거 */

.discount-flag {
    position: absolute;
    top: 12px;
    right: 12px;
    background: var(--danger-color);
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-weight: 600;
    z-index: 2;
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    gap: 4px;
}

.discount-percent {
    font-size: 14px;
    font-weight: 700;
}

.discount-label {
    font-size: 12px;
    display: inline;
    font-weight: 600;
}

.sale-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: var(--danger-color);
    color: white;
    padding: 4px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    z-index: 2;
}

.product-image {
    width: 100%;
    height: 200px;
    background: #FFFFFF !important;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 16px;
    transition: transform var(--transition-slow);
}

.product-card:hover .product-image img {
    transform: scale(1.1);
}

.no-image {
    color: var(--text-tertiary);
}

.product-content {
    padding: 20px;
    position: relative;
}

.product-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 20px;
    right: 20px;
    height: 1px;
    background: var(--border-color);
}

.product-brand {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.product-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
    overflow: hidden;
    display: -webkit-box;
    line-clamp: 2;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.4;
}

/* New: Variant line (form_and_quantity) */
.product-variant {
    font-size: 13px;
    color: var(--text-accent);
    margin-top: -6px;
    margin-bottom: 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.price-group {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 12px;
}

.original-price {
    font-size: 14px;
    color: var(--text-tertiary);
    text-decoration: line-through;
}

.current-price {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.product-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.stock-status {
    font-size: 12px;
    font-weight: 500;
    padding: 4px 12px;
    border-radius: 6px;
    display: inline-block;
}

/* In-stock status - Green */
.stock-status.in-stock {
    background: rgba(16, 185, 129, 0.1) !important;
    background-color: rgba(16, 185, 129, 0.1) !important;
    color: #10B981 !important;
}

/* Out-of-stock status - Red */
.stock-status.out-of-stock {
    background: rgba(239, 68, 68, 0.1) !important;
    background-color: rgba(239, 68, 68, 0.1) !important;
    color: #EF4444 !important;
}

.quick-view-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--bg-tertiary);
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.quick-view-btn:hover {
    background: var(--primary-color);
    color: white;
}

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

/* View Options */
.view-options {
    display: flex;
    gap: 4px;
    background: var(--bg-tertiary);
    padding: 4px;
    border-radius: 8px;
}

.view-option {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.view-option:hover {
    background: var(--bg-secondary);
}

.view-option.active {
    background: var(--bg-primary);
    color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

/* List View */
.products-grid.list-view {
    grid-template-columns: 1fr;
    gap: 8px;
}

.products-grid.list-view .product-card {
    display: flex;
    flex-direction: row;
    align-items: center; /* 수직 중앙 정렬 */
    height: auto;
    min-height: 88px;
}

.products-grid.list-view .product-image {
    width: 120px;
    height: 120px;
    flex-shrink: 0;
    display: flex; /* 컨테이너 자체를 중앙 정렬 */
    align-items: center; /* 수직 중앙 */
    justify-content: center; /* 수평 중앙 */
    padding: 8px; /* 내부 패딩은 컨테이너에 주고, 이미지는 패딩 제거 */
}

.products-grid.list-view .product-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 8px 12px;
    gap: 2px;
    min-width: 0;
}

/* 리스트뷰에서는 그리드용 상단 보더 숨김 */
.products-grid.list-view .product-content::before {
    display: none;
}

.products-grid.list-view .product-info {
    margin-bottom: 0;
}

.products-grid.list-view .product-name {
    display: block;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.2;
    margin-bottom: 2px;
    font-size: 14px;
}

/* 리스트뷰 이미지가 좌우로 치우치지 않도록 이미지 패딩 제거 및 최대 크기 제약 */
.products-grid.list-view .product-image img {
    padding: 0 !important;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.products-grid.list-view .product-variant {
    font-size: 12px;
    margin: 0 0 4px 0;
}

.products-grid.list-view .price-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.products-grid.list-view .product-brand {
    font-size: 11px;
    margin-bottom: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.products-grid.list-view .stock-status {
    font-size: 11px;
    padding: 2px 8px;
}

.products-grid.list-view .sale-badge{
    top: 4px;
    right: 4px;
    width: 48px;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 6px;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 48px;
}

.pagination button {
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-secondary);
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.pagination button:hover:not(:disabled) {
    background: var(--bg-tertiary);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.pagination button.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.page-info {
    padding: 0 16px;
    color: var(--text-secondary);
    font-size: 14px;
}

/* FAB (Floating Action Button) */
.fab-container {
    position: fixed;
    bottom: 32px;
    right: 32px;
    z-index: 50;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
    padding: 24px;
}

.modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--bg-primary);
    border-radius: 24px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: var(--shadow-xl);
    transform: scale(0.9);
    transition: transform var(--transition-base);
}

.modal.active .modal-content {
    transform: scale(1);
}

.modal-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-close {
    width: 40px;
    height: 40px;
    border: none;
    background: var(--bg-tertiary);
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
}

.modal-body p {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.monitor-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 14px;
}

.form-group input {
    height: 44px;
    padding: 0 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 16px;
    transition: all var(--transition-fast);
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

.submit-btn {
    height: 48px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    transition: all var(--transition-base);
    margin-top: 8px;
}

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

/* Footer */
.footer {
    background: var(--bg-primary);
    border-top: 1px solid var(--border-color);
    margin-top: 80px;
}

.footer-content {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 48px 24px 32px;
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 48px;
}

.footer-section h4 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.footer-section p {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 8px;
}

.footer-section a {
    display: block;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 4px 0;
    transition: color var(--transition-fast);
}

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

.footer-bottom {
    background: var(--bg-tertiary);
    padding: 24px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
}

.update-time {
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-tertiary);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .nav {
        display: none;
    }
    
    .hero-title {
        font-size: 36px;
    }
    
    .hot-deals-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        gap: 32px;
    }
}

@media (max-width: 768px) {
    .header-container {
        padding: 0 16px;
    }
    
    .container {
        padding: 0 16px;
    }
    
    .hero-section {
        padding: 32px 0;
        margin-bottom: 32px;
    }
    
    .hero-content {
        padding: 0 16px;
    }
    
    .hero-title {
        font-size: 28px;
    }
    
    .hero-subtitle {
        font-size: 16px;
    }
    
    .product-card {
        border-radius: 12px;
    }
    
    .product-content {
        padding: 12px;
    }
    
    .product-name {
        font-size: 14px;
    }
    
    .current-price {
        font-size: 16px;
    }
    
    .fab-container {
        bottom: 24px;
        right: 24px;
    }
    
    .fab {
        width: 48px;
        height: 48px;
    }
    
    /* 모바일에서도 작은 캡션 형태로 표시 */
    .fab-tooltip {
        right: 16px;
        bottom: 72px;
        font-size: 12px;
        padding: 6px 10px;
        opacity: 1;
        transform: translateY(0);
    }
    /* 모바일에서 화살표를 우측 하단으로 이동해 FAB과의 시각적 연결 강화 */
    .fab-tooltip::after { right: 12px; }
}

@media (max-width: 480px) {
    .logo-img {
        height: 32px;
    }
    
    .search-input {
        font-size: 14px;
        height: 48px;
        padding-right: 120px;
    }
    
    .search-button {
        font-size: 14px;
        padding: 0 16px;
    }
    
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .hot-deals-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

/* Loading States */
.skeleton {
    background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--bg-secondary) 50%, var(--bg-tertiary) 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Accessibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Focus Styles */
:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .header,
    .hero-section,
    .fab-container,
    .footer {
        display: none;
    }
    
    .product-card {
        break-inside: avoid;
    }
}

/* Dark Mode Product Image Background Override */
[data-theme="dark"] .product-image {
    background: #FFFFFF !important;
}

/* Ensure images maintain white background in both themes */
.no-image {
    background: #FFFFFF !important;
}

/* Scraping Dashboard Styles */
.data-reference-date {
    text-align: center;
    margin: 20px 0;
    padding: 15px;
    background-color: var(--bg-tertiary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.data-reference-date h2 {
    margin: 0;
    color: var(--text-secondary);
    font-size: 1.2rem;
}

.data-reference-date .date-value {
    color: var(--secondary-color);
    font-weight: bold;
}

/* Scraping Dashboard Specific Styles */
.back-link {
    margin-bottom: 20px;
}

.back-link a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: color var(--transition-fast);
}

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

.section {
    margin-bottom: 40px;
    padding: 24px;
    background: var(--bg-primary);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
}

.progress-container {
    margin-top: 20px;
}

.overall-progress h3 {
    margin-bottom: 10px;
    color: var(--text-primary);
}

.progress-bar {
    width: 100%;
    height: 24px;
    background-color: var(--bg-tertiary);
    border-radius: 12px;
    overflow: hidden;
    position: relative;
}

.progress-bar.small {
    height: 16px;
}

.progress-fill {
    height: 100%;
    background-color: var(--success-color);
    transition: width var(--transition-slow);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 500;
    font-size: 0.875rem;
}

.progress-fill.primary {
    background-color: var(--primary-color);
}

.progress-fill.warning {
    background-color: var(--warning-color);
}

.progress-fill.danger {
    background-color: var(--danger-color);
}

.progress-stats {
    margin-top: 8px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.iteration-progress {
    margin-top: 20px;
}

.iteration-item {
    margin-bottom: 20px;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.iteration-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.iteration-name {
    font-weight: 600;
    color: var(--text-primary);
}

.iteration-stats {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.iteration-details {
    margin-top: 10px;
    display: flex;
    gap: 10px;
}

.badge {
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 0.75rem;
    font-weight: 500;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.badge.success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

.badge.danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
}

.problem-urls-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 16px;
}

.problem-urls-table thead {
    background: var(--bg-tertiary);
}

.problem-urls-table th,
.problem-urls-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.problem-urls-table th {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.875rem;
    text-transform: uppercase;
}

.url-cell {
    max-width: 400px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.failure-count {
    color: var(--danger-color);
    font-weight: 600;
}

.error-log {
    padding: 16px;
    margin-bottom: 12px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    border-left: 4px solid var(--danger-color);
}

.error-url {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    word-break: break-all;
}

.error-message {
    color: var(--danger-color);
    margin-bottom: 8px;
}

.error-time {
    color: var(--text-tertiary);
    font-size: 0.875rem;
}

.no-data {
    text-align: center;
    padding: 40px;
    color: var(--text-tertiary);
    font-style: italic;
}

.timestamp {
    text-align: center;
    margin-top: 40px;
    padding: 20px;
    color: var(--text-tertiary);
    font-size: 0.875rem;
    border-top: 1px solid var(--border-color);
}

/* Chart Styles */
.chart-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 24px;
    margin-top: 24px;
}

@media (max-width: 768px) {
    .chart-grid {
        grid-template-columns: 1fr;
    }
}

.chart-container {
    position: relative;
    height: 300px;
    background: var(--bg-secondary);
    padding: 16px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.chart-container canvas {
    max-height: 100%;
}

/* 플로팅 액션 버튼 (FAB) */
.fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: var(--cta-500);
    color: #fff;
    border: none;
    box-shadow: 0 10px 24px rgba(247, 147, 30, 0.35);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform var(--transition-base), box-shadow var(--transition-base), background var(--transition-base);
    z-index: 100;
}

.fab:hover,
.fab:focus-visible {
    background: var(--cta-600);
    transform: translateY(-2px);
    box-shadow: 0 14px 28px rgba(247, 147, 30, 0.45);
}

.fab:active {
    transform: translateY(0);
}

.fab svg {
    width: 24px;
    height: 24px;
}

/* 툴팁 개선: 호버/포커스 시 노출, 화살표 추가 */
.fab-tooltip {
    /* 버튼 위쪽 위치 */
    position: fixed;
    right: 24px;
    bottom: 88px;
    transform: translateY(8px);
    background: #FFFFFF;
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 13px;
    line-height: 1;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    transition: opacity var(--transition-fast), transform var(--transition-fast);
}

.fab-tooltip::after {
    /* 툴팁 하단 우측의 아래 방향 화살표 (모든 레이아웃 공통) */
    content: '';
    position: absolute;
    right: 12px;
    bottom: -6px;
    width: 0; height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid #FFFFFF;
}

.fab:hover + .fab-tooltip,
.fab:focus-visible + .fab-tooltip {
    opacity: 1;
    transform: translateY(0);
}

/* Google Sheets 요청 모달 스타일 */
#requestModal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

#requestModal.modal-open {
    visibility: visible;
    opacity: 1;
}

#requestModal .modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

#requestModal .modal-content {
    position: relative;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    max-width: 480px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

#requestModal.modal-open .modal-content {
    transform: translateY(0);
}

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

#requestModal .modal-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #1f2937;
}

#requestModal .modal-close {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: #6b7280;
    border-radius: 6px;
    transition: all 0.2s;
}

#requestModal .modal-close:hover {
    background: #f3f4f6;
    color: #374151;
}

#requestModal .modal-close svg {
    width: 20px;
    height: 20px;
}

#requestModal .modal-body {
    padding: 24px;
}

#requestModal .modal-description {
    margin: 0 0 24px;
    color: #6b7280;
    line-height: 1.6;
}

/* 폼 스타일 */
#productRequestForm .form-group {
    margin-bottom: 20px;
}

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

#productRequestForm .form-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.2s;
}

#productRequestForm .form-input:focus {
    outline: none;
    border-color: #458847;
    box-shadow: 0 0 0 3px rgba(69, 136, 71, 0.1);
}

#productRequestForm .form-input:invalid:not(:placeholder-shown) {
    border-color: #ef4444;
}

#productRequestForm .form-hint {
    display: block;
    margin-top: 6px;
    font-size: 14px;
    color: #9ca3af;
}

#productRequestForm .form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
}

/* 추가 버튼 스타일 */
#productRequestForm .btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

#productRequestForm .btn-primary {
    background: var(--cta-500);
    color: #ffffff;
}

#productRequestForm .btn-primary:hover:not(:disabled) {
    background: var(--cta-600);
}

#productRequestForm .btn-primary:disabled {
    background: #9ca3af;
    cursor: not-allowed;
}

#productRequestForm .btn-secondary {
    background: #f3f4f6;
    color: #374151;
}

#productRequestForm .btn-secondary:hover {
    background: #e5e7eb;
}

/* 로딩 스피너 */
.btn-loading {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.spinner {
    animation: spin 1s linear infinite;
}

.spinner-circle {
    stroke: white;
    stroke-linecap: round;
    stroke-dasharray: 40;
    stroke-dashoffset: 40;
    animation: spinner-dash 1.5s ease-in-out infinite;
}

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

@keyframes spinner-dash {
    0% {
        stroke-dashoffset: 40;
    }
    50% {
        stroke-dashoffset: 10;
    }
    100% {
        stroke-dashoffset: 40;
    }
}

/* 결과 메시지 */
.request-result {
    margin-top: 20px;
    padding: 16px;
    border-radius: 8px;
    display: none;
    align-items: center;
    gap: 12px;
}

.request-result.success,
.request-result.error {
    display: flex;
}

.request-result.success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.request-result.error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.result-icon {
    flex-shrink: 0;
}

.result-message {
    flex: 1;
    font-size: 14px;
    line-height: 1.5;
}

/* 반응형 디자인 - 플로팅 버튼 */
@media (max-width: 640px) {
    .fab {
        bottom: 16px;
        right: 16px;
        width: 48px;
        height: 48px;
    }
    
    #requestModal {
        padding: 16px;
    }
    
    #requestModal .modal-content {
        max-height: 100vh;
        border-radius: 12px 12px 0 0;
    }
    
    #requestModal .modal-header,
    #requestModal .modal-body {
        padding: 20px;
    }
    
    #productRequestForm .form-actions {
        flex-direction: column-reverse;
    }
    
    #productRequestForm .btn {
        width: 100%;
        justify-content: center;
    }
}

/* 다크 모드 지원 - Google Sheets 모달 */
[data-theme="dark"] #requestModal .modal-content {
    background: #1f2937;
    color: #f3f4f6;
}

[data-theme="dark"] #requestModal .modal-header {
    border-bottom-color: #374151;
}

[data-theme="dark"] #requestModal .modal-header h3 {
    color: #f3f4f6;
}

[data-theme="dark"] #requestModal .modal-close {
    color: #9ca3af;
}

[data-theme="dark"] #requestModal .modal-close:hover {
    background: #374151;
    color: #e5e7eb;
}

[data-theme="dark"] #requestModal .modal-description {
    color: #d1d5db;
}

[data-theme="dark"] #productRequestForm .form-group label {
    color: #e5e7eb;
}

[data-theme="dark"] #productRequestForm .form-input {
    background: #374151;
    border-color: #4b5563;
    color: #f3f4f6;
}

[data-theme="dark"] #productRequestForm .form-input:focus {
    border-color: #458847;
}

[data-theme="dark"] #productRequestForm .form-hint {
    color: #9ca3af;
}

[data-theme="dark"] #productRequestForm .btn-secondary {
    background: #374151;
    color: #e5e7eb;
}

[data-theme="dark"] #productRequestForm .btn-secondary:hover {
    background: #4b5563;
}
