/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans TC', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #e4e5e8 0%, #b0b2b8 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

/* Header */
header {
    background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
    color: white;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.header-content h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.beta-badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: 0.65rem;
    font-weight: 600;
    background: linear-gradient(135deg, #1e40af, #3b82f6);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    letter-spacing: 0.5px;
    color: #ffffff;
    box-shadow: 0 2px 4px rgba(30, 64, 175, 0.3);
}

.header-content p {
    font-size: 0.95rem;
    opacity: 0.9;
}

.auth-section {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px; /* 預留登入按鈕空間，避免載入時位移 */
}

.auth-btn {
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.5);
    background: rgba(255,255,255,0.15);
    color: white;
    cursor: pointer;
}

.auth-btn.primary {
    background: white;
    color: #3b82f6;
    border-color: white;
}

.auth-btn.start-using {
    background: rgba(59, 130, 246, 0.7);
    color: white;
    border-color: rgba(59, 130, 246, 0.9);
}

.auth-btn.start-using:hover {
    background: rgba(59, 130, 246, 0.85);
}

.auth-btn.secondary {
    background: transparent;
}

.user-photo {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid rgba(255,255,255,0.6);
    margin-right: 6px;
}

#user-info {
    /* display 由 JavaScript 控制，不使用 !important 以免覆蓋 display: none */
    align-items: center;
    gap: 8px;
}

#user-info[style*="inline-flex"] {
    display: inline-flex;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 8px;
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-bottom: 20px;
}

/* Subtitle structure */
#subtitle .slogan,
#subtitle .separator,
#subtitle .tool-info {
    display: inline;
}

/* Announcement Bar */
.announcement-bar {
    background: linear-gradient(135deg, #1e3a8a 0%, #1d4ed8 100%);
    padding: 8px 16px;
    margin-top: 8px;
    margin-bottom: 16px;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.announcement-content {
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 100%;
}

.announcement-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    color: #e0f2fe;
}

.announcement-text-wrapper {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.announcement-text {
    color: #e0f2fe;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 400;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: opacity 0.3s ease;
}

.announcement-text:hover {
    opacity: 0.8;
    text-decoration: underline;
}

.announcement-text.no-link {
    cursor: default;
}

.announcement-text.no-link:hover {
    opacity: 1;
    text-decoration: none;
}

.announcement-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.announcement-indicator {
    display: none;
}

.announcement-btn {
    background: none;
    border: none;
    color: #cbd5e1;
    font-size: 1rem;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 3px;
    transition: all 0.2s ease;
    line-height: 1;
    opacity: 0.8;
}

.announcement-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    opacity: 1;
}

#announcement-close {
    display: none;
}

/* Fade animation */
.announcement-text.fade-out {
    opacity: 0;
}

.announcement-text.fade-in {
    opacity: 1;
}

/* Announcement Modal */
.announcement-modal-content {
    max-width: 500px;
}

.announcement-modal-close {
    font-size: 32px;
    padding: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
    transition: color 0.2s;
}

.announcement-modal-close:hover {
    color: #6b7280;
}

.announcement-modal-content .modal-body {
    padding: 20px;
    font-size: 0.95rem;
    line-height: 1.6;
    color: #374151;
    word-wrap: break-word;
}

.announcement-modal-content .modal-body strong {
    font-weight: 600;
    color: #1f2937;
}

.announcement-modal-content .modal-body ul,
.announcement-modal-content .modal-body ol {
    margin: 8px 0;
    padding-left: 24px;
}

.announcement-modal-content .modal-body li {
    margin: 4px 0;
}

.announcement-modal-content .modal-body p {
    margin: 8px 0;
}

.announcement-modal-content .modal-body a {
    color: #2563eb;
    text-decoration: underline;
}

.announcement-modal-content .modal-footer {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding: 16px 20px;
    border-top: 1px solid #e5e7eb;
}

.btn-primary {
    background: linear-gradient(135deg, #1e40af, #3b82f6);
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: opacity 0.2s;
}

.btn-primary:hover {
    opacity: 0.9;
}

.btn-secondary {
    background: #f3f4f6;
    color: #374151;
    padding: 10px 20px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-secondary:hover {
    background: #e5e7eb;
}

/* Supported cards */
.cards-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.cards-header p {
    font-size: 0.9rem;
    margin: 0;
    opacity: 0.8;
}

/* 行動支付區塊 */
.header-section {
    margin-top: 24px; /* 增加與上方信用卡區塊的間距 */
}

.section-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.section-title {
    font-size: 0.9rem;
    margin: 0;
    opacity: 0.8;
}

.manage-cards-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    padding: 6px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.manage-cards-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    transform: scale(1.05);
}

.card-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
}

.card-chip {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Payment chips section */
.payment-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    margin-bottom: 12px;
}

.payment-chip {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
    cursor: pointer;
    transition: all 0.2s;
}

.payment-chip:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.compare-payments-btn {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
    display: block;
    margin: 0 auto;
}

.compare-payments-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-1px);
}

/* Main content */
main {
    padding: 30px;
    box-shadow: 0 -4px 6px rgba(0, 0, 0, 0.05);
    min-height: 400px; /* 預留最小高度，避免內容載入時位移 */
}

/* Input section */
.input-section {
    margin-bottom: 30px;
}

.input-row-with-button {
    display: grid;
    grid-template-columns: 2fr 1fr auto;
    gap: 16px;
    margin-bottom: 16px;
    align-items: start; /* 顶部对齐，让输入框在同一高度 */
    overflow: hidden; /* 防止子元素撑大容器 */
}

.input-row-with-button > .form-group {
    min-width: 0; /* 允许 grid 子元素缩小 */
}

.button-group {
    display: flex;
    flex-direction: column;
}

.button-group label {
    margin-bottom: 8px;
    visibility: hidden;
}

.form-group {
    margin-bottom: 20px;
}

.form-group.compact {
    margin-bottom: 0;
    position: relative;
}

