/* ── Reset & base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
	font-family: 'DM Sans', sans-serif;
	background: #FDF6ED;
	color: #2C1A0E;
	min-height: 100vh;
}

/* ── CSS variables ── */
:root {
	--bg:        #FDF6ED;
	--bg-input:  #F5ECD9;
	--bg-card:   #FFFAF4;
	--border:    #E8D5B7;
	--border-md: #D4B896;
	--text-dark: #2C1A0E;
	--text-mid:  #5C3D1E;
	--text-soft: #9A7B5A;
	--text-faint:#A08060;
	--accent:    #E8832A;
	--accent-dk: #C4935A;
	--badge-bg:  #FBE8C8;
	--badge-txt: #9A6B2E;
}

/* ── Typography ── */
h1, h2, .serif { font-family: 'Playfair Display', serif; }

/* ── Layout ── */
.page { max-width: 640px; margin: 0 auto; padding: 0 24px 64px; }

/* ── Header ── */
header {
	text-align: center;
	padding: 52px 24px 40px;
	border-bottom: 0.5px solid var(--border);
}
.badge {
	display: inline-block;
	font-size: 10px;
	font-weight: 500;
	letter-spacing: 0.1em;
	color: var(--badge-txt);
	background: var(--badge-bg);
	padding: 4px 14px;
	border-radius: 20px;
	margin-bottom: 18px;
}
header h1 {
	font-size: 42px;
	font-weight: 400;
	color: var(--text-dark);
	margin-bottom: 12px;
	letter-spacing: -0.5px;
}
header p {
	font-size: 15px;
	color: var(--text-mid);
	line-height: 1.7;
}
header p span { display: block; }

/* ── Form ── */
.form-section { padding-top: 36px; }
.field { margin-bottom: 22px; }
.field label {
	display: block;
	font-size: 10px;
	font-weight: 500;
	letter-spacing: 0.1em;
	color: var(--text-soft);
	margin-bottom: 7px;
}

/* ── Inputs & selects ── */
input[type="text"],
select {
	width: 100%;
	padding: 11px 14px;
	font-size: 14px;
	font-family: 'DM Sans', sans-serif;
	border: 0.5px solid var(--border-md);
	border-radius: 8px;
	background: var(--bg-input);
	color: var(--text-faint);
	-webkit-appearance: none;
	appearance: none;
	transition: border-color 0.15s, background 0.15s;
}
input[type="text"] { color: var(--text-dark); }
input[type="text"]::placeholder { color: var(--text-faint); }
input[type="text"]:focus,
select:focus {
	outline: none;
	border-color: var(--accent-dk);
	background: #F0E4CC;
}
select.chosen { color: var(--text-dark); }
select option { color: var(--text-dark); background: var(--bg-input); }

/* ── Autocomplete ── */
.autocomplete-wrap { position: relative; }
.dropdown {
	position: absolute;
	top: calc(100% + 4px);
	left: 0; right: 0;
	background: var(--bg-input);
	border: 0.5px solid var(--border-md);
	border-radius: 8px;
	overflow: hidden;
	z-index: 100;
	box-shadow: 0 8px 24px rgba(44,26,14,0.08);
}
.dropdown-item {
	padding: 10px 14px;
	font-size: 14px;
	color: var(--text-dark);
	cursor: pointer;
	display: flex;
	align-items: center;
	gap: 10px;
	transition: background 0.1s;
}
.dropdown-item:hover { background: var(--badge-bg); }
.dropdown-item:not(:last-child) { border-bottom: 0.5px solid var(--border); }
.city-name { font-weight: 500; }
.city-country { font-size: 12px; color: var(--text-soft); }

/* ── 3-column row ── */
.row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }

/* ── Pills ── */
.pill {
	padding: 8px 10px;
	font-size: 12px;
	font-weight: 500;
	font-family: 'DM Sans', sans-serif;
	border: 0.5px solid var(--border-md);
	border-radius: 20px;
	text-align: center;
	color: var(--text-mid);
	background: var(--bg-input);
	cursor: pointer;
	transition: all 0.15s ease;
	user-select: none;
}

