/* ===== London Trip Dashboard — Dark Theme with Amber Accents ===== */

:root {
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-tertiary: #1c2128;
    --bg-hover: #1f2937;
    --border: #30363d;
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-muted: #6e7681;
    --accent: #f0a500;
    --accent-dim: #d4940a;
    --accent-bg: rgba(240, 165, 0, 0.1);
    --success: #3fb950;
    --warning: #d29922;
    --danger: #f85149;
    --link: #58a6ff;
    --radius: 12px;
    --radius-sm: 8px;
    --nav-height: 64px;
    --top-bar-height: 52px;
}

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

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    padding-top: var(--top-bar-height);
    padding-bottom: calc(var(--nav-height) + 16px);
    -webkit-font-smoothing: antialiased;
}

/* ===== Top Bar ===== */
.top-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--top-bar-height);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    z-index: 100;
    display: flex;
    align-items: center;
}

.top-bar-content {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.page-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--accent);
}

.logout-btn {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 6px;
    display: flex;
    align-items: center;
}

.logout-btn:hover {
    color: var(--text-primary);
}

/* ===== Main Content ===== */
.content {
    max-width: 600px;
    margin: 0 auto;
    padding: 16px;
}

/* ===== Bottom Navigation ===== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-around;
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 0.65rem;
    gap: 2px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    transition: color 0.2s;
    min-width: 56px;
}

.nav-item:active {
    background: var(--bg-hover);
}

.nav-item.active {
    color: var(--accent);
}

.nav-item span {
    margin-top: 1px;
}

/* ===== Cards ===== */
.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 12px;
    overflow: hidden;
}

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

.card-header h2 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

.card-link {
    font-size: 0.8rem;
    color: var(--accent);
    text-decoration: none;
}

.card-body {
    padding: 12px 16px;
}

.accent-card {
    border-color: var(--accent-dim);
    background: linear-gradient(135deg, var(--bg-secondary), rgba(240, 165, 0, 0.05));
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    gap: 6px;
}

.btn-primary {
    background: var(--accent);
    color: #000;
}

.btn-primary:hover, .btn-primary:active {
    background: var(--accent-dim);
}

.btn-outline {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-outline:hover, .btn-outline:active {
    background: var(--bg-hover);
    border-color: var(--text-secondary);
}

.btn-full {
    width: 100%;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
}

.btn-icon:hover {
    color: var(--text-primary);
}

.btn-danger {
    color: var(--danger);
}

.btn-danger:hover {
    color: #ff7b73;
}

/* ===== Forms ===== */
.form-page {
    padding-bottom: 20px;
}

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

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

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 1rem;
    font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.form-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 20px;
}

/* ===== Dashboard ===== */
.trip-status {
    text-align: center;
    padding: 8px 0;
}

.trip-dates .label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.trip-clock {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--accent);
    margin-top: 4px;
    font-variant-numeric: tabular-nums;
}

.trip-countdown {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 400;
    margin-top: 2px;
}

.trip-live {
    font-size: 0.85rem;
    color: var(--success);
    font-weight: 500;
    margin-top: 2px;
}

/* Quick Nav */
.quick-nav {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 12px;
}

.quick-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 12px 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text-primary);
    font-size: 0.75rem;
}

.quick-btn:active {
    background: var(--bg-hover);
}

.quick-icon {
    font-size: 1.3rem;
}

/* Booking mini cards */
.booking-mini {
    display: flex;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    align-items: flex-start;
}

.booking-mini:last-child {
    border-bottom: none;
}

.booking-time {
    font-size: 0.8rem;
    color: var(--accent);
    font-weight: 600;
    min-width: 90px;
    font-variant-numeric: tabular-nums;
}

.booking-date-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 42px;
    background: var(--accent-bg);
    border-radius: var(--radius-sm);
    padding: 4px 8px;
}

.badge-day {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent);
    line-height: 1.2;
}

.badge-month {
    font-size: 0.65rem;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.booking-info {
    flex: 1;
    font-size: 0.85rem;
}

.booking-info strong {
    color: var(--text-primary);
}

/* Tips */
.tip {
    padding: 8px 0;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--border);
}

.tip:last-child {
    border-bottom: none;
}

.tip code {
    background: var(--accent-bg);
    color: var(--accent);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.85em;
}

/* ===== Bookings Page ===== */
.date-header {
    padding: 12px 0 6px;
}

.date-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.booking-card .card-body {
    padding: 12px 16px 14px;
}

