/* PRA CSS-Grid Based Layout */

.pra-container {
    margin-bottom: 100px;
    position: relative;
    /* Container für die absolute Positionierung des Wrappers */
}

.pra-capture-wrapper {
    position: absolute;
    top: 100px;
    left: 125px;
    width: 80%;
    height: 95%;
    padding: 0;
    border-radius: 5px;
    border: 3px dashed transparent;
    transition: all 0.3s ease;
    pointer-events: none;
    /* Verhindert, dass der Rahmen Klicks blockiert */
    z-index: 100;
}

.pra-capture-wrapper.hover-active {
    border-color: #17669d;
}

.pra-main-container {
    width: 100%;
    max-width: 950px;
    padding-top: 20px;
    /* Reduced from 50px */
    margin: 20px auto;
    background: #fff;
    font-family: Arial, sans-serif;
    color: #000;
    transition: all 0.2s ease;
}

.pra-tophr,
.pra-bottom-hr {
    border: 0;
    border-top: 1px solid #ccc;
    margin: 15px 0;
}

/* --- Header & Control Bar (borrowed from parodontalstatus.ch) --- */
.form-header {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 17px;
    margin: auto;
    width: auto;
}

.form-header label {
    font-family: Arial, sans-serif;
    font-weight: normal;
    font-size: 18px;
    white-space: nowrap;
}

.header-row {
    display: flex;
    align-items: center;
    gap: 25px;
}

.form-title {
    width: 420px;
    margin: 0;
    font-size: 32px;
    font-family: "Arial Narrow", Arial, Sans-Serif;
    font-weight: bold;
    font-stretch: condensed;
    transform: scaleX(0.85);
    transform-origin: left center;
    white-space: nowrap;
    text-align: left;
}

.header-input {
    flex-grow: 1;
    padding: 3px 4px;
    border: 1px solid #999999;
    border-radius: 2px;
    font-size: 18px;
    font-family: "Arial", Regular, Sans-Serif;
    background-color: #e7f3fd;
}

.input-container {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-grow: 1;
}

.control-button {
    padding: 0 12px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: none;
    background-color: #F9F9F9;
    color: #333333;
    cursor: pointer;
    border-radius: 5px;
    font-size: 16px;
    transition: all 0.3s ease;
    box-shadow: 3px 3px 5px #CCCCCC;
    margin-bottom: 50px;
}

.control-button:hover {
    background-color: #E8E8E8;
}

.control-button img {
    height: 16px;
}

/* Main Flex Wrapper */
.pra-flex-layout {
    display: flex;
    justify-content: flex-start;
    align-items: flex-start;
}

/* --- Left Column: Chart Area --- */
.pra-chart-side {
    flex: 0 0 450px;
    /* Adjusted to match 450px stage width */
}

.pra-chart-stage {
    position: relative;
    width: 450px;
    height: 480px;
}

.chart-inner {
    position: relative;
    width: 100%;
    height: 100%;
}

/* Background Hexagon SVG */
.chart-inner svg:first-of-type {
    position: absolute;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    width: 320px;
    height: 320px;
}

/* Dynamic Polygon Overlay */
.pra-poly-overlay {
    position: absolute;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    width: 320px;
    height: 320px;
    pointer-events: none;
    z-index: 10;
}

#polygon {
    stroke-opacity: 0.6;
    fill-opacity: 0.25;
    /* More transparent to match template */
    stroke-width: 1.5;
}

.pra-axes-labels {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 20;
}

.pra-axis-label {
    position: absolute;
    font-size: 15px;
    font-family: Arial, sans-serif;
    white-space: nowrap;
}

.text-blue {
    color: #00f;
}

.bold {
    font-weight: bold;
}

/* Oben: BOP% */
.axis-pos-top {
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
}

/* Oben Rechts: PD>=5mm */
.axis-pos-top-right {
    top: 130px;
    left: 335px;
}