/* Budget pills */
.pill[data-color="budget"].active  { background: #2A7A4B; color: #fff; border-color: transparent; }
.pill[data-color="medium"].active  { background: #3A6EA8; color: #fff; border-color: transparent; }
.pill[data-color="luxury"].active  { background: #B8860B; color: #fff; border-color: transparent; }

/* Interest pills grid */
.interests-grid {
	display: grid;
	grid-template-columns: repeat(5, 1fr);
	gap: 8px;
}
.interests-grid .pill {
	height: 36px;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0 6px;
	font-size: 11px;
}
.pill[data-color="food"].active        { background: #C0392B; color: #fff; border-color: transparent; }
.pill[data-color="history"].active     { background: #7D5A3C; color: #fff; border-color: transparent; }
.pill[data-color="nature"].active      { background: #27AE60; color: #fff; border-color: transparent; }
.pill[data-color="hiking"].active      { background: #6B8E23; color: #fff; border-color: transparent; }
.pill[data-color="museums"].active     { background: #4A3880; color: #fff; border-color: transparent; }
.pill[data-color="nightlife"].active   { background: #8E44AD; color: #fff; border-color: transparent; }
.pill[data-color="shopping"].active    { background: #C0527A; color: #fff; border-color: transparent; }
.pill[data-color="hidden"].active      { background: #148A82; color: #fff; border-color: transparent; }
.pill[data-color="beaches"].active     { background: #2471A3; color: #fff; border-color: transparent; }
.pill[data-color="photography"].active { background: #D4820A; color: #fff; border-color: transparent; }

/* ── Generate button ── */
.generate-btn {
	width: 100%;
	padding: 15px;
	font-size: 15px;
	font-weight: 500;
	font-family: 'DM Sans', sans-serif;
	background: var(--text-dark);
	color: var(--bg);
	border: none;
	border-radius: 8px;
	cursor: pointer;
	margin-top: 10px;
	transition: background 0.2s;
	letter-spacing: 0.02em;
}
.generate-btn:hover { background: var(--accent); }
.generate-btn:disabled { background: var(--border-md); cursor: not-allowed; }

/* ── Access screen ── */
#access-screen {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	min-height: 100vh;
	padding: 24px;
	text-align: center;
}
#access-screen h2 {
	font-size: 28px;
	font-weight: 400;
	margin-bottom: 8px;
}
#access-screen p {
	font-size: 14px;
	color: var(--text-soft);
	margin-bottom: 24px;
}
#access-screen input {
	max-width: 320px;
	margin-bottom: 12px;
	padding: 11px 14px;
	font-size: 14px;
	font-family: 'DM Sans', sans-serif;
	border: 0.5px solid #D4B896;
	border-radius: 8px;
	background: #F5ECD9;
	color: #2C1A0E;
	-webkit-appearance: none;
	appearance: none;
	width: 100%;
}
#access-screen input::placeholder { color: #A08060; }
#access-screen input:focus {
	outline: none;
	border-color: #C4935A;
	background: #F0E4CC;
}
#access-screen button {
	max-width: 320px;
	width: 100%;
	padding: 12px;
	font-size: 14px;
	font-family: 'DM Sans', sans-serif;
	font-weight: 500;
	background: var(--text-dark);
	color: var(--bg);
	border: none;
	border-radius: 8px;
	cursor: pointer;
	transition: background 0.2s;
}
#access-screen button:hover { background: var(--accent); }
.access-error {
	font-size: 13px;
	color: #C0392B;
	margin-top: 8px;
	display: none;
}

/* ── Loading screen ── */
#loading-screen {
	display: none;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	min-height: 60vh;
	text-align: center;
	padding: 48px 24px;
}
.loading-pulse {
	width: 48px;
	height: 48px;
	border-radius: 50%;
	border: 2px solid var(--border-md);
	border-top-color: var(--accent);
	animation: spin 0.9s linear infinite;
	margin-bottom: 20px;
}
@keyframes spin { to { transform: rotate(360deg); } }
#loading-screen p { font-size: 14px; color: var(--text-soft); }
#streaming-text {
	font-size: 12px;
	color: var(--text-faint);
	margin-top: 8px;
	max-width: 280px;
	line-height: 1.6;
	font-style: italic;
}

/* ── Result screen ── */
#result-screen { display: none; }

/* Back button — shown on results and loading screens */
.back-btn {
	display: block;
	background: none;
	border: none;
	font-family: 'DM Sans', sans-serif;
	font-size: 13px;
	font-weight: 500;
	color: var(--text-soft);
	cursor: pointer;
	padding: 8px 0;
	margin-bottom: 8px;
	transition: color 0.15s;
}
.back-btn:hover { color: var(--text-dark); }

.result-header {
	padding: 36px 0 28px;
	border-bottom: 0.5px solid var(--border);
}
.result-meta {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin-bottom: 14px;
}
.meta-tag {
	font-size: 11px;
	font-weight: 500;
	color: var(--text-mid);
	background: var(--bg-input);
	border: 0.5px solid var(--border-md);
	padding: 3px 10px;
	border-radius: 20px;
}
.result-title {
	font-size: 26px;
	font-weight: 400;
	color: var(--text-dark);
	line-height: 1.3;
	margin-bottom: 12px;
}
.result-overview {
	font-size: 14px;
	color: var(--text-mid);
	line-height: 1.8;
	margin-bottom: 16px;
}
.best-time-badge {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 12px;
	color: var(--badge-txt);
	background: var(--badge-bg);
	padding: 5px 14px;
	border-radius: 20px;
}

/* ── Result sections ── */
.r-section { margin-top: 32px; }
.r-section-title {
	font-size: 10px;
	font-weight: 500;
	letter-spacing: 0.1em;
	color: var(--text-soft);
	margin-bottom: 12px;
}

/* Tips grid */
.tips-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tip-card {
	background: var(--bg-input);
	border: 0.5px solid var(--border);
	border-radius: 8px;
	padding: 12px 14px;
}
.tip-label {
	font-size: 9px;
	font-weight: 500;
	letter-spacing: 0.1em;
	color: var(--text-soft);
	margin-bottom: 5px;
}
.tip-text { font-size: 12px; color: var(--text-dark); line-height: 1.6; }

/* Packing list */
.packing-list { display: flex; flex-wrap: wrap; gap: 8px; }
.pack-item {
	font-size: 12px;
	color: var(--text-mid);
	background: var(--bg-input);
	border: 0.5px solid var(--border-md);
	border-radius: 20px;
	padding: 4px 12px;
}

/* Day cards */
.day-card {
	background: var(--bg-card);
	border: 0.5px solid var(--border);
	border-radius: 12px;
	overflow: hidden;
	margin-bottom: 12px;
}
.day-header {
	padding: 14px 18px;
	border-bottom: 0.5px solid var(--border);
	display: flex;
	align-items: center;
	gap: 12px;
}
.day-num {
	width: 28px;
	height: 28px;
	border-radius: 50%;
	background: var(--accent);
	color: #fff;
	font-size: 12px;
	font-weight: 500;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
}
.day-theme { font-size: 13px; font-weight: 500; color: var(--text-dark); }
.day-row {
	display: flex;
	gap: 14px;
	padding: 11px 18px;
	border-bottom: 0.5px solid #F0E4CC;
	align-items: flex-start;
}
.day-row:last-child { border-bottom: none; }
.time-lbl {
	font-size: 9px;
	font-weight: 500;
	letter-spacing: 0.08em;
	color: var(--accent-dk);
	min-width: 70px;
	padding-top: 2px;
}
.time-activity { font-size: 13px; color: var(--text-dark); line-height: 1.6; }
.time-activity strong { font-weight: 500; }
.time-cost { font-size: 11px; color: var(--text-soft); margin-top: 3px; }

/* Hidden gems */
.gems-list { display: flex; flex-direction: column; gap: 8px; }
.gem-item {
	display: flex;
	gap: 10px;
	align-items: flex-start;
	padding: 11px 14px;
	background: var(--bg-input);
	border: 0.5px solid var(--border);
	border-radius: 8px;
}
.gem-icon { font-size: 14px; flex-shrink: 0; margin-top: 1px; }
.gem-text { font-size: 13px; color: var(--text-dark); line-height: 1.6; }

/* Warnings */
.warnings-list { display: flex; flex-direction: column; gap: 8px; }
.warning-item {
	display: flex;
	gap: 10px;
	align-items: flex-start;
	padding: 11px 14px;
	background: #FBE8C8;
	border: 0.5px solid var(--border);
	border-radius: 8px;
}
.warn-icon { font-size: 14px; flex-shrink: 0; margin-top: 1px; }
.warn-text { font-size: 13px; color: var(--text-dark); line-height: 1.6; }

/* Affiliate cards */
.affiliate-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.aff-card {
	background: var(--bg-card);
	border: 0.5px solid var(--border);
	border-radius: 10px;
	padding: 14px 16px;
	display: flex;
	align-items: center;
	gap: 12px;
	cursor: pointer;
	text-decoration: none;
	transition: background 0.15s;
}
.aff-card:hover { background: var(--bg-input); }
.aff-icon {
	width: 36px;
	height: 36px;
	border-radius: 8px;
	background: var(--badge-bg);
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	font-size: 17px;
}
.aff-label { font-size: 10px; color: var(--text-soft); }
.aff-name { font-size: 13px; font-weight: 500; color: var(--text-dark); }
.aff-arrow { margin-left: auto; font-size: 14px; color: var(--accent-dk); }

/* New search button */
.new-search-btn {
	width: 100%;
	padding: 13px;
	font-size: 14px;
	font-weight: 500;
	font-family: 'DM Sans', sans-serif;
	background: transparent;
	color: var(--text-mid);
	border: 0.5px solid var(--border-md);
	border-radius: 8px;
	cursor: pointer;
	margin-top: 20px;
	transition: background 0.15s;
}
.new-search-btn:hover { background: var(--bg-input); }

/* ── Date picker ── */
.date-picker-wrap { position: relative; }

.date-trigger {
	width: 100%;
	padding: 11px 14px;
	font-size: 14px;
	font-family: 'DM Sans', sans-serif;
	border: 0.5px solid var(--border-md);
	border-radius: 8px;
	background: var(--bg-input);
	color: var(--text-faint);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: space-between;
	transition: border-color 0.15s, background 0.15s;
	user-select: none;
}
.date-trigger:hover {
	border-color: var(--accent-dk);
	background: #F0E4CC;
}
/* Show dark text once dates are selected */
#date-trigger-text.has-dates { color: var(--text-dark); }
.cal-trigger-icon { font-size: 15px; flex-shrink: 0; }

/* Calendar dropdown — left-aligned so it doesn't overflow off-screen */
.cal-dropdown {
	position: absolute;
	top: calc(100% + 6px);
	left: 0;                        /* anchored to left edge of trigger, extends right */
	width: min(580px, 96vw);
	background: var(--bg-card);
	border: 0.5px solid var(--border-md);
	border-radius: 12px;
	box-shadow: 0 12px 36px rgba(44,26,14,0.12);
	z-index: 200;
	padding: 16px;
}

.cal-inner { display: flex; flex-direction: column; gap: 10px; }

/* Nav row: prev arrow | two months | next arrow */
.cal-nav-row {
	display: flex;
	align-items: flex-start;
	gap: 8px;
}
.cal-nav-btn {
	width: 28px;
	height: 28px;
	flex-shrink: 0;
	margin-top: 3px;
	border: 0.5px solid var(--border-md);
	border-radius: 6px;
	background: var(--bg-input);
	color: var(--text-mid);
	cursor: pointer;
	font-size: 18px;
	line-height: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	transition: background 0.15s;
}
.cal-nav-btn:hover { background: var(--badge-bg); color: var(--text-dark); }

/* Two month panels side by side */
.cal-two-months {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 16px;
	flex: 1;
}

/* Month title */
.cal-month-title {
	font-size: 12px;
	font-weight: 500;
	color: var(--text-dark);
	text-align: center;
	margin-bottom: 8px;
	letter-spacing: 0.02em;
}

/* Day-of-week header row */
.cal-dow-row {
	display: grid;
	grid-template-columns: repeat(7, 1fr);
	margin-bottom: 3px;
}
.cal-dow-row div {
	font-size: 9px;
	font-weight: 500;
	letter-spacing: 0.07em;
	color: var(--text-soft);
	text-align: center;
	padding: 3px 0;
}

/* Day cell grid */
.cal-grid {
	display: grid;
	grid-template-columns: repeat(7, 1fr);
	gap: 1px;
}
.cal-cell {
	aspect-ratio: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 11px;
	color: var(--text-dark);
	border-radius: 50%;
	cursor: pointer;
	transition: background 0.1s;
}
.cal-cell.empty { pointer-events: none; }
.cal-cell.past  { color: var(--text-faint); cursor: default; pointer-events: none; }
.cal-cell.today { font-weight: 600; color: var(--accent); }
.cal-cell:not(.past):not(.empty):hover { background: var(--badge-bg); }

/* Selected start and end dates */
.cal-cell.start,
.cal-cell.end {
	background: var(--accent) !important;
	color: #fff !important;
	font-weight: 500;
	border-radius: 50% !important;
}

/* Highlighted range between start and end */
.cal-cell.in-range {
	background: #FBE8C8;
	border-radius: 0;
}

/* Hint text below calendar */
.cal-hint {
	font-size: 11px;
	color: var(--text-soft);
	text-align: center;
	font-style: italic;
}
.cal-hint.over-limit { color: #C0392B; font-style: normal; font-weight: 500; }

/* Actual date shown under day theme in result cards */
.day-date {
	font-size: 11px;
	color: var(--text-soft);
	margin-top: 2px;
	font-weight: 400;
}

/* ── Special events ── */
.events-list { display: flex; flex-direction: column; gap: 10px; }
.event-card {
    background: var(--bg-card);
    border: 0.5px solid var(--border-md);
    border-radius: 10px;
    padding: 14px 16px;
    display: flex;
    gap: 14px;
    align-items: flex-start;
}
.event-icon { font-size: 22px; flex-shrink: 0; margin-top: 1px; }
.event-body { flex: 1; }
.event-name { font-size: 14px; font-weight: 500; color: var(--text-dark); margin-bottom: 2px; }
.event-dates { font-size: 11px; color: var(--accent); font-weight: 500; margin-bottom: 6px; }
.event-desc { font-size: 12px; color: var(--text-mid); line-height: 1.6; margin-bottom: 5px; }
.event-why { font-size: 11px; color: var(--text-soft); font-style: italic; line-height: 1.5; }

/* ── Weather ── */
.weather-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 12px;
}
.weather-item {
    background: var(--bg-input);
    border: 0.5px solid var(--border);
    border-radius: 8px;
    padding: 12px 14px;
}
.weather-label {
    font-size: 9px;
    font-weight: 500;
    letter-spacing: 0.1em;
    color: var(--text-soft);
    margin-bottom: 5px;
}
.weather-value {
    font-size: 12px;
    color: var(--text-dark);
    line-height: 1.6;
}

/* ── Skeleton loading shimmer ── */
.skel {
    display: block;
    background: linear-gradient(90deg, var(--bg-input) 25%, #EDE0C8 50%, var(--bg-input) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: 4px;
}
@keyframes shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ── Local laws ── */
.laws-list { display: flex; flex-direction: column; gap: 8px; }
.law-item {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 11px 14px;
    background: var(--bg-input);
    border: 0.5px solid var(--border);
    border-radius: 8px;
}
.law-icon { font-size: 14px; flex-shrink: 0; margin-top: 1px; }
.law-text { font-size: 13px; color: var(--text-dark); line-height: 1.6; }

/* ── Destination hero photo ── */
.result-hero {
    width: 100%;
    height: 220px;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 20px;
    position: relative;
}
.result-hero img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.photo-attribution {
    position: absolute;
    bottom: 8px;
    right: 10px;
    font-size: 10px;
    color: rgba(255,255,255,0.8);
    background: rgba(0,0,0,0.25);
    padding: 2px 6px;
    border-radius: 4px;
}
.photo-attribution a {
    color: rgba(255,255,255,0.9);
    text-decoration: none;
}
.photo-attribution a:hover { color: #fff; }
.result-hero-skel {
    width: 100%;
    height: 220px;
    border-radius: 12px;
    margin-bottom: 20px;
}

/* ── Photo backgrounds ── */

/* Main header with destination photo */
#main-header {
    position: relative;
    transition: background-image 0.4s ease;
}
#main-header.has-photo {
    border-bottom-color: rgba(255,255,255,0.15);
}
#main-header.has-photo .badge {
    background: rgba(255,255,255,0.15);
    color: rgba(255,255,255,0.9);
}
#main-header.has-photo h1,
#main-header.has-photo p,
#main-header.has-photo p span {
    color: white;
}
#main-header.has-photo .back-btn { color: rgba(255,255,255,0.8); }
#main-header.has-photo .back-btn:hover { color: white; }

/* r-sections with photo backgrounds */
.r-section.has-photo {
    border-radius: 14px;
    padding: 20px;
    overflow: hidden;
    position: relative;
}
.r-section.has-photo .r-section-title { color: rgba(255,255,255,0.9); }

/* Keep cards readable over photo backgrounds */
.r-section.has-photo .tip-card,
.r-section.has-photo .weather-item {
    background: rgba(255,250,244,0.92);
}
.r-section.has-photo .warning-item {
    background: rgba(251,232,200,0.92);
}
.r-section.has-photo .law-item {
    background: rgba(245,236,217,0.92);
}

/* Laws subtitle inside shared warnings/laws section */
#section-warnings-laws.has-photo .laws-subtitle {
    color: rgba(255,255,255,0.9);
    margin-top: 20px;
}

/* Day cards with photo backgrounds */
.day-card.has-photo {
    overflow: hidden;
    background-color: transparent;
}
.day-card.has-photo .day-header {
    background: rgba(0,0,0,0.2);
    border-bottom-color: rgba(255,255,255,0.1);
}
.day-card.has-photo .day-num { background: var(--accent); }
.day-card.has-photo .day-theme { color: white; }
.day-card.has-photo .day-date  { color: rgba(255,255,255,0.7); }
.day-card.has-photo .day-row {
    background: rgba(0,0,0,0.22);
    border-bottom-color: rgba(255,255,255,0.08);
}
.day-card.has-photo .time-lbl         { color: rgba(232,131,42,0.95); }
.day-card.has-photo .time-activity    { color: white; }
.day-card.has-photo .time-activity strong { color: white; }
.day-card.has-photo .time-cost        { color: rgba(255,255,255,0.6); }

/* Unsplash attribution on header */
.photo-attr-header {
    position: absolute;
    bottom: 8px;
    right: 16px;
    font-size: 9px;
    color: rgba(255,255,255,0.6);
    background: rgba(0,0,0,0.2);
    padding: 2px 7px;
    border-radius: 3px;
}
.photo-attr-header a {
    color: rgba(255,255,255,0.75);
    text-decoration: none;
}
.photo-attr-header a:hover { color: white; }