/* General Styling */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: #333;
}

.terms-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* Table of Contents */
#toc {
    position: sticky;
    top: 20px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1.5rem;
}

/* Keep the sticky TOC and anchor targets clear of the fixed header (60px)
   and, where present, the sticky product navbar below it (ends at ~112px). */
.content-area [id] {
    scroll-margin-top: 80px;
}

@media (min-width: 768px) {
    body:has(#secondary-navbar) .content-area [id] {
        scroll-margin-top: 132px;
    }
}

@media (min-width: 992px) {
    #toc {
        top: 80px;
        max-height: calc(100vh - 100px);
    }

    body:has(#secondary-navbar) #toc {
        top: 132px;
        max-height: calc(100vh - 152px);
    }
}

#toc h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #212529;
}

#toc ul {
    list-style: none;
    padding-left: 0;
}

#toc ul ul {
    padding-left: 1rem;
    margin-top: 0.25rem;
}

#toc li {
    margin-bottom: 0.5rem;
}

#toc a {
    color: #495057;
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s;
}

#toc a:hover {
    color: #007bff;
}

#toc .toc-h2 {
    font-weight: 600;
    font-size: 0.95rem;
}

#toc .toc-h3 {
    font-size: 0.875rem;
}

#toc .toc-h4 {
    font-size: 0.85rem;
    color: #6c757d;
}

/* Main Content */
.content-area {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.content-area h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: #212529;
}

.content-area h2 {
    font-size: 2rem;
    font-weight: 600;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    color: #212529;
    border-bottom: 2px solid #dee2e6;
    padding-bottom: 0.5rem;
}

.content-area h2:first-of-type {
    margin-top: 1rem;
}

.content-area h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-top: 2rem;
    margin-bottom: 0.75rem;
    color: #343a40;
}

.content-area h4 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    color: #495057;
}

.content-area p {
    margin-bottom: 1rem;
    text-align: justify;
}

.content-area ul, .content-area ol {
    margin-bottom: 1rem;
    padding-left: 2rem;
}

.content-area li {
    margin-bottom: 0.5rem;
}

.subtitle {
    font-size: 1.75rem;
    font-weight: 300;
    color: #6c757d;
    margin-bottom: 1rem;
}

.meta-info {
    font-size: 0.9rem;
    color: #6c757d;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #dee2e6;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Instructions Quick Reference Card - Screen view */
.instructions-quick-reference {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    padding: 15px;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

.instructions-quick-reference h1 {
    font-size: 1.5rem;
    color: #00a7b5;
    border-bottom: 2px solid #00a7b5;
    padding-bottom: 0.3rem;
    margin-bottom: 0.5rem;
}

/* Three-column layout for desktop */
@media screen and (min-width: 992px) {
    .instructions-grid {
        display: grid;
        grid-template-columns: 1fr 1fr 1fr;
        gap: 1rem;
        align-items: start;
    }

    .center-column {
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        align-items: center;
    }

    /* Page 3 has section-boxes in center column instead of just images */
    .center-column .section-box {
        align-self: flex-start;  /* Prevents weird centering */
    }

    /* Screen view - images in center column */
    .center-column .interface-image {
        max-width: 100%;
        width: auto;
        max-height: 42vh;  /* Limit height so both images fit on one screen */
        height: auto;
        margin: 5px 0;
        display: block;
        object-fit: contain;  /* Maintain aspect ratio */
    }
}

/* Tablet - two columns, image below */
@media screen and (min-width: 768px) and (max-width: 991px) {
    .instructions-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 1.5rem;
    }

    .center-column {
        grid-column: 1 / -1;
        text-align: center;
    }

    .center-column .interface-image {
        max-width: 100%;
        height: auto;
        display: block;
        margin: 10px auto;
    }
}

/* Mobile - single column */
@media screen and (max-width: 767px) {
    .instructions-grid {
        display: block;
    }

    .left-column, .center-column, .right-column {
        margin-bottom: 1.5rem;
    }

    .center-column .interface-image {
        max-width: 100%;
        height: auto;
        display: block;
        margin: 10px auto;
    }
}

.section-box {
    margin-bottom: 0.8rem;
    padding: 0;
    margin-left: 0;
    margin-right: 0;
}

/* Fix for center column with mixed content */
.center-column .section-box {
    width: 100%;
    margin-left: 0;
    padding-left: 0;
}

.instructions-quick-reference h2 {
    font-size: 1rem;
    color: #00a7b5;
    margin-top: 0.5rem;
    margin-bottom: 0.3rem;
    font-weight: 600;
}

.instructions-quick-reference h3 {
    font-size: 0.9rem;
    margin-top: 0.4rem;
    margin-bottom: 0.3rem;
    font-weight: 600;
}

.instructions-quick-reference h4 {
    font-size: 0.85rem;
    margin-top: 0.3rem;
    margin-bottom: 0.2rem;
    font-weight: 600;
}

.instructions-quick-reference p {
    font-size: 0.85rem;
    line-height: 1.3;
    margin-bottom: 0.4rem;
}

.instructions-quick-reference ul,
.instructions-quick-reference ol {
    font-size: 0.85rem;
    line-height: 1.3;
    margin-bottom: 0.5rem;
}

.instructions-quick-reference li {
    margin-bottom: 0.2rem;
}

.instructions-quick-reference table {
    width: 100%;
    font-size: 0.85rem;
    border-collapse: collapse;
    margin-bottom: 0.5rem;
}

.instructions-quick-reference th,
.instructions-quick-reference td {
    padding: 0.25rem 0.4rem;
    border: 1px solid #dee2e6;
    text-align: left;
    font-size: 0.8rem;
    line-height: 1.3;
}

.instructions-quick-reference th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #00a7b5;
}