/* Unten Rechts: Tooth loss */
.axis-pos-bottom-right {
    top: 295px;
    left: 335px;
}

/* Unten: BL/Age */
.axis-pos-bottom {
    top: 360px;
    left: 50%;
    transform: translateX(-50%);
}

/* Unten Links: Syst./Gen. */
.axis-pos-bottom-left {
    top: 295px;
    left: 0;
    text-align: right;
    width: 110px;
}

/* Oben Links: Envir. */
.axis-pos-top-left {
    top: 130px;
    left: 0;
    text-align: right;
    width: 110px;
}


/* --- Right Column: Form Side --- */
.pra-form-side {
    flex: 1;
}

.pra-form-grid-wrapper {
    background: #fff;
    /* Parent is white for the labels area */
    padding: 0;
    border-radius: 0;
    overflow: visible;
}

.pra-grid-form {
    display: table;
    border-collapse: separate;
    border-spacing: 0;
    width: auto;
}

.grid-row {
    display: table-row;
}

.grid-row.align-top .grid-label,
.grid-row.align-top .grid-content {
    vertical-align: top;
}

.grid-label {
    display: table-cell;
    width: 320px;
    /* Reduced from 380px */
    background: #fff;
    padding: 10px 15px;
    text-align: right;
    vertical-align: middle;
    font-size: 14px;
    line-height: 1.2;
    color: #333;
}

.grid-row.align-top .grid-label {
    padding-top: 15px;
}

.grid-content {
    display: table-cell;
    width: 250px;
    /* Reduced from 300px */
    background: #f2f2f2;
    padding: 8px 15px;
    vertical-align: middle;
    text-align: left;
    /* Left align content */
    border-left: 1px solid #ccc;
    border-right: 1px solid #ccc;
    border-bottom: none;
    /* No internal borders */
    white-space: nowrap;
    /* Prevents hints from wrapping to next line */
}

.grid-row:first-of-type .grid-content {
    border-top: 1px solid #ccc;
    border-top-left-radius: 4px;
    border-top-right-radius: 4px;
}

.grid-row:last-of-type .grid-content {
    border-bottom: 1px solid #ccc;
    /* Only the last row has a bottom border */
    border-bottom-left-radius: 4px;
    border-bottom-right-radius: 4px;
}

/* Ensure inner elements in grid-content don't break flex-like alignment */
.grid-content>* {
    display: inline-block;
    vertical-align: middle;
    margin: 2px 8px 2px 0;
}

.grid-content>*:last-child {
    margin-right: 0;
}

.pra-grid-form input[type="number"] {
    width: 80px;
    padding: 4px;
    border: 1px solid #999;
    background: #fff;
    font-size: 16px;
    border-radius: 2px;
    display: inline-block;
    vertical-align: middle;
}

.pra-grid-form input[type="number"]:focus {
    outline: none;
    border-color: #17669d;
    box-shadow: 0 0 0 3px rgba(23, 102, 157, 0.2);
    /* Ensure focus doesn't change layout properties */
    display: inline-block !important;
}

.grid-hint {
    font-size: 15px;
    color: #000;
}

/* Professional Custom Radio Styling */
.radio-box-container,
.radio-stack-container {
    background: #fff;
    border: 1px solid #999;
    border-radius: 2px;
    padding: 5px 10px;
    display: flex;
}

.radio-box-container {
    gap: 20px;
    align-items: center;
    display: inline-flex;
}

.radio-stack-container {
    flex-direction: column;
    gap: 8px;
    padding: 10px;
    width: 100%;
    box-sizing: border-box;
}

.radio-box-container label,
.radio-stack-container label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 14.5px;
    color: #333;
    transition: color 0.2s ease;
    -webkit-user-select: none;
    user-select: none;
}

.radio-box-container label:hover,
.radio-stack-container label:hover {
    color: #17669d;
}

