/* ═══════════════════════════════════════════
   Trip Planner — Mobile-First App Styles
   ═══════════════════════════════════════════ */

:root {
    --primary: #1a1a2e;
    --primary-light: #16213e;
    --accent: #e94560;
    --accent-light: #ff6b81;
    --gold: #f5a623;
    --green: #10b981;
    --blue: #3b82f6;
    --bg: #f0f2f5;
    --card: #ffffff;
    --text: #1a1a2e;
    --text-secondary: #6b7280;
    --text-light: #9ca3af;
    --border: #e5e7eb;
    --shadow: 0 2px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
    --radius: 16px;
    --radius-sm: 10px;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body.tp-app {
    font-family: 'Noto Sans TC', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    min-height: 100vh;
    min-height: 100dvh;
    padding-top: var(--safe-top);
    padding-bottom: var(--safe-bottom);
}

#trip-planner-app {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    min-height: 100dvh;
    position: relative;
}

/* ── PIN Screen ── */
.tp-pin-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    min-height: 100dvh;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 50%, #0a3d62 100%);
    padding: 20px;
    animation: pinFadeIn 0.8s ease;
}

@keyframes pinFadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.tp-pin-screen__logo {
    font-size: 48px;
    margin-bottom: 8px;
}

.tp-pin-screen__title {
    color: #fff;
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
    text-align: center;
}

.tp-pin-screen__subtitle {
    color: rgba(255,255,255,0.6);
    font-size: 14px;
    margin-bottom: 40px;
}

.tp-pin-screen__label {
    color: rgba(255,255,255,0.8);
    font-size: 14px;
    margin-bottom: 16px;
}

.tp-pin-dots {
    display: flex;
    gap: 16px;
    margin-bottom: 32px;
}

.tp-pin-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.4);
    background: transparent;
    transition: all 0.2s ease;
}

.tp-pin-dot.filled {
    background: var(--gold);
    border-color: var(--gold);
    transform: scale(1.1);
}

.tp-pin-dot.error {
    border-color: var(--accent);
    background: var(--accent);
    animation: pinShake 0.4s ease;
}

@keyframes pinShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-8px); }
    75% { transform: translateX(8px); }
}

.tp-pin-keypad {
    display: grid;
    grid-template-columns: repeat(3, 72px);
    gap: 12px;
}

.tp-pin-key {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.08);
    color: #fff;
    font-size: 28px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.tp-pin-key:active {
    background: rgba(255,255,255,0.2);
    transform: scale(0.95);
}

.tp-pin-key.empty { visibility: hidden; }
.tp-pin-key.backspace {
    font-size: 20px;
    border: none;
    background: none;
}

.tp-pin-error {
    color: var(--accent-light);
    font-size: 14px;
    margin-top: 16px;
    min-height: 20px;
}

/* ── Homepage ── */
.tp-home {
    padding-bottom: 80px;
}

