.print-footer {
    position: running(print-footer);
    font-family: 'Georgia', serif;
    font-size: 9pt;
    color: #666;
    display: block;
    visibility: visible;
    width: 100%;
    margin: 0;
    padding: 0.5em 0 0.5em 0;
    border-top: 1px solid #ddd;
    max-height: 2.5cm;
    overflow: hidden;
}

.footer-top {
    display: flex;
    align-items: flex-start;
    width: 100%;
    gap: 1em;
    margin-bottom: 0.4em;
}

.footer-logo {
    height: 30px;
    width: auto;
    max-width: 120px;
    object-fit: contain;
    flex-shrink: 0;
    margin-top: 0;
}

.footer-text {
    flex: 1;
    text-align: center;
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.4;
}

.footer-bottom {
    width: 100%;
    text-align: right;
    margin-top: 0.3em;
    padding-bottom: 0.8em;
}

.page-number-display {
    font-family: 'Georgia', serif;
    font-size: 9pt;
    color: #666;
}

.page-number-display::after {
    content: counter(page) " of " counter(pages);
}

@page {
    size: A4;
    margin: 2cm 1.5cm 3.5cm 1.5cm;
    background-color: #ffffff;

    @bottom-left {
        content: element(print-footer);
        font-family: 'Georgia', serif;
        font-size: 9pt;
        color: #666;
        vertical-align: bottom;
        padding-bottom: 1em;
        height: 2.5cm;
    }
}

@media print {
    @page {
        size: A4;
        margin: 2cm 1.5cm;
        background-color: #ffffff;
    }

    /* Hide any screen-only floating controls when printing */
    .print-floating-button,
    .print-floating-button *,
    .print-floating-button-btn {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
    }
}

.print-body {
    margin: 0;
    padding: 0;
    font-family: 'Georgia', 'Times New Roman', serif;
    font-size: 11pt;
    line-height: 1.6;
    color: #333;
    background: #ffffff;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
}

.print-body p {
    margin: 0 0 1em 0;
}

.print-container {
    width: 100%;
    max-width: 100%;
}

/* Floating print button (screen only) */
.print-floating-button {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 9999;
}

.print-floating-button-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
    border-radius: 999px;
    border: 1px solid #ccc;
    background: rgba(247, 247, 247, 0.98);
    color: #333;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.print-floating-button-btn:hover {
    background: #eee;
}