.radio-box-container input[type="radio"],
.radio-stack-container input[type="radio"] {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid #999;
    border-radius: 50%;
    background: #fff;
    margin: 0;
    display: grid;
    place-content: center;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

.radio-box-container input[type="radio"]::before,
.radio-stack-container input[type="radio"]::before {
    content: "";
    width: 10px;
    height: 10px;
    border-radius: 50%;
    transform: scale(0);
    transition: 0.15s transform ease-in-out;
    background-color: #17669d;
}

.radio-box-container input[type="radio"]:checked,
.radio-stack-container input[type="radio"]:checked {
    border-color: #17669d;
}

.radio-box-container input[type="radio"]:checked::before,
.radio-stack-container input[type="radio"]:checked::before {
    transform: scale(1);
}

.radio-box-container input[type="radio"]:hover,
.radio-stack-container input[type="radio"]:hover {
    border-color: #17669d;
    box-shadow: 0 0 0 3px rgba(23, 102, 157, 0.1);
}

/* --- Results Area --- */
.pra-bottom-results {
    margin-top: 10px;
    padding: 10px 0;
    text-align: left;
    position: relative;
    top: -50px;
    left: 0px;
}

.res-line {
    margin: 12px 0;
    /* Vertically stretched */
    font-size: 15.5px;
}

.res-line .res-label {
    margin-right: 5px;
    /* Small space before value */
}

.spt-link {
    color: #00f;
    text-decoration: underline;
}

.color-low,
.color-medium,
.color-high {
    color: #00f;
    /* Values are blue in the legacy template */
}

.pra-main-container {
    -webkit-user-select: none;
    user-select: none;
}

/* --- Instructions Section (Restored Only) --- */
.manual {
    margin: 40px auto;
    width: 100%;
    max-width: 900px;
    background: white;
    padding: 20px;
    text-align: left;
}

p.manual-title {
    font-size: 24px;
    color: #333;
    font-weight: 300;
    margin-bottom: 50px;
    font-family: Heebo, Arial, sans-serif;
}

p.parameter-subtitle {
    font-weight: bold;
    font-size: 17px;
    margin-top: 20px;
    margin-bottom: 5px;
    color: #333;
    font-family: Heebo, Arial, sans-serif;
}

p.parameter-text {
    font-size: 16px;
    line-height: 1.5;
    margin-bottom: 10px;
    color: #333;
    font-family: Heebo, Arial, sans-serif;
}

hr {
    margin: 40px 0;
    border: 0;
    border-top: 1px solid #E1E1E1;
}

/* --- Footer Style --- */
.pra-footer-info {
    width: 100%;
    max-width: 950px;
    margin: 40px auto 20px;
    padding: 0 10px;
}

.pra-tophr {
    border: 0;
    border-top: 1px solid #ccc;
}

.pra-bottom-hr {
    border: 0;
    border-top: 1px solid #ccc;
    margin: 10px 0;
}

.footer-row {
    display: flex;
    justify-content: space-between;
    font-size: 13.5px;
    color: #333;
}

/* Mobile Adjustments */
@media screen and (max-width: 950px) {
    .pra-flex-layout {
        flex-direction: column;
        align-items: center;
    }

    .pra-chart-side {
        width: 100%;
        flex: 0 0 auto;
    }

    .pra-form-side {
        width: 100%;
    }

    .grid-row {
        grid-template-columns: 140px 1fr;
    }

    .grid-label {
        font-size: 13px;
    }
}

/* Print Styles */
/* Article Download Button */
.article-download-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 18px;
    background-color: #ffffff;
    color: #17669d;
    text-decoration: none;
    border: 1.5px solid #17669d;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin: 10px 0 20px 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.article-download-btn i {
    font-size: 1.2rem;
    color: #e74c3c;
    /* PDF Red */
    transition: color 0.3s ease;
}

