@page {
    size: A4 portrait;
    margin: 8mm;
}

:root {
    --avis-red: #c51f32;
    --avis-red-dark: #a91623;
    --text: #292929;
    --muted: #777777;
    --border: #d9d9d9;
    --page-background: #f1f1ef;
    --white: #ffffff;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

html {
    min-height: 100%;
}

body {
    min-height: 100vh;
    background: var(--page-background);
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
    -webkit-font-smoothing: antialiased;
}

button,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

.page-shell {
    min-height: 100vh;
    padding: 25px 12px 45px;
}

/* =========================================================
   ANA FORM KARTI
   ========================================================= */

.form-card {
    width: 420px;
    max-width: 100%;
    min-height: auto;
    margin: 0 auto;
    padding: 18px;
    background: var(--white);
    border: 1px solid #e2e2e2;
    border-radius: 8px 8px 0 0;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.09);
}

/* =========================================================
   AVIS BAŞLIĞI
   ========================================================= */

.document-header {
    margin-bottom: 12px;
    text-align: center;
}

.avis-title {
    margin: 0;
    color: var(--avis-red);
    font-size: 45px;
    font-weight: 900;
    line-height: 0.95;
    letter-spacing: -2px;
}

.form-title {
    margin-top: 5px;
    color: #202020;
    font-size: 19px;
    font-weight: 800;
    line-height: 1.1;
}

/* =========================================================
   AD SOYAD VE TARİH
   ========================================================= */

.identity-row {
    display: block;
    margin: 0;
    font-size: 13px;
}

.identity-field {
    display: block;
    margin: 11px 0 0;
}

.identity-field strong {
    display: block;
    margin-bottom: 6px;
    color: #333333;
    font-size: 13px;
    font-weight: 700;
}

/* Tarih müşteri ekranında görünmez, PDF'de görünür. */
.identity-row .identity-field:last-child {
    display: none;
}

.identity-row input,
#fullName,
#formDate {
    display: block;
    width: 100%;
    height: 42px;
    padding: 0 11px;
    color: #333333;
    font-size: 14px;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 6px;
    outline: none;
    transition:
        border-color 0.18s ease,
        box-shadow 0.18s ease;
}

.identity-row input::placeholder,
#fullName::placeholder {
    color: #969696;
}

.identity-row input:focus,
#fullName:focus,
#formDate:focus {
    border-color: var(--avis-red);
    box-shadow: 0 0 0 3px rgba(197, 31, 50, 0.09);
}

/* =========================================================
   SÖZLEŞME KUTUSU
   ========================================================= */

.contract-text {
    width: 100%;
    height: 300px;
    margin: 10px 0 0;
    padding: 10px 12px;
    overflow-x: hidden;
    overflow-y: auto;
    color: #333333;
    font-size: 12px;
    line-height: 1.42;
    background: #fafafa;
    border: 1px solid var(--border);
    border-radius: 5px;
    scrollbar-width: thin;
    scrollbar-color: #6c6c6c #eeeeee;
    overscroll-behavior: contain;
}

.contract-text::-webkit-scrollbar {
    width: 8px;
}

.contract-text::-webkit-scrollbar-track {
    background: #eeeeee;
    border-radius: 8px;
}

.contract-text::-webkit-scrollbar-thumb {
    background: #6b6b6b;
    border-radius: 8px;
}

.contract-text::-webkit-scrollbar-thumb:hover {
    background: #505050;
}

.contract-text h1 {
    margin: 0 0 8px;
    color: #333333;
    font-size: 13px;
    font-weight: 700;
}

.contract-text p {
    margin: 0 0 8px;
}

.contract-text strong {
    font-weight: 700;
}

.subitems {
    margin: 0;
    padding: 0;
}

.subitems p {
    margin-bottom: 7px;
}

.notice {
    margin-top: 11px !important;
    font-weight: 700;
}

/* Önceki örnek hukuk notunu müşteri ekranından kaldırır. */
.legal-review-note {
    display: none !important;
}

/* =========================================================
   KABUL KUTUSU
   ========================================================= */

/*
   Örnekte kabul kutusu görünmediği için görsel olarak gizlidir.
   index.php içindeki input ayrıca checked olmalıdır.
*/
.acceptance {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    margin: -1px !important;
    padding: 0 !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* =========================================================
   İMZA ALANI
   ========================================================= */

.signature-section {
    margin-top: 14px;
}

.signature-section h2 {
    margin: 0 0 6px;
    color: #333333;
    font-size: 13px;
    font-weight: 700;
}

.signature-wrap {
    position: relative;
    width: 100%;
    height: 160px;
    overflow: hidden;
    background: #ffffff;
    border: 1px dashed #c7c7c7;
    border-radius: 5px;
    touch-action: none;
    user-select: none;
}

#signatureCanvas {
    display: block;
    width: 100%;
    height: 100%;
    cursor: crosshair;
    touch-action: none;
}

#signaturePrint {
    display: none;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: left bottom;
}

.signature-placeholder {
    display: none !important;
}

.signature-actions {
    margin: 0;
}

#clearSignature,
.clear-signature {
    display: block;
    margin: 5px 0 12px auto;
    padding: 0;
    color: #b52b36;
    font-size: 11px;
    font-weight: 400;
    line-height: 1.3;
    text-decoration: underline;
    background: transparent;
    border: 0;
    box-shadow: none;
}

