/* css/style.css */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+HK:wght@400;500;600;700&display=swap');

:root {
    --bottom-nav-height: 80px;
    --notion-text: #37352f;
    --notion-border: #e9e9e7;
    --notion-bg-hover: #efefed;
    --notion-bg-light: #f7f7f5;
}

body {
    /* Use Notion-like system fonts with Noto Sans HK fallback */
    font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, "Apple Color Emoji", Arial, sans-serif, "Noto Sans HK";
    color: var(--notion-text);
    -webkit-tap-highlight-color: transparent;
    -webkit-font-smoothing: antialiased;
    padding-bottom: 0;
    background-color: #ffffff;
    overflow-x: hidden;
}

/* Hide number input spinners for cleaner large inputs */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input[type="number"] {
    -moz-appearance: textfield;
}

/* Redefine notion-panel to be truly flat */
.notion-panel {
    background: #ffffff;
    border: 1px solid var(--notion-border);
    border-radius: 8px;
    box-shadow: none; /* Removed heavy shadow */
}

/* Flatten the wallet covers */
.wallet-cover {
    position: relative;
    overflow: hidden;
    text-align: left;
    border-radius: 8px; /* Sharper corners */
    border: 1px solid var(--notion-border);
    min-height: 122px;
    padding: 12px 14px;
    color: var(--notion-text);
    background: #ffffff !important; /* Override gradients */
    transition: background 0.1s ease;
    box-shadow: none;
}

.wallet-cover:hover {
    transform: none;
    background: var(--notion-bg-light) !important;
    box-shadow: none;
}

.wallet-cover-active {
    outline: none;
    border: 2px solid var(--notion-text);
}

.wallet-edit-mode .wallet-edit-item {
    cursor: grab;
    user-select: none;
    padding-right: 42px;
    animation: wallet-wiggle 0.24s ease-in-out infinite alternate;
    transform-origin: center;
}

.wallet-edit-mode .wallet-edit-item:active {
    cursor: grabbing;
}

.wallet-edit-item.wallet-drop-target {
    outline: 2px dashed rgba(68, 64, 60, 0.5);
    outline-offset: -4px;
}

.wallet-edit-item.wallet-dragging {
    opacity: 0.55;
    transform: scale(0.985);
    animation: none;
}

@keyframes wallet-wiggle {
    from { transform: rotate(-0.35deg); }
    to { transform: rotate(0.35deg); }
}

.wallet-cover::after {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(120deg, rgba(255, 255, 255, 0.24), transparent 36%, rgba(255, 255, 255, 0.12) 72%, transparent 100%);
    pointer-events: none;
}