.instructions-quick-reference td ul {
    margin: 0;
    padding-left: 1rem;
}

.instructions-quick-reference td li {
    margin-bottom: 0.1rem;
}

/* Alert boxes - screen view */
.instructions-quick-reference .alert {
    font-size: 0.9rem;
    line-height: 1.35;
    padding: 0.5rem 0.75rem;
    margin: 0.5rem 0;
}

.instructions-quick-reference .alert ul {
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.instructions-quick-reference .alert li {
    margin-bottom: 0.15rem;
}

/* Instruction pages - screen view */
.instruction-page {
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 2px solid #dee2e6;
}

.instruction-page:last-child {
    border-bottom: none;
}

/* Desktop view - smooth scrolling between sections */
@media screen and (min-width: 992px) {
    .instruction-page {
        min-height: 80vh;
        scroll-margin-top: 20px;
    }
}

/* Print - each section becomes one page */
@media print {
    .instruction-page {
        page-break-after: always;
        page-break-inside: avoid;
        margin: 0;
        padding: 0;
        border-bottom: none;
    }

    .instruction-page:last-child {
        page-break-after: auto;
    }
}

/* Mobile Responsiveness */
@media (max-width: 991px) {
    #toc {
        position: relative;
        top: 0;
        margin-bottom: 2rem;
        max-height: 400px;
    }

    .content-area h1 {
        font-size: 2rem;
    }

    .content-area h2 {
        font-size: 1.5rem;
    }

    .content-area h3 {
        font-size: 1.25rem;
    }

    .content-area h4 {
        font-size: 1.1rem;
    }
}