.article-download-btn:hover {
    background-color: #17669d;
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(23, 102, 157, 0.2);
}

.article-download-btn:hover i {
    color: #ffffff;
}

@media print {
    @page {
        margin: 1.5cm;
    }

    body {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        background-color: white !important;
    }

    /* 1. Hide unwanted UI elements */
    .header-container,
    .footer,
    .copyright,
    #instructions-content,
    .control-button,
    #chart-print-button,
    .header-row:first-of-type,
    #scroll-to-top-button,
    .cookie_banner,
    /* also common class name */
    .cookie-banner {
        display: none !important;
    }

    /* 2. Reset containers for print */
    .window,
    .page,
    .content,
    .pra-container {
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        max-width: none !important;
        box-shadow: none !important;
        border: none !important;
        background: white !important;
        display: block !important;
    }

    .pra-main-container {
        width: 950px !important;
        margin: 0 auto !important;
        padding-top: 0 !important;
        box-shadow: none !important;
        border: none !important;
        zoom: 0.85;
        /* Shrink content slightly to fit A4 width */
    }

    .pra-flex-layout {
        display: flex !important;
        flex-direction: row !important;
        align-items: flex-start !important;
        width: 950px !important;
    }

    .pra-chart-side {
        flex: 0 0 420px !important;
        width: 420px !important;
    }

    .pra-form-side {
        flex: 1 !important;
    }

    .pra-footer-info {
        margin-top: 20px !important;
    }

    /* 3. Style preservation */
    .header-input {
        background-color: #e7f3fd !important;
        border: 1px solid #999 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .pra-tophr,
    .pra-bottom-hr {
        display: block !important;
        border-top: 1px solid #ccc !important;
        margin: 15px 0 !important;
    }

    /* Ensure result colors are blue on print as well */
    .color-low,
    .color-medium,
    .color-high,
    .text-blue {
        color: #00f !important;
    }

    /* Prevent URLs from printing next to links */
    a[href]:after {
        content: none !important;
    }
}

/* --- RTL Support --- */
[dir="rtl"] .pra-flex-layout {
    flex-direction: row-reverse;
    gap: 50px;
}

[dir="rtl"] .form-title {
    text-align: right;
    transform-origin: right center;
}

[dir="rtl"] .grid-label {
    text-align: left;
}

[dir="rtl"] .grid-content {
    text-align: right;
    border-left: 1px solid #ccc;
    border-right: 1px solid #ccc;
}

[dir="rtl"] .grid-content>* {
    margin: 2px 0 2px 8px;
}

[dir="rtl"] .grid-content>*:last-child {
    margin-left: 0;
}

[dir="rtl"] .pra-bottom-results {
    text-align: right;
}

/* Date Display for Print */
.date-input-wrapper {
    position: relative;
    flex-grow: 1;
    display: flex;
    align-items: center;
}

.date-print-only {
    display: none;
    font-size: 18px;
    font-family: "Arial", Regular, Sans-Serif;
    padding: 3px 4px;
}

@media print {
    .date-input-field {
        display: none !important;
    }

    .date-print-only {
        display: inline-block !important;
    }
}

/* Tool specific capture logic (dom-to-image) uses specific styling */
.pra-main-container.is-exporting .date-input-field {
    display: none !important;
}

.pra-main-container.is-exporting .date-print-only {
    display: inline-block !important;
}


[dir="rtl"] .res-line .res-label {
    margin-right: 0;
    margin-left: 5px;
}

[dir="rtl"] .manual {
    text-align: right;
}

[dir="rtl"] .pra-capture-wrapper {
    left: auto;
    right: 125px;
}

/* Contact Modal RTL */
[dir="rtl"] .contact-modal .modal-body {
    text-align: right;
}

[dir="rtl"] .contact-modal .modal-header,
[dir="rtl"] .contact-modal .contact-grid {
    display: flex;
    flex-direction: row;
    /* Natural RTL mirror */
}