/* Quick Search Wrapper */
.quick-search-wrapper {
    position: relative;
    margin-top: 12px;
    width: 100%;
    max-width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Manage Quick Options Button */
.manage-quick-options-btn {
    flex-shrink: 0;
    background: transparent;
    border: 1px solid #9ca3af;
    border-radius: 6px;
    padding: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    color: #6b7280;
}

.manage-quick-options-btn:hover {
    background: #f3f4f6;
    border-color: #6b7280;
    color: #374151;
}

/* Quick Options Selection Modal */
/* Modal sections */
.modal-section {
    margin-bottom: 24px;
}

.modal-section h4 {
    font-size: 0.95rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 12px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.section-header h4 {
    margin-bottom: 0;
}

.link-btn {
    background: none;
    border: none;
    color: #3b82f6;
    font-size: 0.9rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.link-btn:hover {
    background: #eff6ff;
}

.hint-text {
    font-size: 0.85rem;
    color: #6b7280;
    margin-top: 8px;
    margin-bottom: 0;
}

/* Tag containers */
.selected-tags-container,
.available-tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 48px;
    padding: 12px;
    background: #f9fafb;
    border: 1px dashed #d1d5db;
    border-radius: 8px;
}

.selected-tags-container {
    background: #eff6ff;
    border-color: #bfdbfe;
}

.selected-tags-container:empty::before {
    content: '尚未選擇任何項目';
    color: #9ca3af;
    font-size: 0.9rem;
}

/* Tag items */
.tag-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    font-size: 0.85rem;
    cursor: grab;
    transition: all 0.2s ease;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    touch-action: none;
}

.tag-item:hover {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.tag-item.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.tag-icon {
    font-size: 1rem;
    line-height: 1;
}

.tag-name {
    font-weight: 500;
    color: #374151;
    font-size: 0.85rem;
}

.tag-remove-btn,
.tag-add-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    line-height: 1;
}

.tag-remove-btn {
    color: #ef4444;
    margin-left: 2px;
}

.tag-remove-btn:hover {
    background: #fee2e2;
}

.tag-add-btn {
    color: #10b981;
    margin-right: 2px;
}

.tag-add-btn:hover {
    background: #d1fae5;
}

/* Custom options */
.add-custom-btn {
    background: #f3f4f6;
    border: 1px dashed #9ca3af;
    color: #374151;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    text-align: left;
}

.add-custom-btn:hover {
    background: #e5e7eb;
    border-color: #6b7280;
}

.custom-options-list {
    margin-top: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.custom-option-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.custom-option-item:hover {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.custom-option-info {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
}

.custom-option-delete {
    background: none;
    border: none;
    color: #ef4444;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    line-height: 1;
    margin-left: 2px;
}

.custom-option-delete:hover {
    background: #fee2e2;
}

/* Custom option form */
.custom-option-form {
    margin-top: 16px;
    padding: 16px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
}

.custom-option-form h4 {
    font-size: 0.95rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 12px;
}

.custom-option-form .form-group {
    margin-bottom: 12px;
}

.custom-option-form label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: #4b5563;
    margin-bottom: 6px;
}

.custom-option-form input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.9rem;
}

.custom-option-form input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Emoji Picker */
.emoji-picker-container {
    display: flex;
    gap: 8px;
    align-items: center;
}

.selected-emoji {
    flex: 1;
    padding: 12px;
    border: 2px dashed #d1d5db;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    font-size: 2rem;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.selected-emoji:hover {
    border-color: #3b82f6;
    background: #f0f9ff;
}

.emoji-placeholder {
    color: #9ca3af;
    font-size: 0.9rem;
}

.clear-emoji-btn {
    padding: 8px 12px;
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.2s ease;
}

.clear-emoji-btn:hover {
    background: #dc2626;
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 8px;
    padding: 12px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    max-height: 200px;
    overflow-y: auto;
    margin-top: 8px;
}

.emoji-option {
    font-size: 1.5rem;
    padding: 8px;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease;
    text-align: center;
    background: white;
    border: 1px solid transparent;
}

.emoji-option:hover {
    background: #e0f2fe;
    border-color: #3b82f6;
    transform: scale(1.1);
}

.form-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

/* Quick Search Container */
.quick-search-container {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 4px 0 8px 0;
    flex: 1;
    min-width: 0;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 #f1f5f9;
    scroll-behavior: smooth;
}

.quick-search-container::-webkit-scrollbar {
    height: 6px;
}

.quick-search-container::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

.quick-search-container::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.quick-search-container::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Scroll Arrows */
.scroll-arrow {
    position: absolute;
    top: 4px;
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid #e5e7eb;
    border-radius: 50%;
    display: flex; /* 桌面版始终显示 */
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: all 0.2s ease;
    color: #6b7280;
    pointer-events: auto;
}

.scroll-arrow:hover:not(:disabled) {
    background: white;
    border-color: #3b82f6;
    color: #3b82f6;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.scroll-arrow:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

.scroll-arrow-left {
    left: 4px; /* 移動到container內部左邊緣 */
}

.scroll-arrow-right {
    right: 44px; /* container右邊緣（考慮manage按鈕32px + gap 8px） */
}

/* Hide arrows on mobile */
@media (max-width: 768px) {
    .scroll-arrow {
        display: none !important;
    }
}

.quick-search-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    color: #0369a1;
    border: 1px solid #bae6fd;
    border-radius: 16px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.quick-search-btn:hover {
    background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%);
    border-color: #7dd3fc;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(3, 105, 161, 0.1);
}

.quick-search-btn:active {
    transform: translateY(0);
    box-shadow: none;
}

.quick-search-btn .icon {
    font-size: 14px;
    line-height: 1;
}

/* Matched item row */
.matched-item-row {
    margin-top: 8px;
    margin-bottom: 16px;
    min-height: 24px;
}

label {
    display: block;
    margin-bottom: 14px;
    font-weight: 600;
    color: #374151;
}

input[type="text"],
input[type="number"] {
    width: 100%;
    padding: 16px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 16px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

/* Remove number input spinners */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="number"] {
    -moz-appearance: textfield;
}

input[type="text"]:focus,
input[type="number"]:focus {
    outline: none;
    border-color: #6bb6ff;
    box-shadow: 0 0 0 3px rgba(107, 182, 255, 0.1);
}

/* Matched item display */
.matched-item {
    margin-top: 0;
    padding: 6px 10px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    color: #64748b;
    font-size: 12px;
    display: inline-block;
}

.matched-item.no-match {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
}


/* Calculate button */
.calculate-btn {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.calculate-btn.compact {
    width: auto;
    padding: 12px 20px;
    font-size: 15px;
    border-radius: 10px;
    flex-shrink: 0;
    height: 53.5px;
}

.calculate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.3);
}

.calculate-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Results section */
.results-section {
    border-top: 1px solid #e5e7eb;
    padding-top: 20px;
}

.results-section h2 {
    margin-bottom: 16px;
    color: #111827;
    font-size: 1.5rem;
}

/* Merchant payment info */
.merchant-payment-info {
    background-color: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 10px 14px;
    margin-bottom: 16px;
    font-size: 0.75rem;
    color: #6b7280;
    line-height: 1.5;
}

.merchant-payment-title {
    font-weight: 500;
    color: #6b7280;
    margin-bottom: 6px;
}

.merchant-payment-item {
    margin-bottom: 4px;
}

.merchant-payment-item:last-child {
    margin-bottom: 0;
}

.merchant-payment-item .payment-label {
    font-weight: 500;
    color: #6b7280;
    margin-right: 4px;
}

/* Coupon results section */
.coupon-results-section {
    border-top: 1px solid #e5e7eb;
    padding-top: 20px;
    margin-top: 30px;
}

.coupon-results-section h2 {
    margin-bottom: 16px;
    color: #111827;
    font-size: 1.5rem;
}

.coupon-results-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 16px;
}

/* Coupon card styling */
.coupon-item {
    border: 1px solid #f59e0b;
    border-radius: 8px;
    padding: 16px;
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    transition: all 0.3s ease;
}

.coupon-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.2);
}

.coupon-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.coupon-merchant {
    font-size: 1.1rem;
    font-weight: 700;
    color: #92400e;
}

.coupon-rate {
    background: #f59e0b;
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
}

.coupon-details {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.coupon-detail-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 4px 0;
}

.coupon-detail-label {
    font-size: 13px;
    color: #92400e;
    font-weight: 500;
    min-width: 60px;
}

.coupon-detail-value {
    font-size: 13px;
    color: #451a03;
    text-align: right;
    flex: 1;
    margin-left: 8px;
}

.results-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 16px;
}

/* Card result styling */
.card-result {
    position: relative;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
    transition: all 0.3s ease;
}

.card-result.best-card {
    border-color: #10b981;
    background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}

.card-result.no-cashback {
    opacity: 0.6;
    background: #f9fafb;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2px;
}

.card-name-with-pin {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0; /* Allow shrinking */
    flex: 1; /* Take available space */
}

.card-name {
    font-size: 1.2rem;
    font-weight: 700;
    color: #111827;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.badges-container {
    display: flex;
    flex-direction: column; 
    gap: 6px; 
    align-items: flex-end;
    flex-shrink: 0;
}