.wallet-cover-chip {
    width: 26px;
    height: 19px;
    border-radius: 5px;
    background: linear-gradient(145deg, #d6cbb8, #b9ab95);
    border: 1px solid rgba(112, 102, 86, 0.35);
}

.wallet-cover-meta {
    margin-top: 12px;
    font-size: 10px;
    opacity: 0.72;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.wallet-cover-title {
    margin-top: 3px;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.3;
}

.wallet-cover-foot {
    margin-top: 6px;
    font-size: 11px;
    opacity: 0.76;
}

.wallet-delete-btn {
    position: absolute;
    right: 8px;
    top: 8px;
    width: 22px;
    height: 22px;
    border-radius: 9999px;
    border: 1px solid rgba(120, 113, 108, 0.35);
    background: rgba(255, 253, 249, 0.92);
    color: #57534e;
    font-size: 14px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    transition: background 0.15s ease, transform 0.15s ease, color 0.15s ease;
}

.wallet-delete-btn:hover {
    background: #f5f5f4;
    color: #292524;
    transform: scale(1.04);
}

.wallet-drag-hint {
    position: absolute;
    right: 10px;
    bottom: 8px;
    font-size: 11px;
    opacity: 0.6;
}

.wallet-edit-mode .wallet-cover-foot {
    opacity: 0.9;
}

@media (prefers-reduced-motion: reduce) {
    .wallet-edit-mode .wallet-edit-item {
        animation: none;
    }
}

.wallet-detail-banner {
    border-radius: 14px;
    border: 1px solid #d8d1c6;
    color: #2d2a26;
    padding: 12px 14px;
}

.wallet-tone-hsbc { background: linear-gradient(136deg, #f2ece7 0%, #e9e1d9 46%, #e2d7cd 100%); }
.wallet-tone-sc { background: linear-gradient(136deg, #eef1f3 0%, #e5eaef 48%, #dde4ea 100%); }
.wallet-tone-citi { background: linear-gradient(136deg, #edf1f5 0%, #e4eaf0 42%, #dce4ec 100%); }
.wallet-tone-dbs { background: linear-gradient(136deg, #f1ecea 0%, #e8e1de 45%, #dfd6d2 100%); }
.wallet-tone-hangseng { background: linear-gradient(136deg, #edf1ed 0%, #e4e9e3 42%, #dbe2d8 100%); }
.wallet-tone-boc { background: linear-gradient(136deg, #edf0f4 0%, #e4e8ed 42%, #dbe2e9 100%); }
.wallet-tone-ae { background: linear-gradient(136deg, #efefef 0%, #e7e7e7 46%, #dfdfdf 100%); }
.wallet-tone-fubon { background: linear-gradient(136deg, #eef1f4 0%, #e5e9ee 48%, #dde3e9 100%); }
.wallet-tone-bea { background: linear-gradient(136deg, #f3eee8 0%, #ebe4db 48%, #e3dbd0 100%); }
.wallet-tone-sim { background: linear-gradient(136deg, #f0efee 0%, #e7e5e3 48%, #dedbd8 100%); }
.wallet-tone-aeon { background: linear-gradient(136deg, #efeff3 0%, #e7e7ed 46%, #dddde7 100%); }
.wallet-tone-wewa { background: linear-gradient(136deg, #edf1f2 0%, #e5eaeb 46%, #dce4e6 100%); }
.wallet-tone-mox { background: linear-gradient(136deg, #efefef 0%, #e6e6e6 46%, #dddddd 100%); }
.wallet-tone-default { background: linear-gradient(136deg, #f2f1ef 0%, #e9e7e4 48%, #e0ddda 100%); }

.tab-content {
    padding-bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom));
}

.app-disclaimer {
    padding-bottom: 1rem;
    margin-bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom));
}

.bottom-tabbar {
    padding-bottom: calc(0.75rem + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.toast {
    border-radius: 0.75rem;
    padding: 0.75rem 0.9rem;
    font-size: 0.85rem;
    line-height: 1.3;
    color: #fff;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.15);
    white-space: pre-line;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast-info {
    background: rgba(31, 41, 55, 0.95);
}

.toast-success {
    background: rgba(5, 150, 105, 0.95);
}

.toast-warning {
    background: rgba(180, 83, 9, 0.95);
}

.toast-error {
    background: rgba(185, 28, 28, 0.95);
}

/* Custom Scrollbar for Settings */
#settings-container::-webkit-scrollbar {
    width: 6px;
}

#settings-container::-webkit-scrollbar-track {
    background: #f1f1f1;
}

#settings-container::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

/* Progress UI Tokens */
.pc-track {
    background: #f3f4f6;
    border-radius: 9999px;
    height: 0.75rem;
    position: relative;
    overflow: hidden;
}

.pc-track-locked {
    background: #e5e7eb;
}

.pc-fill {
    height: 100%;
    border-radius: 9999px;
    transition: width 0.7s ease;
}

.pc-lock {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
    font-size: 0.7rem;
    background: rgba(255, 255, 255, 0.55);
    pointer-events: none;
}

.pc-sep {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 1px;
    background: rgba(0, 0, 0, 0.08);
}

/* Progress Card Info Lines */
.pc-info-lines {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding-bottom: 0.375rem;
    border-bottom: 1px solid #f0f0ee;
}

.pc-info-line {
    display: flex;
    align-items: baseline;
    gap: 0.375rem;
    font-size: 0.6875rem;
    line-height: 1.4;
    color: #78716c;
}

.pc-info-icon {
    flex-shrink: 0;
    width: 0.75rem;
    font-size: 0.5625rem;
    text-align: center;
    color: #a8a29e;
}

/* Progress Bar Stripes Animation */
.progress-stripe {
    background-image: linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);
    background-size: 1rem 1rem;
    animation: progress-bar-stripes 1s linear infinite;
}

@keyframes progress-bar-stripes {
    0% {
        background-position: 1rem 0;
    }

    100% {
        background-position: 0 0;
    }
}

.stamp-dot-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.stamp-dot {
    width: 0.75rem;
    height: 0.75rem;
    border-radius: 9999px;
    background: #d1d5db;
    border: 1px solid #d1d5db;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.stamp-dot-filled {
    background: #dc2626;
    border-color: #dc2626;
    box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.14);
}

/* Modal Animation Classes */
.modal-open {
    overflow: hidden;
}

.modal-visible {
    display: block !important;
    opacity: 1 !important;
}

.modal-slide-up {
    transform: translateY(0) !important;
}

/* Card Interaction */
.card-enter {
    animation: fadeSlideIn 0.3s ease-out forwards;
}

@keyframes fadeSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Collapsible Section Styles */
.collapsible-header {
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s;
}

.collapsible-header:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

.collapsible-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.collapsible-content.expanded {
    max-height: 2000px;
    /* Large enough to accommodate content */
    transition: max-height 0.5s ease-in;
}

.rotate-icon {
    transition: transform 0.3s ease;
}

.rotate-icon.expanded {
    transform: rotate(180deg);
}

/* Top Result Highlight */
.top-result {
    border: 2px solid #10b981;
    box-shadow: 0 4px 6px -1px rgba(16, 185, 129, 0.3);
}

.top-result-badge {
    position: absolute;
    top: -8px;
    right: 8px;
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* QW-2: Collapsible breakdown styling */
.calc-details-summary {
    list-style: none;
}
.calc-details-summary::-webkit-details-marker {
    display: none;
}
details[open] > .calc-details-summary {
    color: #6b7280;
}

/* B6: Touch target minimum sizing */
button, a[onclick] {
    min-height: 44px;
    min-width: 44px;
}
/* Toggle switches have their own sizing */
[role="switch"] {
    min-height: auto;
    min-width: auto;
}
/* Exception for inline text buttons */
.text-\[10px\] button, button.text-\[10px\], button.text-xs {
    min-height: auto;
    min-width: auto;
    padding-top: 4px;
    padding-bottom: 4px;
}
