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

:root {
    --primary-color: #4a90e2;
    --secondary-color: #50c878;
    --danger-color: #e74c3c;
    --background: #f5f7fa;
    --card-background: #ffffff;
    --text-primary: #2c3e50;
    --text-secondary: #7f8c8d;
    --border-color: #e1e8ed;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    padding: 40px 0;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.header-content > div {
    flex: 1;
}

h1 {
    font-size: 2.5em;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1em;
}

h2 {
    font-size: 1.8em;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.setup-section, .trips-section {
    background: var(--card-background);
    padding: 30px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 30px;
}

.setup-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

label {
    font-weight: 600;
    color: var(--text-primary);
}

.input-field {
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1em;
    transition: border-color 0.3s;
}

.input-field:focus {
    outline: none;
    border-color: var(--primary-color);
}

.help-text {
    color: var(--text-secondary);
    font-size: 0.9em;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: #357abd;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.4);
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background-color: #45b369;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(80, 200, 120, 0.4);
}

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

.btn-outline:hover {
    background-color: var(--primary-color);
    color: white;
}

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

.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0;
}

.tab-button {
    padding: 12px 24px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: all 0.3s;
}

.tab-button:hover {
    color: var(--text-primary);
    background-color: rgba(74, 144, 226, 0.05);
}

.tab-button.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.trips-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.trip-card {
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    transition: all 0.3s;
}

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

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

.trip-title {
    font-size: 1.4em;
    font-weight: 700;
    color: var(--text-primary);
}

.trip-dates {
    color: var(--text-secondary);
    font-size: 0.95em;
    margin-top: 4px;
}

.trip-location {
    display: flex;
    align-items: center;
    color: var(--text-secondary);
    margin-bottom: 12px;
    font-size: 1.05em;
}

.trip-location::before {
    content: "📍";
    margin-right: 8px;
}

.trip-details {
    background-color: var(--background);
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 0.95em;
    color: var(--text-secondary);
}

.loading {
    text-align: center;
    padding: 40px;
}

.spinner {
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.error-message {
    background-color: #fee;
    color: var(--danger-color);
    padding: 16px;
    border-radius: 8px;
    border-left: 4px solid var(--danger-color);
    margin-bottom: 20px;
}

.success-message {
    background-color: #efe;
    color: var(--secondary-color);
    padding: 12px 16px;
    border-radius: 8px;
    border-left: 4px solid var(--secondary-color);
    margin-top: 12px;
    font-size: 0.95em;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-state-icon {
    font-size: 4em;
    margin-bottom: 20px;
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
    overflow-y: auto;
}

.modal-content {
    background: var(--card-background);
    border-radius: 12px;
    max-width: 700px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    border-bottom: 2px solid var(--border-color);
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5em;
}

.close-btn {
    background: none;
    border: none;
    font-size: 2em;
    color: var(--text-secondary);
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s;
}

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

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 24px;
    border-top: 2px solid var(--border-color);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
}

h3 {
    font-size: 1.3em;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.template-card {
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s;
}

.template-card:hover {
    border-color: var(--primary-color);
    background-color: rgba(74, 144, 226, 0.05);
}

.template-info {
    flex: 1;
}

.template-name {
    font-weight: 700;
    font-size: 1.1em;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.template-pattern {
    color: var(--text-secondary);
    font-size: 0.9em;
}

.template-tasks {
    color: var(--text-secondary);
    font-size: 0.85em;
    margin-top: 4px;
}

.template-actions {
    display: flex;
    gap: 8px;
}

.template-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8em;
    margin-left: 8px;
    font-weight: 600;
}

.template-badge-default {
    background: var(--primary-color);
    color: white;
}

.template-badge-autosync {
    background: var(--secondary-color);
    color: white;
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.9em;
}

.task-checkboxes {
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--background);
    padding: 16px;
    border-radius: 8px;
    max-height: 400px;
    overflow-y: auto;
}

.task-checkbox-item {
    display: flex;
    align-items: start;
    gap: 12px;
}

.task-checkbox-item input[type="checkbox"] {
    margin-top: 4px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.task-checkbox-label {
    flex: 1;
    cursor: pointer;
}

.task-checkbox-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.task-checkbox-info {
    font-size: 0.85em;
    color: var(--text-secondary);
}

select.input-field {
    cursor: pointer;
}

.settings-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border-color);
    padding: 0 24px;
}