.best-badge {
    background: #10b981;
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.card-details {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 8px;
}

.detail-item {
    display: flex;
    flex-direction: column;
}

.detail-label {
    font-size: 12px;
    color: #6b7280;
    font-weight: 500;
    text-transform: uppercase;
    margin-bottom: 2px;
}

.detail-value {
    font-size: 14px;
    font-weight: 600;
    color: #111827;
}

.cashback-amount {
    color: #10b981;
    font-size: 16px;
}

.no-cashback-text {
    color: #ef4444;
}

.cashback-type-label {
    font-size: 11px;
    color: #9ca3af;
    font-style: italic;
    margin-top: 2px;
    font-weight: normal;
}

.matched-merchant {
    margin-top: 6px;
    font-size: 12px;
    color: #6b7280;
}

.matched-merchant strong {
    color: #3b82f6;
}

/* No results styling */
.no-results {
    color: #374151;
    margin-bottom: 12px;
    font-size: 1.2rem;
}

.no-results p {
    margin-bottom: 8px;
    line-height: 1.5;
}

/* Responsive design */
@media (max-width: 640px) {
    body {
        padding: 10px;
    }
    
    main {
        padding: 20px;
    }
    
    header {
        padding: 15px;
    }
    
    .header-top {
        flex-direction: column;
        align-items: flex-start;
        text-align: left;
        gap: 12px;
        margin-bottom: 16px;
    }
    
    .header-content h1 {
        font-size: 1.8rem;
    }

    /* Mobile subtitle layout */
    #subtitle .slogan,
    #subtitle .tool-info {
        display: block;
    }

    #subtitle .separator {
        display: none;
    }

    #subtitle .slogan {
        font-size: 1.15rem;
    }

    #subtitle .tool-info {
        font-size: 0.85rem;
        font-weight: normal;
        font-style: italic;
        margin-top: 4px;
    }

    #subtitle .tool-info::before {
        content: "💳 ";
    }

    /* Announcement Bar Mobile */
    .announcement-bar {
        padding: 8px 12px;
        margin-top: 6px;
        margin-bottom: 12px;
    }

    .announcement-content {
        gap: 8px;
        align-items: flex-start;
    }

    .announcement-icon {
        width: 14px;
        height: 14px;
        margin-top: 2px;
    }

    .announcement-text {
        font-size: 0.9rem;
        white-space: normal;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        line-height: 1.4;
    }

    .announcement-controls {
        gap: 4px;
        align-self: flex-start;
        margin-top: 2px;
    }

    .announcement-indicator {
        font-size: 0.65rem;
        padding: 1px 4px;
    }

    .announcement-btn {
        font-size: 0.9rem;
        padding: 2px 4px;
    }

    #announcement-close {
        font-size: 1rem;
    }

    .auth-section {
        gap: 8px;
    }
    
    .auth-btn {
        padding: 6px 10px;
        font-size: 14px;
    }
    
    .input-row-with-button {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .button-group {
        margin-top: 0px;
    }

    .button-group label {
        margin-bottom: 0px;
        height: 0;
        line-height: 0;
    }
    
    .calculate-btn.compact {
        width: 100%;
    }
    
    .results-container {
        grid-template-columns: 1fr;
    }
    
    .coupon-results-container {
        grid-template-columns: 1fr;
    }
    
    .card-details {
        grid-template-columns: 1fr;
    }
    
    .card-chips {
        gap: 4px;
    }

    .card-chip {
        font-size: 0.7rem;
        padding: 3px 8px;
    }

    .cards-selection {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
    }

    .card-checkbox {
        padding: 8px;
        font-size: 12px;
    }
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e5e7eb;
}

.modal-header h3 {
    margin: 0;
    color: #111827;
    font-size: 1.25rem;
}

.close-modal {
    background: none;
    border: none;
    font-size: 24px;
    color: #6b7280;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-modal:hover {
    color: #374151;
}

.modal-body {
    padding: 20px;
}

.modal-controls {
    margin-bottom: 16px;
    display: flex;
    gap: 12px;
    align-items: center;
}

.search-modal-input {
    flex: 1;
    padding: 8px 12px;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s ease;
}

.search-modal-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.search-modal-input::placeholder {
    color: #9ca3af;
}

.toggle-all-btn {
    background: #e5e7eb;
    color: #6b7280;
    border: 1px solid #d1d5db;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.2s ease;
}

.toggle-all-btn:hover {
    background: #d1d5db;
    color: #374151;
}

.toggle-all-btn:active {
    transform: none;
}

/* Tag Filter Section */
.tag-filter-section {
    margin-bottom: 16px;
    padding: 12px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
}

.tag-filter-label {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
}

.tag-filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tag-filter-chip {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    opacity: 0.5;
}

.tag-filter-chip:hover {
    opacity: 0.75;
    transform: translateY(-1px);
}

.tag-filter-chip.active {
    opacity: 1;
    border-color: currentColor;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.modal-description {
    margin-bottom: 20px;
    color: #6b7280;
    font-size: 14px;
    line-height: 1.5;
}

.cards-selection {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 8px;
}

#payments-selection {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.card-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
}

.card-checkbox:hover {
    border-color: #6bb6ff;
    background: #f8fafc;
}

.card-checkbox.selected {
    border-color: #6bb6ff;
    background: #f0f9ff;
}

.card-checkbox input[type="checkbox"] {
    width: 14px;
    height: 14px;
    accent-color: #6bb6ff;
    flex-shrink: 0;
}

.card-checkbox-label {
    flex-grow: 1;
    font-weight: 400;
    color: #374151;
    font-size: 13px;
    line-height: 1.2;
}

.modal-footer {
    display: flex;
    gap: 12px;
    padding: 20px;
    border-top: 1px solid #e5e7eb;
    justify-content: flex-end;
}

.save-btn, .cancel-btn {
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.save-btn {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: white;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2);
}

.save-btn:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.3);
    transform: translateY(-1px);
}

.cancel-btn {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
}

.cancel-btn:hover {
    background: #e5e7eb;
}

/* Card Detail Modal Styles */
.card-detail-content {
    max-width: 700px;
    max-height: 90vh;
}

.card-info-section {
    margin-bottom: 24px;
    padding-bottom: 0;
    border-bottom: 1px solid #e5e7eb;
}

.card-info-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.card-info-section h4 {
    margin: 0 0 16px 0;
    color: #374151;
    font-size: 1.1rem;
    font-weight: 600;
}

.info-grid {
    display: grid;
    gap: 12px;
}

.info-grid-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.info-item-full {
    grid-column: 1 / -1;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.info-label {
    font-size: 13px;
    font-weight: 500;
    color: #6b7280;
    text-transform: uppercase;
}

.info-value {
    font-size: 14px;
    color: #374151;
    line-height: 1.4;
}

.info-value a {
    color: #3b82f6;
    text-decoration: none;
}

.info-value a:hover {
    text-decoration: underline;
}

/* Grid layout for payment detail modal on desktop */
#payment-cashback-details {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

@media (max-width: 768px) {
    #payment-cashback-details {
        grid-template-columns: 1fr;
    }
}

.cashback-detail-item {
    background: #f8fafc;
    border-radius: 6px;
    padding: 12px;
    border-left: 3px solid #3b82f6;
    margin-bottom: 12px;
}

.cashback-detail-item:last-child {
    margin-bottom: 0;
}

/* Best cashback style for payment detail items */
.cashback-detail-item.best-cashback {
    border-color: #10b981;
    background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}

.cashback-detail-item:last-child {
    margin-bottom: 0;
}

.cashback-rate {
    font-weight: 600;
    color: #059669;
    margin-bottom: 4px;
}

.cashback-condition {
    font-size: 11px;
    font-style: italic;
    color: #9ca3af;
    margin-bottom: 6px;
    padding-left: 0.5em;
}

.cashback-merchants {
    font-size: 12px; /* 縮小字體 */
    color: #6b7280; /* 降低顏色對比 */
    line-height: 1.6; /* 增加行高改善易讀性 */
    margin-top: 6px;
}

/* 適用通路標籤粗體 */
.cashback-merchants-label {
    font-weight: 600;
    color: #374151;
}

.show-more-btn {
    background: none;
    border: none;
    color: #3b82f6;
    cursor: pointer;
    font-size: 12px;
    padding: 2px 4px;
    margin-left: 5px;
    text-decoration: underline;
    transition: color 0.2s;
    font-weight: 500;
}

.show-more-btn:hover {
    color: #1d4ed8;
}

.show-more-btn:focus {
    outline: none;
    color: #1d4ed8;
}

/* User Notes Styles */
.user-notes-container {
    position: relative;
}

/* Fee Waiver Checkbox Styles */
.fee-waiver-status {
    margin-top: 4px; /* 減少頂部間距 */
}

.fee-waiver-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
    color: #6b7280;
    transition: color 0.2s;
    opacity: 0.8;
}

.fee-waiver-checkbox:hover {
    color: #374151;
    opacity: 1;
}

.fee-waiver-checkbox input[type="checkbox"] {
    display: none;
}