.booking-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.booking-header h3 {
    font-size: 1rem;
    font-weight: 600;
    flex: 1;
    padding-right: 8px;
}

.booking-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.booking-detail {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    padding: 3px 0;
}

.detail-icon {
    flex-shrink: 0;
    width: 20px;
    text-align: center;
}

.map-link {
    color: var(--link);
    text-decoration: none;
    font-size: 0.8rem;
    margin-left: 4px;
}

.booking-notes {
    margin-top: 8px;
    padding: 10px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    font-size: 0.83rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* ===== Weather ===== */
.weather-current {
    text-align: center;
    padding: 8px 0 16px;
}

.weather-main {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.weather-icon-large {
    font-size: 2.5rem;
}

.weather-temp-large {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.weather-desc {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.weather-details {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 8px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.forecast-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 12px;
    border-top: 1px solid var(--border);
    padding-top: 12px;
}

.forecast-day {
    text-align: center;
    padding: 8px 4px;
    border-radius: var(--radius-sm);
}

.forecast-day.trip-day {
    background: var(--accent-bg);
    border: 1px solid rgba(240, 165, 0, 0.2);
}

.forecast-date {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.trip-badge {
    display: inline-block;
    font-size: 0.55rem;
    background: var(--accent);
    color: #000;
    padding: 1px 4px;
    border-radius: 3px;
    font-weight: 700;
    vertical-align: middle;
    margin-left: 2px;
}

.forecast-icon {
    font-size: 1.5rem;
    margin: 4px 0;
}

.forecast-temps {
    font-size: 0.85rem;
}

.temp-high {
    color: var(--text-primary);
    font-weight: 600;
}

.temp-low {
    color: var(--text-muted);
    margin-left: 4px;
}

.forecast-precip {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.forecast-desc {
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ===== Trains ===== */
.rec-section {
    margin-bottom: 20px;
}

.rec-section:last-child {
    margin-bottom: 0;
}

.rec-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 4px;
}

.train-rec {
    padding: 10px;
    margin: 8px 0;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--border);
}

.train-rec.recommended {
    border-left-color: var(--success);
    background: rgba(63, 185, 80, 0.05);
}

.train-rec.tight {
    border-left-color: var(--warning);
    background: rgba(210, 153, 34, 0.05);
}

.train-times {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 4px;
    font-variant-numeric: tabular-nums;
}

.arrow {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.train-note {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.badge {
    display: inline-block;
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
    text-transform: uppercase;
    margin-right: 4px;
    vertical-align: middle;
}

.badge-ok {
    background: rgba(63, 185, 80, 0.15);
    color: var(--success);
}

.badge-warn {
    background: rgba(210, 153, 34, 0.15);
    color: var(--warning);
}

/* Journey tips */
.journey-tip {
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.journey-tip:last-child {
    border-bottom: none;
}

.journey-tip h4 {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 6px;
}

.tip-steps {
    padding-left: 20px;
    font-size: 0.83rem;
    color: var(--text-secondary);
}

.tip-steps li {
    padding: 2px 0;
}

/* Timetable */
.timetable {
    max-height: 400px;
    overflow-y: auto;
}

.timetable-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--border);
    font-variant-numeric: tabular-nums;
}

.timetable-row:last-child {
    border-bottom: none;
}

.tt-depart {
    font-weight: 600;
    min-width: 50px;
}

.tt-arrow {
    color: var(--text-muted);
}

.tt-arrive {
    min-width: 50px;
}

.tt-duration {
    color: var(--text-muted);
    margin-left: auto;
    font-size: 0.8rem;
}

/* ===== Chat ===== */
.chat-page {
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--top-bar-height) - var(--nav-height) - 32px);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 8px;
}

.chat-welcome {
    text-align: center;
    padding: 32px 16px;
    color: var(--text-secondary);
}

.welcome-icon {
    font-size: 2.5rem;
    margin-bottom: 8px;
}

.chat-welcome h3 {
    color: var(--text-primary);
    margin-bottom: 8px;
}

.chat-welcome p {
    font-size: 0.85rem;
    margin-bottom: 16px;
}

.quick-prompts {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.prompt-btn {
    padding: 8px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 20px;
    color: var(--text-primary);
    font-size: 0.8rem;
    cursor: pointer;
}

.prompt-btn:active {
    background: var(--bg-hover);
}

.chat-msg {
    display: flex;
    margin-bottom: 10px;
}

.chat-msg.user {
    justify-content: flex-end;
}

.chat-msg.assistant {
    justify-content: flex-start;
}

.chat-bubble {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 0.9rem;
    line-height: 1.5;
    word-wrap: break-word;
}

.user-bubble {
    background: var(--accent);
    color: #000;
    border-bottom-right-radius: 4px;
}

.assistant-bubble {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-bottom-left-radius: 4px;
}

.chat-input-area {
    padding-top: 8px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.chat-form {
    display: flex;
}

.chat-input-row {
    display: flex;
    gap: 8px;
    width: 100%;
}

.chat-input-row textarea {
    flex: 1;
    padding: 10px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 20px;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: inherit;
    resize: none;
    max-height: 100px;
    line-height: 1.4;
}

.chat-input-row textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.send-btn {
    background: var(--accent);
    color: #000;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}

.send-btn:disabled {
    opacity: 0.5;
}

.chat-actions {
    text-align: center;
    padding-top: 6px;
}

.chat-loading {
    display: flex;
    gap: 4px;
    padding: 8px 14px;
}

.chat-loading .dot {
    width: 8px;
    height: 8px;
    background: var(--text-muted);
    border-radius: 50%;
    animation: chatPulse 1.4s infinite;
}

.chat-loading .dot:nth-child(2) { animation-delay: 0.2s; }
.chat-loading .dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes chatPulse {
    0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
    40% { opacity: 1; transform: scale(1); }
}

/* ===== Links ===== */
.sub-nav {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    padding: 4px;
    border: 1px solid var(--border);
}

.sub-nav-item {
    flex: 1;
    text-align: center;
    padding: 8px 12px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-weight: 500;
}

.sub-nav-item.active {
    background: var(--accent-bg);
    color: var(--accent);
}

.link-list {
    padding: 4px 0;
}

.link-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 4px;
    text-decoration: none;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border);
    font-size: 0.88rem;
}

.link-item:last-child {
    border-bottom: none;
}

.link-item:active {
    background: var(--bg-hover);
}

.link-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
    width: 28px;
    text-align: center;
}

.link-name {
    flex: 1;
}

.link-external {
    color: var(--text-muted);
    flex-shrink: 0;
}

/* Notes */
.note-item {
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.note-item:last-child {
    border-bottom: none;
}

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

.note-content {
    font-size: 0.85rem;
    color: var(--text-secondary);
    white-space: pre-line;
}

.add-note-section {
    margin-top: 12px;
}

.add-note-section summary {
    cursor: pointer;
}

.note-form {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.note-title-input,
.note-form textarea {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: inherit;
}

.note-form textarea:focus,
.note-title-input:focus {
    outline: none;
    border-color: var(--accent);
}

/* ===== Tube Status ===== */
.tube-line {
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.tube-line:last-child {
    border-bottom: none;
}

.tube-line-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.tube-colour {
    width: 8px;
    height: 24px;
    border-radius: 4px;
    flex-shrink: 0;
}

.tube-name {
    font-weight: 600;
    font-size: 0.9rem;
    flex: 1;
}

.tube-status-badge {
    font-size: 0.7rem;
    padding: 3px 8px;
    border-radius: 12px;
    font-weight: 600;
}

.tube-relevance {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-left: 18px;
    margin-top: 2px;
}

.tube-reason {
    font-size: 0.8rem;
    color: var(--warning);
    margin-left: 18px;
    margin-top: 4px;
    line-height: 1.4;
}

/* ===== Login ===== */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    padding-bottom: 0;
}

.login-container {
    width: 100%;
    max-width: 340px;
    text-align: center;
}

.login-header {
    margin-bottom: 32px;
}

.login-icon {
    font-size: 3rem;
    margin-bottom: 12px;
}

.login-header h1 {
    font-size: 1.6rem;
    color: var(--accent);
    margin-bottom: 4px;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.login-form label {
    display: block;
    text-align: left;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.login-form input {
    width: 100%;
    padding: 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 1.5rem;
    text-align: center;
    letter-spacing: 8px;
    margin-bottom: 16px;
}

.login-form input:focus {
    outline: none;
    border-color: var(--accent);
}

/* ===== Utilities ===== */
.text-muted {
    color: var(--text-muted);
}

.text-sm {
    font-size: 0.8rem;
}

.alert {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    margin-bottom: 12px;
}

.alert-error {
    background: rgba(248, 81, 73, 0.1);
    color: var(--danger);
    border: 1px solid rgba(248, 81, 73, 0.2);
}

.loading-spinner {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 12px;
}

code {
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.85em;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 2px;
}

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

.card {
    animation: fadeIn 0.2s ease-out;
}
