/* 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, #4a90b8 0%, #2c5aa0 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.1);
    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;
}

.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.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: inline-flex !important;
    align-items: center;
    gap: 8px;
}

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;
}

/* 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);
}

/* 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: 8px;
    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;
}

/* 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;
}

.coupon-card-name {
    margin-top: 8px;
    font-size: 12px;
    color: #92400e;
    font-style: italic;
}

.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: center;
    margin-bottom: 10px;
}

.card-name-with-pin {
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-name {
    font-size: 1.2rem;
    font-weight: 700;
    color: #111827;
}

.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: "💳 ";
    }

    .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: 16px;
    }
    
    .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;
}

.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: 20px;
    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;
}

.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; /* 縮小內部間距 */
}

/* 國泰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: 6px; /* 減少內部間距 */
}

.fee-waiver-text {
    margin-top: 2px; /* 減少頂部間距 */
    font-style: italic;
}

.fee-waiver-text::before {
    content: '免年費條件: ';
    font-weight: 600;
    color: #374151;
    font-style: normal;
}

/* 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;
}

.social-media-container {
    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 svg {
    width: 16px;
    height: 16px;
    transition: transform 0.3s ease;
}

.social-link:hover svg {
    transform: scale(1.1) rotate(5deg);
}

.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-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;
    }
}

/* Disclaimer Footer Styles - 白色可收合版本 */
.disclaimer-footer {
    max-width: 800px;
    margin: 20px auto;
    padding: 0 24px 24px;
    text-align: center;
}

.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: 1000;
    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.rate-column {
    width: 80px;
    text-align: right;
}

.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 td.delete-cell {
    text-align: center;
}

/* 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);
    }
}

/* 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 */
    }
}