#clearSignature:hover,
.clear-signature:hover {
    color: #8f1723;
}

.signed-meta {
    display: none;
}

/* =========================================================
   ALT ONAY BUTONU
   ========================================================= */

.action-panel {
    width: 420px;
    max-width: 100%;
    margin: -1px auto 0;
    padding: 0 18px 18px;
    text-align: center;
    background: #ffffff;
    border: 1px solid #e2e2e2;
    border-top: 0;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.09);
}

.action-panel p {
    display: none;
}

#downloadPdf,
.submit-button,
button.primary {
    display: block;
    width: 100%;
    min-height: 43px;
    padding: 12px 14px;
    color: #ffffff;
    font-size: 13px;
    font-weight: 900;
    line-height: 1.2;
    letter-spacing: 0.2px;
    text-align: center;
    background:
        linear-gradient(
            180deg,
            #cc343e 0%,
            var(--avis-red-dark) 100%
        );
    border: 0;
    border-radius: 5px;
    box-shadow: 0 5px 12px rgba(177, 25, 35, 0.23);
    transition:
        filter 0.18s ease,
        transform 0.08s ease;
}

#downloadPdf:hover,
.submit-button:hover,
button.primary:hover {
    filter: brightness(1.05);
}

#downloadPdf:active,
.submit-button:active,
button.primary:active {
    transform: translateY(1px);
}

button.secondary {
    color: #333333;
    background: #eeeeee;
}

button:focus-visible,
input:focus-visible {
    outline: 3px solid rgba(197, 31, 50, 0.22);
    outline-offset: 2px;
}

/* =========================================================
   MOBİL GÖRÜNÜM
   ========================================================= */

@media (max-width: 600px) {
    body {
        background: #f1f1ef;
    }

    .page-shell {
        padding: 10px 7px 25px;
    }

    .form-card {
        width: 100%;
        padding: 14px;
    }

    .avis-title {
        font-size: 41px;
    }

    .form-title {
        font-size: 18px;
    }

    .contract-text {
        height: 320px;
        padding: 10px;
        font-size: 12px;
        line-height: 1.43;
    }

    .identity-row input,
    #fullName {
        height: 43px;
        font-size: 16px;
    }

    .signature-wrap {
        height: 150px;
    }

    .action-panel {
        position: static;
        width: 100%;
        padding: 0 14px 14px;
    }

    #downloadPdf {
        min-height: 46px;
    }
}

/* =========================================================
   PDF / YAZDIRMA GÖRÜNÜMÜ
   ========================================================= */

@media print {
    html,
    body {
        width: 100%;
        min-height: auto;
        background: #ffffff !important;
    }

    body {
        color: #111111;
    }

    .page-shell {
        min-height: auto;
        padding: 0 !important;
    }

    .form-card {
        width: 100% !important;
        max-width: none !important;
        min-height: auto !important;
        margin: 0 !important;
        padding: 0 !important;
        background: #ffffff !important;
        border: 0 !important;
        border-radius: 0 !important;
        box-shadow: none !important;
    }

    .document-header {
        margin-bottom: 5mm;
    }

    .avis-title {
        font-size: 28pt;
    }

    .form-title {
        font-size: 11pt;
    }

    .identity-row {
        display: grid !important;
        grid-template-columns: 1fr 55mm;
        gap: 6mm;
        margin-bottom: 4mm;
        font-size: 8.5pt;
    }

    .identity-row .identity-field {
        display: block !important;
        margin: 0;
    }

    .identity-row .identity-field:last-child {
        display: block !important;
    }

    .identity-field strong {
        margin-bottom: 1mm;
        font-size: 8.5pt;
    }

    .identity-row input,
    #fullName,
    #formDate {
        height: auto !important;
        padding: 0 0 1mm !important;
        font-size: 8.5pt !important;
        background: transparent !important;
        border: 0 !important;
        border-bottom: 1px solid #555555 !important;
        border-radius: 0 !important;
        box-shadow: none !important;
    }

    .contract-text {
        width: 100% !important;
        height: auto !important;
        max-height: none !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: visible !important;
        color: #111111 !important;
        font-size: 8.3pt !important;
        line-height: 1.23 !important;
        background: #ffffff !important;
        border: 0 !important;
        border-radius: 0 !important;
    }

    .contract-text h1 {
        margin: 0 0 2mm !important;
        font-size: 9pt !important;
    }

    .contract-text p {
        margin: 0 0 1.35mm !important;
    }

    .subitems p {
        margin-bottom: 1.2mm !important;
    }

    .acceptance,
    .action-panel,
    .signature-actions,
    #clearSignature,
    .clear-signature,
    .no-print,
    .legal-review-note {
        display: none !important;
    }

    .signature-section {
        margin-top: 4mm !important;
        page-break-inside: avoid;
    }

    .signature-section h2 {
        margin-bottom: 1mm;
        font-size: 8.5pt;
    }

    .signature-wrap {
        width: 70mm !important;
        height: 28mm !important;
        background: #ffffff !important;
        border: 0 !important;
        border-bottom: 1px solid #333333 !important;
        border-radius: 0 !important;
    }

    #signatureCanvas {
        display: none !important;
    }

    #signaturePrint {
        display: block !important;
    }

    .signed-meta {
        display: block !important;
        margin-top: 2mm;
        font-size: 8pt;
        line-height: 1.35;
    }
}