.checkmark {
    width: 16px;
    height: 16px;
    border: 2px solid #d1d5db;
    border-radius: 3px;
    position: relative;
    background: white;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.fee-waiver-checkbox:hover .checkmark {
    border-color: #3b82f6;
}

.fee-waiver-checkbox input:checked + .checkmark {
    background: #10b981;
    border-color: #10b981;
}

.fee-waiver-checkbox input:checked + .checkmark::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 1px;
    width: 4px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.checkbox-label {
    font-weight: 500;
    user-select: none;
}

/* Billing Dates Section Styles */
.billing-dates-section {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #f3f4f6;
    opacity: 0.9;
    transition: opacity 0.2s;
}

.billing-dates-section:hover {
    opacity: 1;
}

.billing-dates-title {
    margin: 0 0 12px 0;
    font-size: 13px;
    font-weight: 500;
    color: #6b7280;
    display: flex;
    align-items: center;
    gap: 6px;
}

.billing-dates-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.date-input-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.date-label {
    font-size: 12px;
    font-weight: 500;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.date-input-wrapper {
    display: flex;
    align-items: center;
    gap: 4px;
}

.date-input {
    width: 50px;
    padding: 6px 8px;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    background: #fafafa;
    transition: all 0.2s ease;
}

.date-input:hover {
    border-color: #d1d5db;
    background: white;
}

.date-input:focus {
    outline: none;
    border-color: #3b82f6;
    background: white;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.date-input:not(:placeholder-shown) {
    border-color: #10b981;
    background: white;
    font-weight: 600;
}

.date-input:invalid {
    border-color: #ef4444;
}

.date-input::placeholder {
    color: #9ca3af;
    font-weight: normal;
}

.date-suffix {
    font-size: 13px;
    color: #6b7280;
    font-weight: 500;
}

/* 響應式設計 */
@media (max-width: 480px) {
    .billing-dates-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

.user-notes-textarea {
    width: 100%;
    min-height: 60px; /* 縮小初始高度 */
    height: 60px; /* 設定預設高度 */
    max-height: 200px; /* 增加最大高度 */
    padding: 12px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    resize: vertical; /* 保持可拉伸功能 */
    transition: border-color 0.2s;
}

.user-notes-textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.user-notes-textarea::placeholder {
    color: #9ca3af;
}

.notes-status {
    margin-top: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.save-indicator {
    color: #059669;
    opacity: 0;
    transition: opacity 0.3s;
}

.save-indicator.show {
    opacity: 1;
}

.save-indicator.saving {
    color: #f59e0b;
    opacity: 1;
}

.save-indicator.error {
    color: #dc2626;
    opacity: 1;
}

.unsaved-indicator {
    color: #f59e0b;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 12px;
}

.save-notes-btn {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 100px;
    justify-content: center;
    margin-bottom: 16px;
}

.save-notes-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.save-notes-btn:active:not(:disabled) {
    transform: translateY(0);
}

.save-notes-btn:disabled {
    background: #e5e7eb;
    color: #9ca3af;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.save-notes-btn.saving {
    background: #f59e0b;
    cursor: wait;
}

.save-notes-btn.success {
    background: #10b981;
}

.btn-icon {
    font-size: 14px;
}

.btn-text {
    font-size: 13px;
}

.chip-clickable {
    cursor: pointer;
    transition: all 0.2s ease;
}

.chip-clickable:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Animation */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 新增的 UI 優化样式 */
/* 卡片全名粗體 - 藍色連結 */
.card-full-name-bold a {
    font-weight: 700 !important;
    color: #007bff !important;
    text-decoration: none;
}

.card-full-name-bold a:hover {
    text-decoration: underline;
}

/* 年費和免年費條件縮小文字 */
.info-value-small {
    font-size: 12px !important;
    color: #6b7280 !important;
    line-height: 1.3;
}

/* 調整日期輸入欄位大小 - 覆蓋原有样式 */
.date-input {
    width: 45px !important;
    min-width: 45px;
    padding: 5px 6px !important;
    font-size: 13px !important;
}

/* 內聯日期輸入樣式 */
.dates-inline-wrapper {
    display: flex;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
}

.date-input-inline {
    display: flex;
    align-items: center;
    gap: 4px;
}

.date-label-small {
    font-size: 12px;
    color: #6b7280;
    font-weight: 500;
    white-space: nowrap;
}

/* 年費和免年費條件繁直排列 */
.fee-annual-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.fee-annual-item, .fee-waiver-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* 筆記區域額外間距 */
.user-notes-section {
    margin-top: 16px !important; /* 縮小間距 */
    padding-top: 12px !important; /* 縮小內部間距 */
    padding-bottom: 0; /* 桌機版本移除底部內距 */
}

/* 國泰CUBE等級選擇器樣式 */
.cube-level-selector {
    background: #f8fafc;
    border-radius: 8px;
    padding: 16px;
    border: 1px solid #e5e7eb;
}

.level-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #374151;
    font-size: 14px;
}

.level-select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    background: white;
    color: #374151;
    font-weight: 500;
    transition: all 0.2s ease;
    cursor: pointer;
}

.level-select:hover {
    border-color: #6bb6ff;
}

.level-select:focus {
    outline: none;
    border-color: #6bb6ff;
    box-shadow: 0 0 0 3px rgba(107, 182, 255, 0.1);
}

.level-description {
    margin-top: 12px;
    padding: 12px;
    background: white;
    border-radius: 6px;
    border-left: 3px solid #3b82f6;
    font-size: 13px;
    line-height: 1.5;
    color: #4b5563;
    margin-bottom: 0;
}

.level-description small {
    color: #6b7280;
    font-size: 12px;
    font-weight: 500;
}

/* 修復信息網格佈局 */
.info-grid-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px 24px; /* 增加行間距讓視覺更舒適 */
    align-items: start; /* 確保所有項目從頂部對齊 */
}

/* 信息項目樣式 - 標題和內容上下排列 */
.info-item {
    display: flex;
    flex-direction: column;
    gap: 4px; /* 縮小標題和內容的間距 */
}

.info-label {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 4px;
}

.info-value {
    font-size: 14px;
    color: #111827;
    line-height: 1.4;
}

/* 空的占位元素 */
.empty-placeholder {
    display: none;
}

/* 年費訊息合併顯示 */
.fee-annual-section {
    display: flex;
    flex-direction: column;
    gap: 4px; /* 減少內部間距 */
}

.fee-combined-info {
    display: flex;
    flex-direction: column;
    gap: 0px; /* 減少內部間距 */
}

.fee-waiver-text {
    margin-top: 2px; /* 減少頂部間距 */
    font-style: italic;
}

.fee-waiver-text::before {
    content: '免年費條件: ';
    font-weight: 600;
    color: #374151;
    font-style: normal;
}

/* Card Tags Styles */
.card-tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 16px;
}

.card-tag {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
    opacity: 0.85;
    transition: opacity 0.2s;
}

.card-tag:hover {
    opacity: 1;
}

/* Tag color definitions - 按類別分組配色 */
/* 顏色1：旅遊、娛樂 - 淺藍色系 */
.card-tag.tag-travel { background: #dbeafe; color: #1e40af; }          /* 旅遊 */
.card-tag.tag-entertainment { background: #bfdbfe; color: #1e3a8a; }   /* 娛樂 */

/* 顏色2：開車族、交通 - 淺綠色系 */
.card-tag.tag-driving { background: #d1fae5; color: #065f46; }         /* 開車族 */
.card-tag.tag-transport { background: #a7f3d0; color: #064e3b; }       /* 交通 */

/* 顏色3：餐廳、外送、飲食品牌 - 淺橘色系 */
.card-tag.tag-restaurant { background: #fed7aa; color: #92400e; }      /* 餐廳 */
.card-tag.tag-delivery { background: #fdba74; color: #9a3412; }        /* 外送 */
.card-tag.tag-food-brand { background: #fde68a; color: #92400e; }      /* 飲食品牌 */

/* 顏色4：行動支付 - 淺紫色系 */
.card-tag.tag-payment { background: #ddd6fe; color: #5b21b6; }         /* 行動支付 */

/* 顏色5：便利商店、超市、生活百貨、網購、百貨公司、美妝美髮保養品牌 - 淺粉色系 */
.card-tag.tag-convenience { background: #fce7f3; color: #9f1239; }     /* 便利商店 */
.card-tag.tag-supermarket { background: #fbcfe8; color: #9f1239; }     /* 超市 */
.card-tag.tag-lifestyle { background: #f9a8d4; color: #831843; }       /* 生活百貨 */
.card-tag.tag-online { background: #fce7f3; color: #be185d; }          /* 網購 */
.card-tag.tag-department { background: #f9a8d4; color: #9d174d; }      /* 百貨公司 */
.card-tag.tag-beauty-brand { background: #fbcfe8; color: #be185d; }    /* 美妝美髮保養品牌 */

/* 顏色6：運動、寵物、親子、藥妝、時尚品牌 - 淺黃色系 */
.card-tag.tag-sports { background: #fef3c7; color: #92400e; }          /* 運動 */
.card-tag.tag-pet { background: #fde68a; color: #78350f; }             /* 寵物 */
.card-tag.tag-family { background: #fcd34d; color: #78350f; }          /* 親子 */
.card-tag.tag-pharmacy { background: #fef3c7; color: #854d0e; }        /* 藥妝 */
.card-tag.tag-fashion { background: #fde68a; color: #92400e; }         /* 時尚品牌 */

/* 顏色7：應用程式商店、AI工具、串流平台 - 淺紫靛色系 */
.card-tag.tag-appstore { background: #e0e7ff; color: #3730a3; }        /* 應用程式商店 */
.card-tag.tag-ai { background: #c7d2fe; color: #312e81; }              /* AI工具 */
.card-tag.tag-streaming { background: #a5b4fc; color: #312e81; }       /* 串流平台 */

/* 顏色8：保費 - 淺青色系 */
.card-tag.tag-insurance { background: #cffafe; color: #164e63; }       /* 保費 */

/* Input Guide Styles */
.help-btn {
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    margin-left: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    vertical-align: middle;
}

.help-btn:hover {
    background: #2563eb;
    transform: scale(1.1);
}

.input-guide {
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 8px;
    padding: 16px;
    margin: 12px 0;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.guide-header {
    color: #0369a1;
    margin-bottom: 12px;
    font-size: 15px;
}

.guide-intro {
    color: #0c4a6e;
    margin-bottom: 12px;
    font-size: 14px;
    line-height: 1.5;
}

.guide-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.guide-list li {
    color: #0c4a6e;
    font-size: 13px;
    line-height: 1.8;
    padding: 4px 0;
}

.guide-list li strong {
    color: #075985;
    font-weight: 600;
}

/* Social Media Footer Styles */
.social-media-footer {
    max-width: 800px;
    margin: 20px auto 10px;
    padding: 0 24px;
    text-align: center;
    min-height: 120px; /* 預留最小高度，避免內容載入時位移 */
}

.social-media-container {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    justify-content: center;
    gap: 48px;
}

.social-section,
.sponsor-section,
.review-section,
.faq-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.social-media-title {
    color: rgba(255, 255, 255, 0.7);
    font-size: 12px;
    font-weight: 500;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.social-media-links {
    display: flex;
    gap: 16px;
    align-items: center;
    justify-content: center;
}

.social-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    font-size: 13px;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.social-link:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.social-link.instagram:hover {
    background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
    border-color: transparent;
    color: white;
}

.social-link.sponsor:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: transparent;
    color: white;
}

.social-link.review:hover {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    border-color: transparent;
    color: white;
}

.social-link svg {
    width: 16px;
    height: 16px;
    transition: transform 0.3s ease;
}

.social-link:hover svg {
    transform: scale(1.1) rotate(5deg);
}

.social-link.sponsor:hover svg {
    transform: scale(1.2);
    animation: heartbeat 0.6s ease-in-out;
}

@keyframes heartbeat {
    0%, 100% { transform: scale(1.2); }
    50% { transform: scale(1.35); }
}

.social-text {
    font-weight: 500;
    font-size: 12px;
}

/* Mobile responsiveness for social media */
@media (max-width: 600px) {
    .social-media-footer {
        padding: 0 16px;
        margin: 16px auto 10px;
    }

    .social-media-container {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 20px 16px;
        justify-items: center;
    }

    .social-media-title {
        font-size: 10px;
    }

    .social-link {
        padding: 7px 10px;
        font-size: 12px;
        gap: 5px;
    }

    .social-link svg {
        width: 15px;
        height: 15px;
    }

    .social-text {
        font-size: 11px;
    }
}

/* Review Section Styles */
.review-feedback {
    color: rgba(255, 255, 255, 0.9);
    font-size: 13px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    backdrop-filter: blur(10px);
    animation: fadeIn 0.3s ease;
    margin-top: 8px;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Review Modal Styles */
.review-modal-content {
    max-width: 500px;
    width: 90%;
}

.star-rating-modal {
    display: flex;
    justify-content: center;
    gap: 8px;
    font-size: 48px;
    cursor: pointer;
    margin: 20px 0;
}

.star-modal {
    color: #e5e7eb;
    transition: all 0.2s ease;
    user-select: none;
    cursor: pointer;
}

.star-modal:hover,
.star-modal.hover {
    color: #fbbf24;
    transform: scale(1.1);
}

.star-modal.selected {
    color: #fbbf24;
}

#review-comment-section {
    margin-top: 20px;
}

.review-textarea {
    width: 100%;
    min-height: 120px;
    padding: 12px;
    border: 1px solid #dadce0;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.2s ease;
}

.review-textarea:focus {
    outline: none;
    border-color: #1a73e8;
    box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.1);
}

.review-char-count {
    text-align: right;
    font-size: 12px;
    color: #6b7280;
    margin-top: 4px;
    margin-bottom: 16px;
}

.review-modal-actions {
    display: flex;
    gap: 12px;
}

.review-modal-actions button {
    flex: 1;
}

.auth-btn.secondary {
    background: #f3f4f6;
    color: #374151;
}

.auth-btn.secondary:hover {
    background: #e5e7eb;
}

/* Mobile responsiveness for review section */
@media (max-width: 600px) {
    .star-rating-modal {
        font-size: 40px;
        gap: 4px;
    }

    .review-modal-content {
        width: 95%;
    }

    .review-modal-actions {
        flex-direction: column;
    }
}

/* Disclaimer Footer Styles - 白色可收合版本 */
.disclaimer-footer {
    max-width: 800px;
    margin: 20px auto;
    padding: 0 24px 24px;
    text-align: center;
    min-height: 60px; /* 預留最小高度，避免內容載入時位移 */
}

.disclaimer-toggle {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 11px;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 6px;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.disclaimer-toggle:hover {
    color: rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.1);
}

.toggle-icon {
    font-size: 10px;
    transition: transform 0.3s;
}

.disclaimer-toggle.active .toggle-icon {
    transform: rotate(180deg);
}

.disclaimer-content-wrapper {
    margin-top: 12px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    text-align: left;
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.disclaimer-section-title {
    color: rgba(255, 255, 255, 0.9);
    font-size: 11px;
    font-weight: 600;
    margin-top: 12px;
    margin-bottom: 6px;
}

.disclaimer-section-title:first-child {
    margin-top: 0;
}

.disclaimer-intro {
    color: rgba(255, 255, 255, 0.8);
    font-size: 10px;
    line-height: 1.6;
    margin-bottom: 8px;
}

.disclaimer-intro strong {
    color: rgba(255, 255, 255, 0.95);
    font-weight: 600;
}

.disclaimer-subsection-title {
    color: rgba(255, 255, 255, 0.85);
    font-size: 10px;
    font-weight: 600;
    margin-top: 10px;
    margin-bottom: 6px;
}

.disclaimer-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.2);
    margin: 14px 0;
}

.disclaimer-list {
    list-style: none;
    padding: 0;
    margin: 0 0 8px 0;
}

.disclaimer-list li {
    color: rgba(255, 255, 255, 0.7);
    padding: 2px 0;
    padding-left: 14px;
    position: relative;
    font-size: 10px;
    line-height: 1.6;
}

.disclaimer-list li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: rgba(255, 255, 255, 0.5);
}

.disclaimer-list li strong {
    color: rgba(255, 255, 255, 0.9);
    font-weight: 600;
}

.disclaimer-goal {
    color: rgba(255, 255, 255, 0.8);
    font-size: 10px;
    font-style: italic;
    margin-top: 10px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    border-left: 2px solid rgba(255, 255, 255, 0.3);
}

/* Mobile responsiveness for disclaimer */
@media (max-width: 600px) {
    .disclaimer-footer {
        padding: 0 16px 20px;
    }

    .disclaimer-toggle {
        font-size: 10px;
        padding: 6px 10px;
    }

    .disclaimer-content-wrapper {
        padding: 12px;
    }

    .disclaimer-section-title {
        font-size: 10px;
    }

    .disclaimer-intro {
        font-size: 9px;
    }

    .disclaimer-subsection-title {
        font-size: 9px;
    }

    .disclaimer-list li {
        font-size: 9px;
    }

    .disclaimer-goal {
        font-size: 9px;
        padding: 6px 10px;
    }
}

/* Compare Payments Modal Styles */
.compare-payments-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.compare-payment-card {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
}

.compare-payment-name {
    font-weight: 700;
    font-size: 1rem;
    color: #111827;
    margin-bottom: 8px;
}

/* Mobile responsiveness for compare payments */
@media (max-width: 640px) {
    .compare-payments-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

/* ============================================
   My Mappings (配卡表) Styles
   ============================================ */

/* Floating My Mappings Button */
.my-mappings-floating-btn {
    position: fixed;
    bottom: 72px;
    right: 16px;
    padding: 8px 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 6px;
    font-size: 0.75rem;
    color: white;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
    transition: all 0.2s ease;
    z-index: 999;
    display: flex;
    align-items: center;
    gap: 4px;
    overflow: visible;
}

.my-mappings-floating-btn:hover {
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.5);
    transform: translateY(-2px);
}

.my-mappings-floating-btn:active {
    transform: translateY(0) scale(0.98);
}

/* Pin Badge (+1 動畫) */
.pin-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #f59e0b;
    color: white;
    font-size: 0.7rem;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Pin Button on Card */
.pin-btn {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #d1d5db;
    transition: all 0.3s ease;
    padding: 0;
    flex-shrink: 0;
}

.pin-btn:hover {
    background: white;
    border-color: #667eea;
    color: #667eea;
    transform: scale(1.1);
}

.pin-btn.pinned {
    background: #fef3c7;
    border-color: #f59e0b;
    color: #f59e0b;
}

.pin-btn.pinned:hover {
    background: #fde68a;
    transform: scale(1.1);
}

/* Pin Toast (提示) */
.pin-toast {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(16, 185, 129, 0.95);
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.pin-toast.show {
    opacity: 1;
}

/* My Mappings Modal */
#my-mappings-modal .modal-content {
    max-width: 600px;
}

.mappings-search-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.875rem;
    transition: border-color 0.2s;
}

.mappings-search-input:focus {
    outline: none;
    border-color: #667eea;
}

.mappings-list {
    max-height: 500px;
    overflow-y: auto;
    margin-top: 16px;
}

/* Standard table layout with drag and drop */
.mappings-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    background: white;
    border-radius: 6px;
    overflow: hidden;
}

.mappings-table thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.mappings-table th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
}

.mappings-table th.drag-handle-header {
    width: 30px;
    padding: 12px 8px;
}

.mappings-table th.merchant-column {
    width: 120px;
}

.mappings-table th.card-name-column {
    width: 150px;
}

.mappings-table th.rate-column {
    width: 80px;
    text-align: right;
}

.mappings-table th.sortable {
    user-select: none;
    cursor: pointer;
    transition: background 0.2s;
}

.mappings-table th.sortable:hover {
    background: rgba(255, 255, 255, 0.1);
}

.mappings-table .sort-icon {
    margin-left: 4px;
    font-size: 12px;
    opacity: 0.5;
}

.mappings-table .sort-icon.active {
    opacity: 1;
    font-weight: bold;
}

.mappings-table th.delete-column {
    width: 50px;
    text-align: center;
}

.mappings-table tbody tr {
    border-bottom: 1px solid #e5e7eb;
    transition: background 0.2s;
}

.mappings-table tbody tr:hover {
    background: #f9fafb;
}

.mappings-table tbody tr:last-child {
    border-bottom: none;
}

.mappings-table td {
    padding: 12px;
}

.mappings-table td.drag-handle {
    cursor: grab;
    color: #9ca3af;
    padding: 12px 8px;
    text-align: center;
}

.mappings-table td.drag-handle:active {
    cursor: grabbing;
}

.mappings-table td.merchant-cell {
    font-weight: 500;
    color: #1f2937;
}

.mappings-table td.card-cell {
    color: #4b5563;
}

.mappings-table td.rate-cell {
    color: #10b981;
    font-weight: 600;
    text-align: right;
}

.mappings-table th.expiry-column {
    width: 100px;
    white-space: nowrap;
}

.mappings-table td.expiry-cell {
    color: #6b7280;
    font-size: 13px;
    white-space: nowrap;
}

.mappings-table td.expiry-cell.expired {
    color: #dc2626;
    font-weight: 500;
}

.mappings-table td.delete-cell {
    text-align: center;
}

/* Table wrapper for horizontal scrolling on mobile */
.mappings-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Show scrollbar on mobile/tablet */
@media (max-width: 1024px) {
    .mappings-table-wrapper {
        overflow-x: auto;
    }

    /* Make table minimum width to ensure horizontal scroll */
    .mappings-table {
        min-width: 650px;
    }

    /* Adjust column widths for mobile */
    .mappings-table th.merchant-column {
        width: 70px;
    }

    .mappings-table th.card-name-column {
        width: 70px;
    }

    .mappings-table th.rate-column {
        width: 40px;
    }

    .mappings-table th.expiry-column {
        width: 80px;
    }
}

/* Drag and drop states */
.mapping-row.dragging {
    opacity: 0.5;
    background: #f3f4f6;
}

.mapping-row.drag-over {
    background: #e0e7ff;
    border-top: 2px solid #667eea;
}

.mapping-delete-btn {
    background: none;
    border: none;
    color: #ef4444;
    cursor: pointer;
    font-size: 18px;
    padding: 4px 8px;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.mapping-delete-btn:hover {
    opacity: 1;
}

.mappings-empty {
    text-align: center;
    padding: 40px 20px;
    color: #9ca3af;
}

.mappings-empty svg {
    margin: 0 auto 16px;
    opacity: 0.5;
}

/* Mobile responsive styles for mappings table */
@media (max-width: 640px) {
    .mappings-table {
        font-size: 12px;
    }

    .mappings-table th {
        padding: 10px 6px;
        font-size: 11px;
    }

    .mappings-table td {
        padding: 10px 6px;
    }

    /* Reduce drag handle width on mobile */
    .mappings-table th.drag-handle-header {
        width: 24px;
        padding: 10px 4px;
    }

    .mappings-table td.drag-handle {
        padding: 10px 4px;
    }

    /* Reduce rate column width to give more space for card name */
    .mappings-table th.rate-column {
        width: 50px;
        font-size: 10px;
    }

    .mappings-table td.rate-cell {
        font-size: 12px;
    }

    /* Reduce delete column width */
    .mappings-table th.delete-column {
        width: 36px;
    }

    .mapping-delete-btn {
        font-size: 16px;
        padding: 2px 4px;
    }

    /* Ensure card names don't break awkwardly */
    .mappings-table td.card-cell {
        word-break: keep-all;
        overflow-wrap: break-word;
        line-height: 1.3;
    }

    /* Merchant cell optimization */
    .mappings-table td.merchant-cell {
        font-size: 12px;
    }
}

/* ============================================
   Feedback System Styles
   ============================================ */

/* Floating Feedback Button */
.feedback-floating-btn {
    position: fixed;
    bottom: 16px;
    right: 16px;
    padding: 8px 12px;
    background: rgba(107, 114, 128, 0.15);
    border: 1px solid rgba(107, 114, 128, 0.2);
    border-radius: 6px;
    font-size: 0.75rem;
    color: #6b7280;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
    z-index: 999;
    display: flex;
    align-items: center;
    gap: 4px;
    backdrop-filter: blur(8px);
}

.feedback-floating-btn:hover {
    background: rgba(107, 114, 128, 0.25);
    border-color: rgba(107, 114, 128, 0.3);
    color: #374151;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.feedback-floating-btn:active {
    transform: scale(0.98);
}

/* Feedback Modal Specific Styles */
#feedback-modal .modal-content {
    max-width: 600px;
}

#feedback-modal .modal-description {
    color: #6b7280;
    font-size: 0.875rem;
    margin-bottom: 20px;
    text-align: center;
}

/* Feedback Form */
.feedback-textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.875rem;
    resize: vertical;
    min-height: 100px;
    transition: border-color 0.2s;
}

.feedback-textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.feedback-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.875rem;
    transition: border-color 0.2s;
}

.feedback-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.required {
    color: #ef4444;
    font-weight: 700;
}

/* Image Upload Area */
.image-upload-area {
    border: 2px dashed #d1d5db;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    background: #f9fafb;
}

.image-upload-area:hover {
    border-color: #667eea;
    background: #f3f4f6;
}

.image-upload-area.drag-over {
    border-color: #667eea;
    background: #eef2ff;
}

.upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: #6b7280;
}

.upload-placeholder svg {
    opacity: 0.5;
}

.upload-placeholder p {
    margin: 0;
    font-size: 0.875rem;
}

.upload-hint {
    font-size: 0.75rem;
    color: #9ca3af;
}

/* Image Preview Container */
.image-preview-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 12px;
    margin-top: 12px;
}

.image-preview-container:empty {
    display: none;
}

.image-preview-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
    background: #f9fafb;
}

.image-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-preview-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    background: rgba(239, 68, 68, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: background 0.2s;
}

.image-preview-remove:hover {
    background: rgba(220, 38, 38, 1);
}

.image-size-warning {
    position: absolute;
    bottom: 4px;
    left: 4px;
    right: 4px;
    background: rgba(251, 191, 36, 0.9);
    color: #78350f;
    font-size: 0.625rem;
    padding: 2px 4px;
    border-radius: 4px;
    text-align: center;
}

/* Feedback Status Messages */
.feedback-status {
    margin-top: 12px;
    padding: 12px;
    border-radius: 8px;
    font-size: 0.875rem;
    display: none;
}

.feedback-status.success {
    display: block;
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #6ee7b7;
}

.feedback-status.error {
    display: block;
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.feedback-status.loading {
    display: block;
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #93c5fd;
}

/* Loading Spinner */
.loading-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid #93c5fd;
    border-top-color: #1e40af;
    border-radius: 50%;
    animation: spinner-rotate 0.6s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

@keyframes spinner-rotate {
    to {
        transform: rotate(360deg);
    }
}

/* Loading state for card count */
#card-count.loading {
    display: inline-block;
    animation: pulse-loading 1.5s ease-in-out infinite;
}

@keyframes pulse-loading {
    0%, 100% {
        opacity: 0.4;
    }
    50% {
        opacity: 1;
    }
}

/* Mobile Responsiveness */
@media (max-width: 640px) {
    .my-mappings-floating-btn {
        bottom: 72px;
        right: 16px;
        width: 48px;
        height: 48px;
        font-size: 24px;
        padding: 0;
        justify-content: center;
    }

    /* Hide text on mobile, only show icon */
    .my-mappings-floating-btn .btn-text {
        display: none;
    }

    .feedback-floating-btn {
        bottom: 16px;
        right: 16px;
        width: 48px;
        height: 48px;
        font-size: 24px;
        padding: 0;
        justify-content: center;
    }

    /* Hide text on mobile, only show icon */
    .feedback-floating-btn span:last-child {
        display: none;
    }

    .image-preview-container {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 8px;
    }

    #feedback-modal .modal-content {
        max-width: 95%;
        margin: 20px;
    }
}

/* ============================================
   Auth Modal Styles (Login/Register)
   ============================================ */

.auth-modal-content {
    max-width: 440px;
    width: 100%;
}

/* Google Sign In Button */
.auth-provider-btn {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #dadce0;
    border-radius: 4px;
    background: white;
    color: #3c4043;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    transition: all 0.2s ease;
    margin-bottom: 20px;
}

.auth-provider-btn:hover {
    background: #f8f9fa;
    border-color: #d2d3d5;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.auth-provider-btn:active {
    background: #f1f3f4;
}

/* Divider */
.auth-divider {
    display: flex;
    align-items: center;
    margin: 24px 0;
    color: #80868b;
    font-size: 14px;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #dadce0;
}

.auth-divider span {
    padding: 0 16px;
}

/* Form Styles */
.auth-input {
    width: 100%;
    padding: 12px;
    border: 1px solid #dadce0;
    border-radius: 4px;
    font-size: 14px;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.auth-input:focus {
    outline: none;
    border-color: #1a73e8;
    box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.1);
}

.auth-input::placeholder {
    color: #80868b;
}

#auth-form .form-group {
    margin-bottom: 16px;
}

#auth-form label {
    display: block;
    margin-bottom: 6px;
    color: #3c4043;
    font-size: 14px;
    font-weight: 500;
}

/* Error Message */
.auth-error {
    padding: 12px;
    background: #fce8e6;
    color: #c5221f;
    border-radius: 4px;
    font-size: 13px;
    margin-bottom: 16px;
}

/* Submit Button */
#auth-submit-btn {
    width: 100%;
    padding: 12px;
    margin-top: 8px;
}

.auth-btn.full-width {
    width: 100%;
}

/* Footer */
.auth-footer {
    margin-top: 24px;
    text-align: center;
    font-size: 14px;
    color: #5f6368;
}

.auth-footer a {
    color: #1a73e8;
    text-decoration: none;
    font-weight: 500;
}

.auth-footer a:hover {
    text-decoration: underline;
}

.auth-footer p {
    margin: 12px 0 0 0;
}

#forgot-password-link {
    display: inline-block;
    margin-bottom: 12px;
}

/* Mobile Responsive */
@media (max-width: 640px) {
    .auth-modal-content {
        max-width: 95%;
        margin: 20px;
    }

    .auth-provider-btn {
        font-size: 13px;
        padding: 10px 12px;
    }

    .auth-input {
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

/* ============================================
   Product Introduction Section (Landing Page)
   ============================================ */

.product-intro-section {
    padding: 40px 0;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 30px;
}

/* Hero Section */
.hero-section {
    text-align: center;
    margin-bottom: 48px;
}

.hero-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: #111827;
    margin-bottom: 16px;
    line-height: 1.2;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: #6b7280;
    line-height: 1.6;
    max-width: 600px;
    margin: 0 auto;
}

/* Features Grid */
.features-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    margin-bottom: 48px;
}

/* Feature Card */
.feature-card {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 32px 24px;
    text-align: center;
    transition: all 0.3s ease;
}

/* Hover effect removed - users shouldn't think cards are clickable */

.feature-icon-placeholder {
    margin-bottom: 20px;
}

.feature-icon {
    width: 200px;
    height: 200px;
    object-fit: contain;
    display: block;
    margin: 0 auto;
}

.icon-box {
    font-size: 3rem;
    line-height: 1;
    display: inline-block;
}

.feature-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #111827;
    margin-bottom: 12px;
}

.feature-description {
    font-size: 0.95rem;
    color: #6b7280;
    line-height: 1.6;
    margin: 0;
}

/* Features Grid Redesign - 左右兩欄佈局 */
.features-grid-redesign {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 32px;
    margin-bottom: 48px;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

/* Feature Card New - 新設計的卡片 */
.feature-card-new {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Feature Media - 影片容器 */
.feature-media {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #f3f4f6;
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.feature-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* 當影片尚未載入時的佔位圖示 */
.feature-media .icon-box {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 4rem;
    z-index: 1;
}

.feature-video + .icon-box {
    display: none;
}

/* Feature Content - 文字內容區域 */
.feature-content {
    padding: 32px 28px;
    text-align: center;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.feature-content .feature-title {
    font-size: 1.375rem;
    font-weight: 600;
    color: #111827;
    margin-bottom: 16px;
}

.feature-content .feature-description {
    font-size: 1rem;
    color: #6b7280;
    line-height: 1.7;
    margin: 0;
}

/* 響應式設計 - 平板 */
@media (max-width: 968px) {
    .features-grid-redesign {
        gap: 24px;
    }

    .feature-content {
        padding: 24px 20px;
    }

    .feature-content .feature-title {
        font-size: 1.25rem;
    }

    .feature-content .feature-description {
        font-size: 0.95rem;
    }
}

/* 響應式設計 - 手機 */
@media (max-width: 640px) {
    .features-grid-redesign {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    /* 手機版左右卡片都改為圖上文下 */
    .feature-card-right {
        flex-direction: column;
    }

    /* 確保手機版 feature-content 在 feature-media 之後 */
    .feature-card-right .feature-content {
        order: 2;
    }

    .feature-card-right .feature-media {
        order: 1;
    }

    .feature-media {
        aspect-ratio: 16 / 10;
    }

    .feature-content {
        padding: 24px 20px;
    }

    .feature-content .feature-title {
        font-size: 1.125rem;
    }

    .feature-content .feature-description {
        font-size: 0.9rem;
        line-height: 1.6;
    }
}

/* CTA Section */
.cta-section {
    text-align: center;
}

.cta-button {
    padding: 16px 48px;
    background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.125rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.cta-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.4);
}

.cta-button:active {
    transform: translateY(0);
}

.cta-hint {
    margin-top: 16px;
    font-size: 0.875rem;
    color: #9ca3af;
}

/* Use Cases Section */
.use-cases-section {
    margin-top: 64px;
}

.use-cases-list {
    display: flex;
    flex-direction: column;
    gap: 48px;
    margin-bottom: 48px;
}

.use-case-item {
    display: flex;
    align-items: center;
    gap: 40px;
}

.use-case-item.reverse {
    flex-direction: row-reverse;
}

.use-case-image {
    flex: 0 0 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-box-large {
    font-size: 5rem;
    line-height: 1;
    display: inline-block;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 60px;
    width: 300px;
    height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.use-case-media {
    width: 300px;
    height: 300px;
    object-fit: cover;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.use-case-content {
    flex: 1;
    text-align: left;
}

.use-case-item.reverse .use-case-content {
    text-align: left;
}

.use-case-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #111827;
    margin-bottom: 16px;
}

.use-case-description {
    font-size: 1rem;
    color: #6b7280;
    line-height: 1.8;
    margin: 0;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .product-intro-section {
        padding: 32px 0;
    }

    .hero-section {
        margin-bottom: 32px;
    }

    .hero-title {
        font-size: 1.875rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .features-grid {
        grid-template-columns: 1fr;
        gap: 16px;
        margin-bottom: 32px;
    }

    .feature-card {
        padding: 24px 20px;
    }

    .icon-box {
        font-size: 2.5rem;
    }

    .feature-title {
        font-size: 1.125rem;
    }

    .feature-description {
        font-size: 0.875rem;
    }

    .cta-button {
        width: 100%;
        padding: 14px 32px;
        font-size: 1rem;
    }

    /* Use Cases Mobile */
    .use-cases-section {
        margin-top: 48px;
    }

    .use-cases-list {
        gap: 32px;
        margin-bottom: 32px;
    }

    .use-case-item {
        flex-direction: column !important;
        gap: 24px;
        text-align: center;
    }

    .use-case-image {
        flex: 0 0 auto;
    }

    .icon-box-large {
        width: 200px;
        height: 200px;
        padding: 40px;
        font-size: 4rem;
    }

    .use-case-media {
        width: 200px;
        height: 200px;
    }

    .use-case-content {
        text-align: center;
    }

    .use-case-item.reverse .use-case-content {
        text-align: center;
    }

    .use-case-title {
        font-size: 1.25rem;
    }

    .use-case-description {
        font-size: 0.9375rem;
    }
}

@media (max-width: 640px) {
    .hero-title {
        font-size: 1.5rem;
    }

    .hero-subtitle {
        font-size: 0.9375rem;
    }

    .feature-card {
        padding: 20px 16px;
    }

    /* Use Cases Small Mobile */
    .icon-box-large {
        width: 160px;
        height: 160px;
        padding: 30px;
        font-size: 3rem;
    }

    .use-case-media {
        width: 160px;
        height: 160px;
    }

    .use-case-title {
        font-size: 1.125rem;
    }

    .use-case-description {
        font-size: 0.875rem;
    }
}

/* WebView Warning Modal Styles */
.webview-warning-content {
    max-width: 500px;
}

.webview-warning-message {
    text-align: left;
}

.warning-main-text {
    font-size: 1rem;
    color: #1f2937;
    margin-bottom: 12px;
    line-height: 1.5;
}

.warning-explanation {
    font-size: 0.9375rem;
    color: #4b5563;
    margin-bottom: 24px;
    line-height: 1.6;
}

.solution-section {
    background: #f3f4f6;
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.solution-section h4 {
    font-size: 1rem;
    color: #1f2937;
    margin: 0 0 12px 0;
    font-weight: 600;
}

.solution-steps {
    margin: 0;
    padding-left: 20px;
    color: #374151;
}

.solution-steps li {
    margin-bottom: 8px;
    line-height: 1.5;
}

.alternative-section {
    background: #eff6ff;
    padding: 12px 16px;
    border-radius: 8px;
    border-left: 4px solid #3b82f6;
    margin-bottom: 16px;
}

.alternative-text {
    margin: 0;
    font-size: 0.9375rem;
    color: #1e40af;
    line-height: 1.5;
}

.copy-feedback {
    padding: 12px;
    background: #d4edda;
    color: #155724;
    border-radius: 6px;
    text-align: center;
    font-size: 0.9375rem;
    font-weight: 500;
    margin-top: 12px;
}

.webview-warning-footer {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.webview-warning-footer .auth-btn {
    width: 100%;
    margin: 0;
}

/* Responsive adjustments for WebView warning */
@media (max-width: 480px) {
    .webview-warning-content {
        max-width: 95%;
        margin: 20px auto;
    }

    .solution-section {
        padding: 12px;
    }

    .solution-steps {
        padding-left: 16px;
        font-size: 0.875rem;
    }

    .warning-main-text,
    .warning-explanation,
    .alternative-text {
        font-size: 0.875rem;
    }
}

/* Upcoming activity styles */
.upcoming-activity {
    background-color: #f3f4f6;
    opacity: 0.5;
}

.upcoming-badge {
    background: #f97316;
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    white-space: nowrap;
}

.ending-soon-badge {
    background: #6b7280;
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    white-space: nowrap;
}



/* ============================================
   搜尋提示 (Search Hints)
   ============================================ */

/* 搜尋提示容器 */
#search-hints-container {
    margin-top: 10px;
    margin-bottom: 10px;
}

/* 搜尋提示卡片 */
.search-hint {
    background: #e3f2fd;
    border-left: 4px solid #2196f3;
    padding: 12px 16px;
    border-radius: 4px;
    margin-bottom: 10px;
    animation: slideIn 0.3s ease-out;
}

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

/* 提示訊息文字 */
.hint-message {
    display: block;
    font-size: 13px;
    color: #1976d2;
    font-weight: 600;
    margin-bottom: 8px;
}

/* 建議按鈕容器 */
.hint-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

/* 建議按鈕 */
.hint-button {
    background: white;
    border: 1px solid #2196f3;
    color: #1976d2;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.hint-button:hover {
    background: #2196f3;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(33, 150, 243, 0.3);
}

.hint-button:active {
    transform: translateY(0);
}

/* 手機版樣式調整 */
@media (max-width: 768px) {
    .search-hint {
        padding: 10px 12px;
    }

    .hint-message {
        font-size: 12px;
        margin-bottom: 6px;
    }

    .hint-button {
        padding: 5px 10px;
        font-size: 11px;
    }

    .hint-suggestions {
        gap: 4px;
    }
}