/* Center Paged.js pages */
.pagedjs_pages {
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.pagedjs_page {
    margin: 0 auto 1em auto;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.print-post {
    page-break-before: always;
    page-break-inside: avoid;
    margin: 0;
    padding: 0 0 1.5em 0;
}

.print-post:first-child {
    page-break-before: auto;
}

.post-header {
    margin-bottom: 2em;
    padding-bottom: 0.75em;
    border-bottom: 3px solid #308422;
}

.post-title {
    font-size: 26pt;
    font-weight: bold;
    margin: 0 0 0.75em 0;
    padding: 0;
    page-break-after: avoid;
    color: #308422;
    line-height: 1.3;
    letter-spacing: -0.5px;
}

.post-meta {
    font-size: 10pt;
    color: #666;
    font-style: italic;
    margin-top: 0.5em;
    padding: 0.25em 0;
}

.post-content {
    margin: 0;
    padding: 0 0 1em 0;
}

.post-content p {
    margin: 0 0 1em 0;
    text-align: justify;
    orphans: 3;
    widows: 3;
    page-break-inside: avoid;
    padding-bottom: 0.5em;
}

.post-content p:last-child {
    margin-bottom: 0;
    padding-bottom: 1.5em;
}

.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4,
.post-content h5,
.post-content h6 {
    page-break-after: avoid;
    page-break-inside: avoid;
    margin-top: 1.5em;
    margin-bottom: 0.75em;
    font-weight: bold;
    color: #000;
}

.post-content h1 {
    font-size: 18pt;
}

.post-content h2 {
    font-size: 16pt;
}

.post-content h3 {
    font-size: 14pt;
}

.post-content h4 {
    font-size: 12pt;
}

.post-content h5 {
    font-size: 11pt;
}

.post-content h6 {
    font-size: 10pt;
}

.post-content img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 1.5em auto;
    page-break-inside: avoid;
    page-break-after: avoid;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.first-paragraph-image {
    float: left;
    margin: 0 1em 0.5em 0;
    max-width: 340px;
    width: 50%;
}

.first-paragraph-image img {
    width: 100%;
    height: auto;
    display: block;
    margin: 0;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    page-break-inside: avoid;
    page-break-after: avoid;
}

.post-content p:first-of-type {
    overflow: hidden;
}

.post-content p:first-of-type::after {
    content: "";
    display: table;
    clear: both;
}

.post-content figure {
    margin: 1em 0;
    page-break-inside: avoid;
}

.post-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1em 0;
    page-break-inside: avoid;
}

.post-content table th,
.post-content table td {
    border: 1px solid #ddd;
    padding: 0.5em;
    text-align: left;
}

.post-content table th {
    background-color: #f5f5f5;
    font-weight: bold;
}

.post-content ul,
.post-content ol {
    margin: 1em 0 1.5em 0;
    padding-left: 2em;
    padding-bottom: 0.5em;
    page-break-inside: avoid;
}

.post-content li {
    margin: 0.5em 0;
    page-break-inside: avoid;
}

.post-content blockquote {
    margin: 1em 2em;
    padding: 0.5em 1em;
    border-left: 3px solid #666;
    font-style: italic;
    color: #555;
    page-break-inside: avoid;
}

.post-content a {
    color: #000;
    text-decoration: underline;
}

.post-content code {
    font-family: 'Courier New', monospace;
    font-size: 10pt;
    background-color: #f5f5f5;
    padding: 0.2em 0.4em;
    border-radius: 3px;
}

.post-content pre {
    font-family: 'Courier New', monospace;
    font-size: 10pt;
    background-color: #f5f5f5;
    padding: 1em;
    border-radius: 3px;
    overflow-x: auto;
    page-break-inside: avoid;
}

.post-content hr {
    border: none;
    border-top: 1px solid #ddd;
    margin: 1.5em 0;
    page-break-inside: avoid;
}

.location-categories {
    font-size: 9pt;
    color: #666;
    margin-top: 1.5em;
    margin-bottom: 1em;
    padding-top: 1em;
    padding-bottom: 1em;
    border-top: 1px solid #e0e0e0;
    font-style: italic;
}

/* Trip Summary Page Styles */
.trip-summary {
    page-break-after: always;
    /* background: linear-gradient(135deg, #f8fbf8 0%, #f0f7f0 100%);
    border: 0px solid #308422;
    border-radius: 12px;
    padding: 2.5em;
    margin-bottom: 2em;
    box-shadow: 0 4px 16px rgba(48, 132, 34, 0.15); */
}

.trip-summary .post-title {
    color: #308422;
    font-size: 28pt;
    text-align: center;
    margin-bottom: 0.5em;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 800;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.summary-subtitle {
    text-align: center;
    color: #666;
    font-size: 12pt;
    font-style: italic;
    margin-bottom: 2em;
    padding-bottom: 1.5em;
    border-bottom: 2px solid rgba(48, 132, 34, 0.2);
}

.summary-content {
    background: #fff;
    /* padding: 2.5em;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08); */
}

/* Stats Grid */
.summary-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1.5em;
    margin-bottom: 2.5em;
    padding-bottom: 2em;
    border-bottom: 2px solid #e8f5e9;
}

.summary-stat-card {
    background: linear-gradient(135deg, #fff 0%, #f8fbf8 100%);
    border: 2px solid #dbe6db;
    border-radius: 12px;
    padding: 1.5em;
    display: flex;
    align-items: center;
    gap: 1em;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(48, 132, 34, 0.1);
    page-break-inside: avoid;
}

.summary-stat-card.days-card {
    border-color: #4caf50;
    background: linear-gradient(135deg, #e8f5e9 0%, #f1f8e9 100%);
}

.summary-stat-card.locations-card {
    border-color: #2196f3;
    background: linear-gradient(135deg, #e3f2fd 0%, #e8eaf6 100%);
}

.summary-stat-card.destinations-card {
    border-color: #ff9800;
    background: linear-gradient(135deg, #fff3e0 0%, #fce4ec 100%);
}

.stat-icon {
    font-size: 32pt;
    line-height: 1;
    flex-shrink: 0;
}

.stat-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.stat-number {
    font-size: 28pt;
    font-weight: 800;
    color: #308422;
    line-height: 1;
    margin-bottom: 0.2em;
}

.stat-label {
    font-size: 11pt;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

/* Summary Details Sections */
.summary-details {
    display: flex;
    flex-direction: column;
    gap: 1.5em;
}

/* Ensure breakdown title and itinerary container stay together on new page */
.summary-details>.breakdown-title {
    page-break-after: avoid;
    page-break-before: always;
    break-after: avoid;
    break-before: always;
}

.summary-details>.itinerary-container {
    page-break-before: avoid;
    break-before: avoid;
    margin-top: 0;
}

.summary-section {
    background: #fafafa;
    padding: 1.5em;
    border-radius: 8px;
    border-left: 4px solid #308422;
    page-break-inside: avoid;
    page-break-after: auto;
}

.section-title {
    font-size: 16pt;
    color: #308422;
    font-weight: 700;
    margin: 0 0 1em 0;
    padding-bottom: 0.5em;
    border-bottom: 2px solid rgba(48, 132, 34, 0.2);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Destinations List */
.destinations-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8em;
    margin-top: 1em;
}

.destination-badge {
    background: linear-gradient(135deg, #308422 0%, #256b1a 100%);
    color: #fff;
    padding: 0.6em 1.2em;
    border-radius: 20px;
    font-size: 10pt;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    box-shadow: 0 2px 6px rgba(48, 132, 34, 0.3);
    page-break-inside: avoid;
}

/* Route Overview */
.route-section {
    background: linear-gradient(135deg, #f8fbf8 0%, #fff 100%);
}

.route-container {
    display: flex;
    align-items: center;
    gap: 1.5em;
    margin-top: 1.5em;
    flex-wrap: wrap;
    justify-content: center;
}

.route-card {
    background: #fff;
    border: 2px solid #dbe6db;
    border-radius: 10px;
    padding: 1.2em 1.5em;
    display: flex;
    align-items: center;
    gap: 1em;
    flex: 1;
    min-width: 200px;
    max-width: 300px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    page-break-inside: avoid;
}

.route-card.start-card {
    border-color: #4caf50;
    background: linear-gradient(135deg, #e8f5e9 0%, #fff 100%);
}

.route-card.end-card {
    border-color: #f44336;
    background: linear-gradient(135deg, #ffebee 0%, #fff 100%);
}

.route-icon {
    font-size: 24pt;
    line-height: 1;
    flex-shrink: 0;
}

.route-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.route-label {
    font-size: 9pt;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    margin-bottom: 0.3em;
}

.route-value {
    font-size: 12pt;
    color: #333;
    font-weight: 600;
    line-height: 1.4;
}

.route-arrow {
    font-size: 24pt;
    color: #308422;
    font-weight: bold;
    flex-shrink: 0;
}

.breakdown-title {
    font-size: 18pt;
    color: #308422;
    font-weight: 700;
    margin-top: 0;
    margin-bottom: 1em;
    padding-bottom: 0.8em;
    border-bottom: 3px solid #308422;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-align: center;
    page-break-after: avoid;
    page-break-before: always;
    break-after: avoid;
    break-before: always;
    orphans: 1;
    widows: 1;
}

/* Itinerary Container - Single block for all days */
.itinerary-container {
    background: linear-gradient(135deg, #fff 0%, #f8fbf8 100%);
    border: 2px solid #e0e0e0;
    border-left: 5px solid #308422;
    border-radius: 8px;
    padding: 1.5em;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
    page-break-inside: auto;
    page-break-before: avoid;
    break-inside: auto;
    break-before: avoid;
    orphans: 1;
    widows: 1;
    /* Stay with the title on the same page, but allow breaking if content is too long */
    max-height: none;
}

/* Day container - wraps header and locations for better flow */
.day-container {
    page-break-inside: auto;
    page-break-after: auto;
    break-inside: auto;
    break-after: auto;
    orphans: 1;
    widows: 1;
    /* Maximum flexibility - allow breaking anywhere to fill gaps */
    min-height: 0;
    margin-bottom: 0;
    max-height: none;
    /* Don't force keeping header with locations if it prevents filling gaps */
    /* Allow container to break at any point to utilize page space */
    display: block;
}

.day-container:first-child .day-header {
    margin-top: 0;
}

.day-header {
    display: flex;
    align-items: center;
    gap: 1em;
    margin-top: 1.5em;
    margin-bottom: 0.8em;
    flex-wrap: wrap;
    page-break-after: auto;
    page-break-before: auto;
    break-after: auto;
    break-before: auto;
    orphans: 1;
    widows: 1;
    /* Maximum flexibility - allow header to appear anywhere to fill gaps */
    min-height: 0;
    /* Don't force keeping with locations if it prevents filling previous page gaps */
}

/* Allow next day header to start even with minimal space at bottom */
.day-container+.day-container .day-header {
    margin-top: 1em;
}

.day-badge {
    background: linear-gradient(135deg, #308422 0%, #256b1a 100%);
    color: #fff;
    padding: 0.5em 1em;
    border-radius: 8px;
    font-size: 12pt;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 6px rgba(48, 132, 34, 0.3);
    min-width: 80px;
    text-align: center;
}

.day-destination {
    color: #308422;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 14pt;
    letter-spacing: 0.5px;
    flex: 1;
}

.day-locations-list {
    margin: 0.8em 0 0 2.5em;
    padding: 0;
    list-style: none;
    page-break-inside: auto;
    page-break-before: auto;
    break-inside: auto;
    break-before: auto;
    orphans: 1;
    widows: 1;
    /* Maximum flexibility - allow list to break anywhere to fill gaps */
    min-height: 0;
    max-height: none;
    /* Allow list to start even with very small space to fill previous page gaps */
}

.day-locations-list li {
    margin: 0.5em 0;
    color: #555;
    font-size: 11pt;
    line-height: 1.5;
    padding-left: 1.5em;
    position: relative;
    page-break-inside: avoid;
    page-break-after: auto;
    break-inside: avoid;
    break-after: auto;
    orphans: 1;
    widows: 1;
    /* Keep each location item together, but allow list to break between items */
}

.day-locations-list li::before {
    content: "📍";
    position: absolute;
    left: 0;
    font-size: 10pt;
}

.day-locations-list .day-location-distance {
    font-size: 0.9em !important;
    color: #308422 !important;
    font-weight: 600;
    margin-top: 0.25em;
    margin-bottom: 0.4em;
    padding-left: 0;
}