/* ===== K-Tripjoa — Minimal Design System ===== */

:root {
    --bg: #ffffff;
    --bg-soft: #fafafa;
    --bg-muted: #f5f5f5;
    --text: #171717;
    --text-secondary: #737373;
    --text-tertiary: #a3a3a3;
    --border: #e5e5e5;
    --border-light: #f0f0f0;
    --accent: #4f46e5;
    --accent-hover: #4338ca;
    --accent-light: #eef2ff;
    --accent-text: #3730a3;
    --purple: #7c3aed;
    --success: #059669;
    --success-bg: #ecfdf5;
    --warning: #d97706;
    --warning-bg: #fffbeb;
    --error: #dc2626;
    --error-bg: #fef2f2;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
    --transition: 150ms ease;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ===== Nav ===== */
.nav {
    border-bottom: 1px solid var(--border-light);
    background: var(--bg);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-inner {
    max-width: 640px;
    margin: 0 auto;
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
}

.logo-k {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: var(--accent);
    color: white;
    font-weight: 800;
    font-size: 15px;
    letter-spacing: -0.5px;
}

.logo-text {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.5px;
}

.logo-joa {
    font-weight: 300;
    color: var(--purple);
}

.lang-select {
    font-size: 13px;
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg);
    color: var(--text-secondary);
    cursor: pointer;
    outline: none;
}

.lang-select:focus {
    border-color: var(--accent);
}

/* ===== Main Container ===== */
.main-container {
    max-width: 480px;
    margin: 0 auto;
    padding: 3rem 1.5rem 2rem;
    flex: 1;
}

.result-container {
    max-width: 640px;
    margin: 0 auto;
    padding: 1.5rem 1.5rem 2rem;
}

/* ===== Hero ===== */
.hero {
    text-align: center;
    margin-bottom: 2rem;
}

.hero-title {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--text);
    margin-bottom: 0.5rem;
}

.hero-sub {
    font-size: 0.9375rem;
    color: var(--text-tertiary);
    font-weight: 400;
}

/* ===== Form ===== */
.form-card {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.label-opt {
    font-weight: 400;
    color: var(--text-tertiary);
}

.input {
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 0.9375rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg);
    color: var(--text);
    outline: none;
    transition: border-color var(--transition);
    font-family: inherit;
}

.input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.input::placeholder {
    color: var(--text-tertiary);
}

.row {
    display: flex;
    gap: 0.75rem;
}

.flex-1 { flex: 1; }
.w-days { width: 80px; }

/* ===== Presets ===== */
.preset-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
}

.preset-btn {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 100px;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
    white-space: nowrap;
}

.preset-btn:hover {
    border-color: var(--text-secondary);
    color: var(--text);
}

.preset-btn.active {
    background: var(--text);
    color: white;
    border-color: var(--text);
}

/* ===== Buttons ===== */
.btn-primary {
    width: 100%;
    padding: 0.75rem;
    font-size: 0.9375rem;
    font-weight: 600;
    color: white;
    background: var(--text);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
    letter-spacing: -0.2px;
}

.btn-primary:hover {
    background: #333;
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-ghost {
    padding: 0.5rem 0.75rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
}

.btn-ghost:hover {
    background: var(--bg-muted);
    color: var(--text);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
}

.form-note {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-tertiary);
    margin-top: 0.25rem;
}

/* ===== Features ===== */
.features {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-top: 2.5rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-light);
}

.feature {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.feature-icon {
    font-size: 1rem;
}

.feature-text {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    font-weight: 400;
}

/* ===== Loading ===== */
.loading-wrap {
    text-align: center;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--text);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 1.25rem;
}

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

.loading-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.375rem;
}

.loading-sub {
    font-size: 0.8125rem;
    color: var(--text-tertiary);
}

/* ===== Error ===== */
.error-card {
    text-align: center;
    padding: 2rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.error-emoji {
    font-size: 2rem;
    margin-bottom: 0.75rem;
}

.error-text {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

/* ===== Results ===== */
.trip-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.trip-title {
    font-size: 1.375rem;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.trip-summary {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* Day tabs */
.day-tabs {
    display: flex;
    gap: 0.375rem;
    margin-bottom: 1.25rem;
    overflow-x: auto;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.day-tabs::-webkit-scrollbar { display: none; }

.day-tab {
    flex-shrink: 0;
    padding: 0.4375rem 0.875rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 100px;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
}

.day-tab:hover {
    border-color: var(--text-secondary);
    color: var(--text);
}

.day-tab.active {
    background: var(--text);
    color: white;
    border-color: var(--text);
}

/* Day card */
.day-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 0;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-light);
}

.day-label {
    font-size: 0.9375rem;
    font-weight: 600;
}

.day-date {
    font-size: 0.75rem;
    color: var(--text-tertiary);
}

/* Timeline */
.timeline-card {
    position: relative;
    padding-left: 2.25rem;
    padding-bottom: 1.25rem;
}

.timeline-card::before {
    content: '';
    position: absolute;
    left: 0.6875rem;
    top: 1.5rem;
    bottom: 0;
    width: 1px;
    background: var(--border);
}

.timeline-card:last-child::before {
    display: none;
}

.timeline-dot {
    position: absolute;
    left: 0;
    top: 0.25rem;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6875rem;
    background: var(--bg-muted);
    z-index: 1;
}

.slot-card {
    background: var(--bg);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 0.875rem 1rem;
    transition: all var(--transition);
}

.slot-card:hover {
    border-color: var(--border);
    box-shadow: var(--shadow);
}

.slot-time {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent);
}

.slot-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.slot-duration {
    font-size: 0.6875rem;
    color: var(--text-tertiary);
}

.slot-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.125rem;
}

.slot-desc {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.slot-address {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    margin-top: 0.375rem;
}

.slot-tags {
    display: flex;
    gap: 0.375rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}

.tag {
    display: inline-block;
    font-size: 0.6875rem;
    font-weight: 500;
    padding: 0.125rem 0.5rem;
    border-radius: 100px;
}

.tag-tip {
    background: var(--warning-bg);
    color: var(--warning);
}

.tag-cost {
    background: var(--success-bg);
    color: var(--success);
}

/* Weather badge */
.weather-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-muted);
    padding: 0.25rem 0.625rem;
    border-radius: 100px;
}

