/* --- Global Styles & Variables --- */
:root {
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
    --primary-bg: #f8f9fa;
    --secondary-bg: #ffffff;
    --border-color: #e9ecef;
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --accent-color: #007aff;
    --accent-color-hover: #0056b3;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    --border-radius: 12px;
}

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

body {
    font-family: var(--font-sans);
    background-color: var(--primary-bg);
    color: var(--text-primary);
    line-height: 1.6;
}

/* --- Layout & Modules --- */
header {
    text-align: center;
    padding: 40px 20px;
    background-color: var(--secondary-bg);
}

h1 {
    font-size: 2.5rem;
    font-weight: 600;
}

.subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

main {
    max-width: 1200px;
    margin: 30px auto;
    padding: 0 20px;
    display: grid;
    gap: 30px;
}

.module {
    background-color: var(--secondary-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 25px;
    overflow: hidden;
}

.module-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

/* --- Weather Module --- */
.weather-container {
    display: flex;
    justify-content: space-around;
    gap: 20px;
    flex-wrap: wrap;
}

.weather-card {
    flex: 1;
    min-width: 280px;
    padding: 20px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    text-align: center;
}

.weather-card h3 {
    font-size: 1.2rem;
    margin-bottom: 15px;
}

.weather-forecast {
    display: flex;
    justify-content: space-between;
    text-align: left;
}

.forecast-day {
    flex: 1;
    padding: 0 10px;
    border-left: 1px solid var(--border-color);
}
.forecast-day:first-child { border-left: none; }

.forecast-day p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

/* --- Itinerary Module --- */
.itinerary-day {
    margin-bottom: 30px;
}

.day-header {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 10px;
    background-color: var(--primary-bg);
    border-radius: 8px;
    margin-bottom: 20px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}
.day-header:hover { background-color: #e9ecef; }

.day-content {
    display: grid;
    gap: 20px;
    max-height: 5000px; /* Large value for transition */
    transition: max-height 0.7s ease-in-out, opacity 0.5s ease, margin-top 0.7s ease;
    opacity: 1;
}

.day-content.collapsed {
    max-height: 0;
    opacity: 0;
    margin-top: -20px;
    overflow: hidden;
}

.itinerary-card {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.itinerary-card:hover { transform: translateY(-5px); box-shadow: 0 8px 20px rgba(0,0,0,0.1); }

.card-content {
    padding: 20px;
    flex-grow: 1;
}

.card-content h4 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.card-content .type {
    display: inline-block;
    background-color: var(--accent-color);
    color: white;
    padding: 2px 8px;
    font-size: 0.8rem;
    border-radius: 6px;
    margin-left: 10px;
}

.card-content p {
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.booked-time {
    color: var(--accent-color);
    font-weight: 500;
}

.card-actions {
    margin-top: 15px;
}

.map-btn {
    background-color: var(--accent-color);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background-color 0.3s ease;
}
.map-btn:hover { background-color: var(--accent-color-hover); }

/* --- Side Modules (Packing, Memo, Food) --- */
.collapsible-header {
    cursor: pointer;
    position: relative;
}

.collapsible-header::after {
    content: '▲';
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%) rotate(180deg);
    font-size: 0.8rem;
    color: var(--text-secondary);
    transition: transform 0.3s ease-in-out;
}

.collapsible-header.collapsed::after {
    transform: translateY(-50%) rotate(0deg);
}

.collapsible-content {
    max-height: 1000px; /* Large value for transition */
    transition: max-height 0.5s ease-in-out, opacity 0.3s ease, margin-top 0.5s ease;
    opacity: 1;
    margin-top: 20px;
}

.collapsible-content.collapsed {
    max-height: 0;
    opacity: 0;
    margin-top: -20px;
    overflow: hidden;
}

.list-item {
    display: flex;
    align-items: center;
    padding: 10px 5px;
    border-bottom: 1px solid var(--border-color);
}
.list-item:last-child { border-bottom: none; }

.list-item.checked .item-text {
    text-decoration: line-through;
    color: var(--text-secondary);
}

.list-item input[type="checkbox"] {
    margin-right: 15px;
    width: 18px;
    height: 18px;
}

.item-details {
    flex-grow: 1;
}

.item-text {
    font-size: 1rem;
}

.item-note {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-left: 8px;
}

.delete-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: #dc3545;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.3s ease;
}
.list-item:hover .delete-btn { opacity: 1; }

.add-item-form {
    display: flex;
    margin-top: 20px;
}

.add-item-form input {
    flex-grow: 1;
    border: 1px solid var(--border-color);
    padding: 10px;
    font-size: 1rem;
    min-width: 0;
}
.add-item-form input:focus { outline: none; border-color: var(--accent-color); }

.add-item-form input:first-of-type {
    border-radius: 8px 0 0 8px;
    flex-basis: 60%;
}

.add-item-form input:nth-of-type(2) {
    border-left: none;
    flex-basis: 40%;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.add-btn {
    flex-shrink: 0;
    width: 50px;
    border: none;
    background-color: var(--accent-color);
    color: white;
    font-size: 1.5rem;
    border-radius: 0 8px 8px 0;
    cursor: pointer;
    transition: background-color 0.3s ease;
}
.add-btn:hover { background-color: var(--accent-color-hover); }

#food-recommendations p {
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}
#food-recommendations p:last-child { border-bottom: none; }

.food-checklist-title { margin-top: 30px; }

/* --- Map Modal --- */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.6);
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

.modal.show {
    display: block;
    opacity: 1;
}

.modal-content {
    background-color: var(--secondary-bg);
    margin: 5% auto;
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 800px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    transform: scale(0.95);
    transition: transform 0.3s ease-in-out;
}

.modal.show .modal-content {
    transform: scale(1);
}

.close-btn {
    color: var(--text-secondary);
    float: right;
    font-size: 28px;
    font-weight: bold;
    padding: 0 20px;
    line-height: 1;
}
.close-btn:hover, .close-btn:focus { color: var(--text-primary); cursor: pointer; }

#map-container {
    width: 100%;
    height: 500px;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.modal-footer {
    padding: 20px;
    text-align: center;
}

#modal-location-name {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 15px;
}

#navigation-options a {
    display: inline-block;
    margin: 0 10px;
    padding: 10px 20px;
    background-color: var(--accent-color);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    transition: background-color 0.3s ease;
}
#navigation-options a:hover { background-color: var(--accent-color-hover); }

/* --- Responsive Design --- */
@media (min-width: 992px) {
    main {
        grid-template-columns: 2fr 1fr;
        grid-template-areas:
            "weather weather"
            "itinerary side";
    }
    #weather-module { grid-area: weather; }
    #itinerary-module { grid-area: itinerary; }
    .side-modules-container { grid-area: side; display: flex; flex-direction: column; gap: 30px; }
}

@media (max-width: 768px) {
    h1 { font-size: 2rem; }
    .modal-content { margin: 10% auto; }
    #map-container { height: 400px; }
}