/* Print Styles - SINGLE CONSOLIDATED SECTION */
@media print {
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    body {
        font-size: 10.8pt;
        line-height: 1.5;
        margin: 0;
        padding: 0;
    }

    @page {
        size: A4 portrait;
        margin: 1.5cm;
    }

    @page landscape-page {
        size: A4 landscape;
        margin: 0.5cm;
    }

    .instructions-quick-reference {
        page: landscape-page;
    }

    /* Hide navigation elements */
    #header,
    header,
    .header,
    .header-inner-pages,
    .fixed-top,
    .sticky-top,
    #secondary-navbar,
    .breadcrumbs,
    #footer,
    footer,
    .back-to-top,
    #preloader,
    nav,
    .no-print {
        display: none !important;
    }

    /* Terms and Conditions styles */
    .terms-container {
        max-width: 100%;
        padding: 0;
        margin-top: 0;
    }

    #toc {
        display: none;
    }

    .col-lg-3 {
        display: none;
    }

    .col-lg-9 {
        width: 100%;
        max-width: 100%;
        flex: 0 0 100%;
    }

    .content-area {
        box-shadow: none;
        padding: 0;
    }

    h1 {
        font-size: 24pt;
        page-break-after: avoid;
    }

    h2 {
        font-size: 18pt;
        page-break-after: avoid;
        margin-top: 20pt;
    }

    h3 {
        font-size: 14pt;
        page-break-after: avoid;
        margin-top: 15pt;
    }

    h4 {
        font-size: 12pt;
        page-break-after: avoid;
        margin-top: 12pt;
    }

    p, li {
        orphans: 3;
        widows: 3;
    }

    h1, h2, h3, h4 {
        page-break-after: avoid;
    }

    ul, ol, p {
        page-break-inside: avoid;
    }

    /* Instructions Quick Reference specific print styles */
    .instructions-quick-reference {
        max-width: 100%;
        padding: 0;
        box-shadow: none;
        margin: 0;
    }

    .instructions-quick-reference h1 {
        font-size: 13pt;
        margin-top: 0;
        margin-bottom: 0.2cm;
        page-break-after: avoid;
    }

    /* Force three-column grid for print */
    .instructions-grid {
        display: grid !important;
        grid-template-columns: 1fr 1fr 1fr !important;
        gap: 0.3cm;
        page-break-inside: avoid;
    }

    .left-column, .center-column, .right-column {
        page-break-inside: avoid;
    }

    .center-column {
        display: flex !important;
        flex-direction: column;
        justify-content: flex-start;
        align-items: center;
        position: static;
    }

    /* Image sizing for print - TWO IMAGES STACKED */
    .center-column .interface-image {
        max-width: 100%;
        width: 100%;
        max-height: 8cm !important;  /* Smaller to fit both images */
        height: auto;
        object-fit: contain;
        margin: 0.2cm 0;
        display: block;
    }

    .instructions-quick-reference h2 {
        font-size: 8.5pt;
        margin: 0.18cm 0 0.12cm 0;
        page-break-after: avoid;
        border-bottom: none;
    }

    .instructions-quick-reference h3 {
        font-size: 7.5pt;
        margin: 0.12cm 0 0.06cm 0;
        page-break-after: avoid;
    }

    .instructions-quick-reference h4 {
        font-size: 7pt;
        margin: 0.1cm 0 0.06cm 0;
        page-break-after: avoid;
    }

    .instructions-quick-reference p,
    .instructions-quick-reference li {
        font-size: 6.5pt;
        line-height: 1.15;
        margin-bottom: 0.06cm;
    }

    .instructions-quick-reference ul,
    .instructions-quick-reference ol {
        margin: 0.08cm 0 0.18cm 0;
        padding-left: 0.38cm;
    }

    .instructions-quick-reference .alert {
        background: #e6f7f9 !important;
        border-left: 2px solid #00a7b5 !important;
        padding: 0.13cm;
        margin: 0.12cm 0;
        font-size: 7pt;
        page-break-inside: avoid;
    }

    .instructions-quick-reference strong {
        color: #333;
    }

    .traffic-lights {
        font-size: 7pt;
        margin: 0.2cm 0;
        text-align: center;
    }

    .section-box {
        page-break-inside: avoid;
        margin-bottom: 0.2cm;
    }

    .instructions-quick-reference table {
        width: 100%;
        border-collapse: collapse;
        margin-bottom: 0.15cm;
        page-break-inside: avoid;
    }

    .instructions-quick-reference th,
    .instructions-quick-reference td {
        padding: 0.07cm 0.13cm;
        border: 0.5pt solid #dee2e6;
        text-align: left;
        font-size: 6pt;
        line-height: 1.12;
    }

    .instructions-quick-reference th {
        background-color: #f8f9fa !important;
        font-weight: 600;
        color: #00a7b5;
    }

    .instructions-quick-reference td ul {
        margin: 0;
        padding-left: 0.3cm;
    }

    .instructions-quick-reference td li {
        margin-bottom: 0.03cm;
    }
}