.tp-home-header {
    background: linear-gradient(135deg, var(--primary) 0%, #0a3d62 100%);
    padding: 24px 20px 20px;
    color: #fff;
    position: relative;
    overflow: hidden;
}

.tp-home-header::after {
    content: '';
    position: absolute;
    bottom: -30px;
    left: -10%;
    width: 120%;
    height: 60px;
    background: var(--bg);
    border-radius: 50% 50% 0 0;
}

.tp-home-header__title {
    font-size: 26px;
    font-weight: 700;
    margin-bottom: 4px;
}

.tp-refresh-btn {
    position: absolute;
    top: 20px;
    right: 16px;
    background: rgba(255,255,255,0.15);
    border: none;
    color: #fff;
    font-size: 22px;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 1;
    backdrop-filter: blur(4px);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tp-refresh-btn:active {
    background: rgba(255,255,255,0.3);
    transform: rotate(180deg);
}

.tp-home-header__dates {
    font-size: 13px;
    color: rgba(255,255,255,0.7);
}

.tp-home-header__countdown {
    display: inline-block;
    background: rgba(255,255,255,0.15);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 13px;
    margin-top: 10px;
    backdrop-filter: blur(4px);
}

/* ── Reminder Bar ── */
.tp-reminder-bar {
    background: linear-gradient(90deg, var(--accent) 0%, #c0392b 100%);
    color: #fff;
    padding: 12px 16px;
    margin: 0 16px 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    display: none;
    animation: slideDown 0.4s ease;
}

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

.tp-reminder-bar.visible { display: block; }
.tp-reminder-bar__label { font-weight: 700; font-size: 11px; text-transform: uppercase; opacity: 0.8; }
.tp-reminder-bar__title { font-weight: 500; margin-top: 2px; }
.tp-reminder-bar__hotel { margin-top: 8px; padding-top: 8px; border-top: 1px solid rgba(255,255,255,0.2); }

/* ── Tab Bar ── */
.tp-tabs {
    display: flex;
    gap: 4px;
    padding: 4px 16px 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.tp-tabs::-webkit-scrollbar { display: none; }

.tp-tab {
    flex: 0 0 auto;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    background: var(--card);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    -webkit-tap-highlight-color: transparent;
}

.tp-tab.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* ── Day Cards ── */
.tp-days-grid {
    padding: 0 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.tp-day-card {
    background: var(--card);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    opacity: 0;
    transform: translateY(20px);
    animation: cardReveal 0.5s ease forwards;
}

.tp-day-card:nth-child(1) { animation-delay: 0.05s; }
.tp-day-card:nth-child(2) { animation-delay: 0.1s; }
.tp-day-card:nth-child(3) { animation-delay: 0.15s; }
.tp-day-card:nth-child(4) { animation-delay: 0.2s; }
.tp-day-card:nth-child(5) { animation-delay: 0.25s; }

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

.tp-day-card:active {
    transform: scale(0.98);
}

.tp-day-card--today {
    border: 2px solid var(--gold);
    box-shadow: 0 0 20px rgba(245,166,35,0.25);
}

.tp-day-card__header {
    padding: 16px 16px 12px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.tp-day-card__day-num {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.tp-day-card__day-num.karuizawa { background: linear-gradient(135deg, #a8e6cf, #3ddc84); }
.tp-day-card__day-num.kusatsu { background: linear-gradient(135deg, #fbbf24, #f59e0b); }
.tp-day-card__day-num.tokyo { background: linear-gradient(135deg, #667eea, #764ba2); }
.tp-day-card__day-num.okinawa { background: linear-gradient(135deg, #f093fb, #f5576c); }
.tp-day-card__day-num.hongkong { background: linear-gradient(135deg, #4facfe, #00f2fe); }

.tp-day-card__info {
    flex: 1;
    margin-left: 12px;
}

.tp-day-card__date {
    font-size: 12px;
    color: var(--text-light);
}

.tp-day-card__city {
    font-size: 20px;
    font-weight: 700;
    margin-top: 2px;
}

/* ── Weather on Day Card ── */
.tp-day-card__weather {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    flex-shrink: 0;
    margin-left: auto;
    margin-right: 6px;
}

.tp-day-card__weather-icon {
    font-size: 20px;
    line-height: 1;
}

.tp-day-card__weather-temp {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
}

.tp-day-card__weather-avg {
    font-size: 9px;
    color: var(--text-light);
    font-weight: 400;
}

.tp-day-card__weather.historical {
    opacity: 0.7;
}

.tp-day-card__groups {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.tp-group-badge {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 10px;
    color: #fff;
    font-weight: 500;
}

.tp-day-card__preview {
    padding: 0 16px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tp-day-card__preview-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

.tp-day-card__preview-icon {
    width: 20px;
    text-align: center;
    font-size: 14px;
}

.tp-day-card__preview-time {
    font-size: 12px;
    color: var(--text-light);
    min-width: 40px;
}

.tp-day-card__arrow {
    color: var(--text-light);
    padding: 0 16px 14px;
    text-align: right;
    font-size: 12px;
}

/* ── Expense Summary (Homepage bottom) ── */
.tp-expense-bar {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    background: var(--card);
    border-top: 1px solid var(--border);
    padding: 12px 20px calc(12px + var(--safe-bottom));
    box-shadow: 0 -4px 20px rgba(0,0,0,0.08);
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.tp-expense-bar__label {
    font-size: 13px;
    color: var(--text-secondary);
}

.tp-expense-bar__total {
    font-size: 20px;
    font-weight: 700;
    color: var(--accent);
}

/* ── Day Detail Page ── */
.tp-day-detail {
    animation: slideIn 0.3s ease;
}

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

.tp-day-detail__header {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    position: sticky;
    top: 0;
    background: var(--card);
    z-index: 50;
    border-bottom: 1px solid var(--border);
}

.tp-back-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: var(--bg);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
    flex-shrink: 0;
}

.tp-day-detail__title {
    font-size: 18px;
    font-weight: 700;
}

.tp-day-detail__subtitle {
    font-size: 12px;
    color: var(--text-secondary);
}

.tp-day-detail__items {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-bottom: 100px;
}

/* ── Item Card ── */
.tp-item-card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.tp-item-card__header {
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.tp-item-card__icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.tp-item-card__icon.transport { background: #dbeafe; }
.tp-item-card__icon.hotel_checkin, .tp-item-card__icon.hotel_checkout { background: #fef3c7; }
.tp-item-card__icon.meal { background: #fce7f3; }
.tp-item-card__icon.activity { background: #d1fae5; }
.tp-item-card__icon.shopping { background: #ede9fe; }
.tp-item-card__icon.free { background: #f3f4f6; }

.tp-item-card__title-wrap {
    flex: 1;
    min-width: 0;
}

.tp-item-card__title {
    font-size: 15px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tp-item-card.expanded .tp-item-card__title {
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
}

.tp-item-card__time {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 1px;
}

.tp-item-card__group-tag {
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 8px;
    color: #fff;
    font-weight: 500;
    flex-shrink: 0;
}

.tp-item-card__cost {
    font-size: 13px;
    font-weight: 600;
    color: var(--accent);
    white-space: nowrap;
    flex-shrink: 0;
}

.tp-item-card__expand {
    font-size: 14px;
    color: var(--text-light);
    flex-shrink: 0;
    transition: transform 0.2s;
}

.tp-item-card__expand.open { transform: rotate(180deg); }

/* Expanded content */
.tp-item-card__body {
    padding: 0 16px 14px;
    display: none;
    animation: expandIn 0.3s ease;
}

.tp-item-card__body.open { display: block; }

@keyframes expandIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.tp-item-card__desc {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 10px;
    line-height: 1.5;
}

.tp-item-card__meta {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.tp-item-card__meta-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 13px;
}

.tp-item-card__meta-icon {
    width: 18px;
    text-align: center;
    flex-shrink: 0;
    color: var(--text-light);
}

.tp-item-card__meta-text {
    flex: 1;
    color: var(--text-secondary);
    word-break: break-all;
}

.tp-item-card__meta-text a {
    color: var(--blue);
    text-decoration: none;
}

/* ── Photo Carousel ── */
.tp-photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 6px;
    margin-bottom: 12px;
}

.tp-photo-grid__item {
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    overflow: hidden;
    cursor: pointer;
}

.tp-photo-grid__item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Lightbox overlay */
.tp-lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0,0,0,0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
}

.tp-lightbox.open {
    opacity: 1;
}

.tp-lightbox img {
    max-width: 95vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 4px;
}

.tp-lightbox__close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: rgba(255,255,255,0.2);
    border: none;
    color: #fff;
    font-size: 22px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
}

.tp-photo-upload-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 10px;
    border: 2px dashed var(--border);
    border-radius: var(--radius-sm);
    background: none;
    color: var(--text-light);
    font-size: 13px;
    cursor: pointer;
    margin-bottom: 12px;
    transition: border-color 0.2s;
}
.tp-photo-upload-btn:active { border-color: var(--blue); color: var(--blue); }

/* ── Action Buttons Row ── */
.tp-item-card__actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.tp-action-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text-secondary);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: all 0.15s;
}

.tp-action-btn:active { background: var(--bg); }
.tp-action-btn.whatsapp { background: #25d366; color: #fff; border-color: #25d366; }
.tp-action-btn.whatsapp:active { background: #1da851; }

/* ── Comments Section ── */
.tp-comments {
    margin-top: 12px;
    border-top: 1px solid var(--border);
    padding-top: 12px;
}

.tp-comments__title {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
}

.tp-comment {
    padding: 8px 0;
    border-bottom: 1px solid #f5f5f5;
}

.tp-comment:last-child { border-bottom: none; }

.tp-comment__author {
    font-size: 12px;
    font-weight: 600;
    color: var(--blue);
}

.tp-comment__text {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.tp-comment__time {
    font-size: 11px;
    color: var(--text-light);
    margin-top: 2px;
}

.tp-comment-form {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.tp-comment-form input, .tp-comment-form textarea {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: inherit;
    outline: none;
    background: var(--bg);
}

.tp-comment-form input:focus, .tp-comment-form textarea:focus {
    border-color: var(--blue);
}

.tp-comment-form button {
    padding: 8px 16px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
}

/* ── Add Item Form ── */
.tp-add-item-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 14px;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    background: none;
    color: var(--text-light);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}
.tp-add-item-btn:active { border-color: var(--blue); color: var(--blue); }

/* ── Modal / Bottom Sheet ── */
.tp-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 200;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.tp-modal {
    background: var(--card);
    border-radius: var(--radius) var(--radius) 0 0;
    width: 100%;
    max-width: 480px;
    max-height: 85vh;
    overflow-y: auto;
    padding: 20px;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.tp-modal__handle {
    width: 40px;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    margin: 0 auto 16px;
}

.tp-modal__title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 16px;
}

.tp-form-group {
    margin-bottom: 14px;
}

.tp-form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text-secondary);
}

.tp-form-group input,
.tp-form-group select,
.tp-form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    background: var(--bg);
    transition: border-color 0.2s;
}

.tp-form-group input:focus,
.tp-form-group select:focus,
.tp-form-group textarea:focus {
    border-color: var(--blue);
}

.tp-form-row {
    display: flex;
    gap: 10px;
}

.tp-form-row > .tp-form-group { flex: 1; }

.tp-submit-btn {
    width: 100%;
    padding: 14px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 8px;
    transition: opacity 0.2s;
}
.tp-submit-btn:active { opacity: 0.8; }
.tp-submit-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Expense Detail Modal ── */
.tp-expense-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.tp-expense-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #f5f5f5;
}
.tp-expense-row__cat { font-size: 14px; }
.tp-expense-row__desc { font-size: 12px; color: var(--text-light); margin-top: 2px; }
.tp-expense-row__amount { text-align: right; }
.tp-expense-row__original { font-size: 14px; font-weight: 600; }
.tp-expense-row__converted { font-size: 11px; color: var(--text-light); }
.tp-expense-total {
    display: flex;
    justify-content: space-between;
    padding: 14px 0;
    border-top: 2px solid var(--primary);
    font-size: 18px;
    font-weight: 700;
}
.tp-expense-total__value { color: var(--accent); }

/* ── Checklist ── */
.tp-checklist-tabs {
    display: flex;
    gap: 8px;
    padding: 12px 16px 0;
}

.tp-checklist-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--card);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
    color: var(--text-secondary);
}

.tp-checklist-tab.active {
    border-color: var(--primary);
    background: rgba(26, 26, 46, 0.05);
    color: var(--text);
}

.tp-checklist-tab__icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.tp-checklist-progress {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px 0;
}

.tp-checklist-progress__bar {
    flex: 1;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
}

.tp-checklist-progress__fill {
    height: 100%;
    background: var(--green);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.tp-checklist-progress__text {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
}

.tp-checklist { padding: 16px; }
.tp-checklist-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid #f5f5f5;
}
.tp-checklist-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--green);
    cursor: pointer;
}
.tp-checklist-item__text {
    flex: 1;
    font-size: 14px;
}
.tp-checklist-item__text.checked {
    text-decoration: line-through;
    color: var(--text-light);
}
.tp-checklist-item__delete {
    border: none;
    background: none;
    color: var(--text-light);
    font-size: 16px;
    cursor: pointer;
    padding: 4px;
}
.tp-checklist-add {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}
.tp-checklist-add input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    outline: none;
    background: var(--bg);
}
.tp-checklist-add button {
    padding: 10px 16px;
    background: var(--green);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    cursor: pointer;
}

/* ── AI Chat ── */
.tp-ai-fab {
    position: fixed;
    bottom: calc(68px + var(--safe-bottom));
    right: calc(50% - 220px);
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    border: none;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(102,126,234,0.4);
    z-index: 90;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}
.tp-ai-fab:active { transform: scale(0.92); }

.tp-chat-drawer {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: none;
    flex-direction: column;
    background: var(--bg);
    max-width: 480px;
    margin: 0 auto;
}
.tp-chat-drawer.open { display: flex; }

.tp-chat-header {
    padding: 14px 16px;
    background: var(--card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
}

.tp-chat-header__title { font-size: 16px; font-weight: 700; flex: 1; }

.tp-chat-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: var(--bg);
    font-size: 16px;
    cursor: pointer;
}

.tp-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tp-chat-msg {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    word-break: break-word;
}

.tp-chat-msg.user {
    align-self: flex-end;
    background: var(--primary);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.tp-chat-msg.assistant {
    align-self: flex-start;
    background: var(--card);
    box-shadow: var(--shadow);
    border-bottom-left-radius: 4px;
}

.tp-chat-msg.assistant a {
    color: var(--blue);
    text-decoration: underline;
    word-break: break-all;
}

.tp-chat-msg.assistant strong {
    font-weight: 700;
}

.tp-chat-msg.assistant em {
    font-style: italic;
}

.tp-chat-msg.loading::after {
    content: '...';
    animation: dots 1s steps(3, end) infinite;
}

@keyframes dots {
    0% { content: '.'; }
    33% { content: '..'; }
    66% { content: '...'; }
}

.tp-chat-input-area {
    padding: 10px 16px calc(10px + var(--safe-bottom));
    background: var(--card);
    border-top: 1px solid var(--border);
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.tp-chat-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    resize: none;
    max-height: 100px;
    background: var(--bg);
}

.tp-chat-img-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg);
    font-size: 18px;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tp-chat-send-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: var(--primary);
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.tp-chat-send-btn:disabled { opacity: 0.4; }

/* ── Bottom Nav ── */
.tp-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    background: var(--card);
    border-top: 1px solid var(--border);
    display: flex;
    padding: 6px 0 calc(6px + var(--safe-bottom));
    z-index: 100;
}

.tp-bottom-nav__item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 0;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    color: var(--text-light);
    font-size: 13px;
    font-weight: 600;
    border: none;
    background: none;
    transition: color 0.2s;
}

.tp-bottom-nav__item.active { color: var(--primary); }
.tp-bottom-nav__item__icon { font-size: 22px; }

/* ── Loading ── */
.tp-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.tp-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* ── Utility ── */
.tp-hidden { display: none !important; }

/* ── Chat User Picker ── */
.tp-chat-user-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}

.tp-chat-user-btn {
    padding: 16px 12px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg);
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    -webkit-tap-highlight-color: transparent;
}

.tp-chat-user-btn:active {
    border-color: var(--primary);
    background: rgba(26,26,46,0.05);
}

.tp-chat-user-custom {
    display: flex;
    gap: 8px;
}

.tp-chat-user-custom input {
    flex: 1;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    background: var(--bg);
}

.tp-chat-header__user {
    font-size: 12px;
    color: var(--blue);
    background: #eef2ff;
    padding: 2px 10px;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 500;
}

/* ── Hotel Banner ── */
.tp-hotel-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 8px 16px 0;
    padding: 10px 14px;
    background: linear-gradient(135deg, #fef9c3, #fef3c7);
    border-radius: var(--radius-sm);
    border: 1px solid #fde68a;
}

.tp-hotel-banner__icon {
    font-size: 20px;
    flex-shrink: 0;
}

.tp-hotel-banner__label {
    font-size: 11px;
    color: var(--text-light);
    font-weight: 500;
}

.tp-hotel-banner__name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

/* ── Drag Sort ── */
.tp-drag-handle {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    font-size: 16px;
    cursor: grab;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
    touch-action: none;
}

.tp-item-card.tp-dragging {
    opacity: 0.9;
    box-shadow: var(--shadow-lg);
    transform: scale(1.02);
}

.tp-drag-placeholder {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    margin-bottom: 12px;
    background: rgba(59,130,246,0.05);
}

/* ── Edit Item Button ── */
.tp-action-btn.edit-item {
    background: #eef2ff;
    color: var(--blue);
    border-color: #c7d2fe;
}

.tp-action-btn.edit-item:active {
    background: #c7d2fe;
}

/* ── Form Buttons (Cancel + Submit) ── */
.tp-form-buttons {
    display: flex;
    gap: 10px;
    margin-top: 8px;
}

.tp-form-buttons .tp-submit-btn {
    flex: 1;
    margin-top: 0;
}

.tp-cancel-btn {
    flex: 0 0 auto;
    padding: 14px 20px;
    background: var(--bg);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.tp-cancel-btn:active {
    background: var(--border);
}

/* ── Confirm Dialog ── */
.tp-confirm-dialog {
    background: var(--card);
    border-radius: var(--radius);
    padding: 24px 20px;
    margin: auto;
    width: 85%;
    max-width: 340px;
    text-align: center;
}

.tp-confirm-dialog__title {
    font-size: 17px;
    font-weight: 700;
    margin-bottom: 8px;
}

.tp-confirm-dialog__text {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 20px;
    line-height: 1.5;
}

.tp-confirm-dialog .tp-form-buttons {
    justify-content: center;
}

.tp-delete-yes {
    background: #ef4444 !important;
}

.tp-delete-yes:active {
    background: #dc2626 !important;
}

.tp-action-btn.delete-item {
    background: #ef4444;
    color: #fff;
    border-color: #ef4444;
}

.tp-action-btn.delete-item:active {
    background: #dc2626;
}

/* ── Constrain images/emojis inside chat messages ── */
.tp-chat-msg img,
.tp-chat-msg svg {
    max-width: 100%;
    max-height: 200px;
}

/* ── AI Add Item Card ── */
.tp-ai-add-card {
    background: var(--bg);
    border: 1px solid var(--blue);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    margin-top: 6px;
    font-size: 13px;
    line-height: 1.4;
}

.tp-ai-add-card__title {
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 4px;
    color: var(--text);
}

.tp-ai-add-card__row {
    font-size: 12px;
    color: var(--text-secondary);
    padding: 1px 0;
}

.tp-ai-add-card__row b {
    color: var(--text);
}

.tp-ai-add-card .tp-form-buttons {
    margin-top: 8px;
}

.tp-ai-add-card .tp-submit-btn {
    font-size: 13px;
    padding: 8px 14px;
}

.tp-ai-add-card .tp-cancel-btn {
    font-size: 13px;
    padding: 8px 14px;
}

/* ── Currency Converter ── */
.tp-converter {
    padding: 12px 16px;
}

.tp-converter__rate-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: var(--card);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 12px;
}

.tp-converter__rate-badge {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-light);
}

.tp-converter__inputs {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 12px 14px;
    margin-bottom: 12px;
}

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

.tp-converter__label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    width: 56px;
    flex-shrink: 0;
}

.tp-converter__input-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 4px;
}

.tp-converter__symbol {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
}

.tp-converter__input {
    flex: 1;
    font-size: 22px;
    font-weight: 700;
    border: none;
    outline: none;
    background: transparent;
    color: var(--text);
    font-family: inherit;
    padding: 4px 0;
    -moz-appearance: textfield;
}

.tp-converter__input::-webkit-outer-spin-button,
.tp-converter__input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.tp-converter__input::placeholder {
    color: var(--border);
}

.tp-converter__swap {
    text-align: center;
    font-size: 16px;
    color: var(--text-light);
    padding: 4px 0;
}

.tp-converter__presets {
    margin-top: 4px;
}

.tp-converter__preset-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.tp-converter__preset {
    padding: 8px 10px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: all 0.15s;
    text-align: center;
    color: var(--text-light);
}

.tp-converter__preset b {
    color: var(--text);
}

.tp-converter__preset:active {
    background: var(--bg);
    border-color: var(--blue);
}

/* ── Twemoji image sizing ── */
img.emoji {
    height: 1em;
    width: 1em;
    margin: 0 .05em 0 .1em;
    vertical-align: -0.1em;
    display: inline-block;
}
.tp-bottom-nav__item__icon img.emoji { height: 22px; width: 22px; margin: 0; }
.tp-item-card__meta-icon img.emoji { height: 16px; width: 16px; margin: 0; }
.tp-pin-screen__logo img.emoji { height: 48px; width: 48px; }

/* ── Tablet+ ── */
@media (min-width: 768px) {
    #trip-planner-app { max-width: 480px; }
}
