/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg: #000;
    --card: #111;
    --border: #1a1a1a;
    --text: #eee;
    --dim: #555;
}

html, body {
    font-family: 'DM Sans', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

a { color: var(--dim); text-decoration: none; }
a:hover { color: var(--text); }

/* --- Login --- */
.login-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
}
.login-box {
    text-align: center;
    padding: 2rem;
}
.login-box h1 {
    font-size: 2rem;
    font-weight: 300;
    letter-spacing: 2px;
    margin-bottom: 4px;
}
.login-sub {
    color: var(--dim);
    font-size: 0.85rem;
    margin-bottom: 24px;
}
.login-box input {
    display: block;
    width: 100%;
    padding: 10px 12px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-family: inherit;
    font-size: 1rem;
    margin-bottom: 12px;
    text-align: center;
}
.login-box input:focus { outline: none; border-color: #444; }
.login-box button {
    padding: 10px 32px;
    background: #fff;
    color: #000;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.95rem;
    cursor: pointer;
}
.error { color: #888; margin-top: 12px; font-size: 0.85rem; }

/* --- Top Bar --- */
.top-bar {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: rgba(0,0,0,0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
}
.top-bar h1 {
    font-size: 1.3rem;
    font-weight: 300;
    letter-spacing: 1px;
}
.top-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* --- Mode Toggle --- */
.mode-btn {
    background: none;
    color: var(--dim);
    border: 1px solid #2a2a2a;
    border-radius: 8px;
    padding: 6px 14px;
    font-family: inherit;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
}
.mode-btn:active { background: #111; }

/* --- Visibility --- */
.hidden { display: none !important; }
[data-mode="execute"] .plan-only { display: none !important; }
[data-mode="execute"] .tl-row[data-event-id] { cursor: default; }
[data-mode="execute"] .tl-row[data-hotel-day] { cursor: default; }

/* --- Buttons --- */
.icon-btn {
    background: none;
    color: var(--dim);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 16px;
    font-family: inherit;
    font-size: 0.85rem;
    cursor: pointer;
}
.icon-btn:active { background: #111; }
.icon-btn.small { padding: 2px 8px; font-size: 0.85rem; border: none; }

/* --- Execute Nav --- */
.exec-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 20px 12px;
    border-bottom: 1px solid var(--border);
}
[data-mode="plan"] .exec-nav { display: none; }

.exec-nav-day {
    text-align: center;
}
.exec-weekday {
    display: block;
    font-size: 1.3rem;
    font-weight: 500;
    color: #fff;
}
.exec-datestr {
    display: block;
    font-size: 0.8rem;
    color: var(--dim);
    margin-top: 2px;
}
.exec-nav-btn {
    background: none;
    border: 1px solid #222;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    color: var(--dim);
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
}
.exec-nav-btn:active { background: #111; }

/* --- Empty State --- */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: var(--dim);
}

/* --- Day Divider --- */
.day-divider {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 32px 20px 10px;
    margin-left: 52px;
}
.day-divider-text {
    display: flex;
    align-items: baseline;
    gap: 8px;
}
.day-weekday {
    font-size: 1rem;
    font-weight: 500;
    color: #fff;
}
.day-datestr {
    font-size: 0.75rem;
    color: var(--dim);
    font-weight: 400;
}
.day-divider.today .day-weekday {
    color: #fff;
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* --- Timeline Rows --- */
.timeline {
    padding: 0 16px 80px;
}

.tl-row {
    display: flex;
    align-items: stretch;
    cursor: pointer;
    min-height: 56px;
}
.tl-row:active .tl-content { background: #0a0a0a; }

/* --- Track (line + icon) --- */
.tl-track {
    width: 52px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.tl-line {
    flex: 1;
    width: 2px;
    background: #333;
    min-height: 8px;
}
.tl-line.last {
    background: linear-gradient(to bottom, #333, transparent);
}

.tl-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #1a1a1a;
    border: 2px solid #333;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #999;
}
.tl-icon svg {
    width: 16px;
    height: 16px;
}
.tl-icon.add {
    background: none;
    border: 2px dashed #2a2a2a;
    color: #444;
    font-size: 1rem;
}

/* --- Content --- */
.tl-content {
    flex: 1;
    padding: 10px 12px;
    min-width: 0;
    border-radius: 8px;
    transition: background 0.1s;
}

.tl-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
}

.tl-name {
    font-size: 0.9rem;
    font-weight: 500;
}

.tl-time {
    font-size: 0.7rem;
    color: var(--dim);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.confirmed-badge {
    display: inline-block;
    font-size: 0.55rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--dim);
    border: 1px solid #2a2a2a;
    padding: 1px 6px;
    border-radius: 3px;
    margin-top: 2px;
}

.tl-location {
    font-size: 0.75rem;
    color: var(--dim);
    margin-top: 2px;
}
.tl-location a { color: var(--dim); text-decoration: underline; text-decoration-color: #333; }
.tl-location a:hover { color: var(--text); }

/* --- Detail row with thumbnail --- */
.tl-detail {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}
.tl-detail-text {
    flex: 1;
    min-width: 0;
}

/* --- Map Thumbnail --- */
.tl-thumb {
    width: 56px;
    height: 56px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    border: 1px solid #222;
    display: block;
}
.tl-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.tl-thumb-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.55rem;
    color: #444;
    background: #0a0a0a;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tl-notes {
    font-size: 0.75rem;
    color: var(--dim);
    margin-top: 3px;
    font-style: italic;
}

/* --- Meal Options --- */
.tl-options {
    margin-top: 4px;
}
.tl-option {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    padding: 2px 0;
    color: #777;
}
.tl-option a { color: var(--dim); font-size: 0.7rem; }

/* --- Attachments --- */
.tl-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}
.tl-attachment {
    font-size: 0.65rem;
    padding: 2px 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--dim);
}

/* --- Add Row --- */
.add-row { opacity: 0.5; }
.add-row:active { opacity: 0.8; }

.dim { color: var(--dim); font-size: 0.8rem; }

/* --- Modal --- */
.modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: flex-end;
    justify-content: center;
}
.modal.hidden { display: none; }
.modal-content {
    background: #111;
    border: 1px solid #222;
    border-radius: 16px 16px 0 0;
    padding: 24px 20px;
    width: 100%;
    max-width: 500px;
    max-height: 85vh;
    overflow-y: auto;
}

.modal h3 {
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 16px;
}

.form-group {
    margin-bottom: 14px;
}
.form-group label {
    display: block;
    font-size: 0.75rem;
    color: var(--dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    background: #0a0a0a;
    border: 1px solid #222;
    border-radius: 8px;
    color: var(--text);
    font-family: inherit;
    font-size: 0.9rem;
}
.form-group textarea { resize: vertical; min-height: 60px; }
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #444;
}

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

.btn {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    width: 100%;
}
.btn-primary { background: #fff; color: #000; }
.btn-primary:active { background: #ddd; }
.btn-danger { background: #1a1a1a; color: #888; margin-top: 8px; }
.btn-danger:active { background: #222; }
.btn-secondary { background: var(--card); color: var(--text); border: 1px solid #222; margin-top: 8px; }

.btn-row {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}
.btn-row .btn { flex: 1; }

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
}
.checkbox-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #fff;
}
.checkbox-row label {
    font-size: 0.85rem;
    color: var(--text);
    text-transform: none;
    letter-spacing: 0;
}

/* --- Day Menu Modal --- */
.menu-option {
    padding: 14px 0;
    border-bottom: 1px solid #222;
    cursor: pointer;
    font-size: 0.9rem;
}
.menu-option:last-child { border: none; }
.menu-option:active { color: var(--dim); }
.menu-option.danger { color: #888; }

/* --- Day Map --- */
.day-map {
    height: 300px;
    margin: 0 16px 80px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #222;
}
.day-map.hidden { display: none; }

.map-marker {
    background: none !important;
    border: none !important;
}
.map-marker-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
}
.map-marker-emoji {
    font-size: 20px;
    filter: drop-shadow(0 1px 3px rgba(0,0,0,0.8));
}
.map-marker-num {
    font-size: 0.55rem;
    font-weight: 600;
    color: #fff;
    background: #333;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: -4px;
    font-family: 'DM Sans', sans-serif;
}

.leaflet-popup-content-wrapper {
    background: #1a1a1a !important;
    color: #eee !important;
    border-radius: 8px !important;
    font-family: 'DM Sans', sans-serif !important;
    font-size: 0.8rem !important;
}
.leaflet-popup-tip { background: #1a1a1a !important; }
.leaflet-popup-close-button { color: #888 !important; }

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #222; border-radius: 4px; }