/* Tips */
.tips-card {
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin-top: 1.25rem;
}

.tips-title {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.tips-list {
    list-style: none;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

/* Share bar */
.share-bar {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-light);
}

.share-bar .btn-primary {
    width: auto;
}

/* ===== Footer ===== */
.footer {
    text-align: center;
    padding: 2rem 1.5rem;
    border-top: 1px solid var(--border-light);
    margin-top: auto;
}

.footer p {
    font-size: 0.8125rem;
    color: var(--text-tertiary);
    font-weight: 400;
}

.footer-sub {
    font-size: 0.6875rem !important;
    margin-top: 0.25rem;
}

/* ===== Map ===== */
.map-container {
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    margin-bottom: 1.25rem;
}

.kakao-map {
    width: 100%;
    height: 280px;
}

.map-marker {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    background: var(--accent);
    color: white;
    font-size: 12px;
    font-weight: 700;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    font-family: 'Inter', sans-serif;
}

.btn-map-focus {
    display: inline-block;
    font-size: 0.6875rem;
    font-weight: 500;
    color: var(--accent);
    background: none;
    border: 1px solid var(--accent-light);
    border-radius: 100px;
    padding: 0.125rem 0.5rem;
    margin-top: 0.375rem;
    cursor: pointer;
    font-family: inherit;
    transition: all var(--transition);
}

.btn-map-focus:hover {
    background: var(--accent-light);
}

/* ===== Slot Images ===== */
.slot-card.has-image {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}

.slot-image-wrap {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-muted);
}

.slot-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.slot-content {
    flex: 1;
    min-width: 0;
}

/* ===== Drag & Drop ===== */
.drag-hint {
    font-size: 0.6875rem;
    color: var(--text-tertiary);
    text-align: center;
    margin-bottom: 0.75rem;
}

.timeline-card[draggable="true"] {
    cursor: grab;
}

.timeline-card[draggable="true"]:active {
    cursor: grabbing;
}

.timeline-card.dragging {
    opacity: 0.4;
}

.timeline-card.drag-over > .slot-card {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-light);
}

/* ===== Chat ===== */
.chat-section {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-top: 1.25rem;
    overflow: hidden;
}

.chat-header {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-soft);
}

.chat-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text);
}

.chat-hint {
    display: block;
    font-size: 0.6875rem;
    color: var(--text-tertiary);
    margin-top: 0.125rem;
}

.chat-messages {
    min-height: 40px;
    max-height: 300px;
    overflow-y: auto;
    padding: 0.75rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.chat-messages:empty {
    display: none;
}

.chat-bubble {
    max-width: 85%;
    padding: 0.5rem 0.75rem;
    border-radius: 12px;
    font-size: 0.8125rem;
    line-height: 1.4;
    word-wrap: break-word;
}

.chat-user {
    align-self: flex-end;
    background: var(--text);
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-bot {
    align-self: flex-start;
    background: var(--bg-muted);
    color: var(--text);
    border-bottom-left-radius: 4px;
}

.chat-typing {
    opacity: 0.5;
    font-style: italic;
}

.chat-input-wrap {
    display: flex;
    gap: 0;
    border-top: 1px solid var(--border-light);
}

.chat-input {
    flex: 1;
    border: none;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    font-family: inherit;
    outline: none;
    background: var(--bg);
}

.chat-input::placeholder {
    color: var(--text-tertiary);
}

.chat-send {
    padding: 0.75rem 1rem;
    background: none;
    border: none;
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--accent);
    cursor: pointer;
    font-family: inherit;
    transition: all var(--transition);
}

.chat-send:hover {
    background: var(--accent-light);
}

.chat-send:disabled {
    color: var(--text-tertiary);
    cursor: not-allowed;
}

/* ===== Utilities ===== */
.hidden { display: none !important; }

/* ===== Print ===== */
@media print {
    .nav, .footer, #heroSection, .btn-primary, .btn-ghost, .day-tabs, .share-bar { display: none !important; }
    #resultSection { display: block !important; }
    .slot-card { break-inside: avoid; border: 1px solid #ddd; box-shadow: none; }
    body { background: white; }
}

/* ===== Mobile ===== */
@media (max-width: 640px) {
    .main-container { padding: 2rem 1.25rem 1.5rem; }
    .result-container { padding: 1.25rem 1rem 1.5rem; }
    .hero-title { font-size: 1.5rem; }
    .features { gap: 0.5rem; }
    .timeline-card { padding-left: 2rem; }
    .timeline-dot { width: 1.25rem; height: 1.25rem; font-size: 0.625rem; }
    .timeline-card::before { left: 0.5625rem; }
    .trip-header { flex-direction: column; gap: 0.5rem; }
    .kakao-map { height: 220px; }
    .slot-card.has-image { flex-direction: column; }
    .slot-image-wrap { width: 100%; height: 140px; }
}