.settings-tab-button {
    padding: 12px 24px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: all 0.3s;
}

.settings-tab-button:hover {
    color: var(--text-primary);
    background-color: rgba(74, 144, 226, 0.05);
}

.settings-tab-button.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.settings-tab-content {
    display: none;
}

.settings-tab-content.active {
    display: block;
}

.custom-task-card {
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s;
}

.custom-task-card:hover {
    border-color: var(--primary-color);
    background-color: rgba(74, 144, 226, 0.05);
}

.custom-task-info {
    flex: 1;
}

.custom-task-name {
    font-weight: 700;
    font-size: 1.1em;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.custom-task-dates {
    color: var(--text-secondary);
    font-size: 0.9em;
}

.custom-task-actions {
    display: flex;
    gap: 8px;
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    h1 {
        font-size: 2em;
    }

    .header-content {
        flex-direction: column;
        text-align: center;
    }

    .trip-header {
        flex-direction: column;
    }

    .section-header {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }

    .modal-content {
        max-width: 100%;
    }

    .modal-footer {
        flex-direction: column;
    }

    .template-card {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
}

/* Project tags */
.project-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--primary-color);
    color: white;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 0.9em;
    font-weight: 500;
}

.project-tag-remove {
    background: none;
    border: none;
    color: white;
    font-size: 1.2em;
    cursor: pointer;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.project-tag-remove:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Trip photos and details */
.trip-photo {
    width: 100%;
    height: 200px;
    background-size: cover;
    background-position: center;
    border-radius: 12px 12px 0 0;
    margin: -20px -20px 20px -20px;
}

.trip-content {
    /* Content wrapper inside trip card when photo exists */
}

.trip-detail-photo {
    width: 100%;
    height: 300px;
    background-size: cover;
    background-position: center;
    border-radius: 12px;
    margin-bottom: 24px;
}

.trip-detail-overview {
    margin-bottom: 24px;
}

.trip-detail-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.trip-detail-info-item {
    background: var(--background);
    padding: 16px;
    border-radius: 8px;
}

.trip-detail-info-label {
    font-size: 0.85em;
    color: var(--text-secondary);
    margin-bottom: 4px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.trip-detail-info-value {
    font-size: 1.1em;
    color: var(--text-color);
}

.trip-detail-section {
    margin-bottom: 24px;
}

.trip-detail-section h3 {
    margin: 0 0 16px 0;
    color: var(--text-color);
}

.itinerary-items {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.itinerary-item {
    display: flex;
    gap: 16px;
    padding: 16px;
    background: var(--background);
    border-radius: 8px;
    transition: background 0.2s;
}

.itinerary-item:hover {
    background: var(--border-color);
}

.itinerary-icon {
    font-size: 2em;
    min-width: 40px;
    text-align: center;
}

.itinerary-content {
    flex: 1;
}

.itinerary-title {
    font-weight: 600;
    font-size: 1.05em;
    margin-bottom: 4px;
    color: var(--text-color);
}

.itinerary-details {
    font-size: 0.9em;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.itinerary-description {
    font-size: 0.9em;
    color: var(--text-color);
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 24px;
    padding: 20px;
    background: var(--background);
    border-radius: 8px;
}

.pagination-info {
    color: var(--text-secondary);
    font-size: 0.9em;
}

.pagination-controls {
    display: flex;
    gap: 12px;
    align-items: center;
}

.pagination-page {
    color: var(--text-color);
    font-size: 0.95em;
    font-weight: 500;
    padding: 0 8px;
}
