/* Florida Digital Signatures - Frontend Styles */

body.fds-signature-page,
body.fds-success-page {
    margin: 0;
    padding: 0;
    background: #f5f7fa;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

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

/* Mobile container adjustments */
@media screen and (max-width: 768px) {
    .fds-container {
        padding: 10px;
    }
    
    .fds-document-container {
        padding: 20px;
        border-radius: 4px;
    }
}

.fds-header {
    text-align: center;
    padding: 30px 0;
    background: white;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.fds-logo {
    max-width: 200px;
    height: auto;
    margin-bottom: 15px;
}

.fds-header h1 {
    margin: 0;
    color: #333;
    font-size: 28px;
}

.fds-document-container {
    background: white;
    border-radius: 8px;
    padding: 40px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Step 4 needs full width for preview */
#step-4 {
    width: 100%;
}

#step-4 .fds-document-container {
    max-width: none;
    padding: 20px;
}

.fds-document-container h2 {
    color: #0073aa;
    border-bottom: 2px solid #0073aa;
    padding-bottom: 15px;
    margin-bottom: 30px;
}

.fds-step h3 {
    color: #555;
    margin-bottom: 20px;
}

.fds-field-group {
    margin-bottom: 20px;
}

.fds-field-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
}

.fds-field-group .required {
    color: #d63638;
}

.fds-field {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}

.fds-field:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 1px #0073aa;
}

textarea.fds-field {
    min-height: 100px;
    resize: vertical;
}

.fds-signature-input {
    font-family: 'Brush Script MT', cursive;
    font-size: 24px;
    background: #f9f9f9;
    border: 2px solid #333;
}

.fds-verification-input {
    font-size: 24px;
    text-align: center;
    letter-spacing: 10px;
    max-width: 200px;
}

.fds-help-text {
    font-size: 14px;
    color: #666;
    margin-top: 5px;
}

.fds-integrated-document {
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 40px;
    margin-bottom: 30px;
    line-height: 1.8;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    font-size: 16px;
    text-align: justify;
}

/* ADAPTIVE MOBILE LAYOUT - Page 1: Form Filling Mode */
@media screen and (max-width: 768px) {
    /* Only apply mobile form optimization to signature page, not final document view */
    body.fds-signature-page .fds-integrated-document {
        padding: 15px;
        font-size: 16px;
        text-align: left;
        line-height: 1.5;
    }
    
    body.fds-signature-page .fds-integrated-document p {
        text-align: left !important;
        margin-bottom: 15px;
    }
    
    /* Mobile-optimized form fields for filling */
    body.fds-signature-page .fds-inline-field {
        display: block;
        width: 100%;
        margin: 10px 0;
        min-width: unset;
        padding: 12px;
        font-size: 16px;
        border: 2px solid #0073aa;
        border-radius: 8px;
        background: #f8f9fa;
    }
    
    body.fds-signature-page .fds-inline-field:focus {
        border-color: #005a87;
        background: #fff;
    }
    
    body.fds-signature-page .fds-field-wrapper {
        display: block;
        margin: 20px 0;
        padding: 10px;
        background: #f0f8ff;
        border-radius: 8px;
        border-left: 4px solid #0073aa;
    }
    
    body.fds-signature-page .fds-field-wrapper::before {
        content: attr(data-label);
        display: block;
        font-weight: bold;
        color: #0073aa;
        margin-bottom: 5px;
        font-size: 14px;
    }
}

/* ADAPTIVE MOBILE LAYOUT - Page 2: Final Document View Mode */
/* This maintains professional document appearance for signed documents */
@media screen and (max-width: 768px) {
    /* Styles for final document view (when not filling form) */
    .fds-document-preview,
    .fds-success-page .fds-document-container,
    iframe[src*="view-agreement"] {
        /* Keep professional document styling */
        font-size: 12px;
        line-height: 1.4;
        text-align: justify;
        padding: 15px;
    }
    
    /* Allow horizontal scrolling for document integrity */
    .fds-document-preview {
        overflow-x: auto;
        white-space: nowrap;
        min-width: 300px;
    }
    
    .fds-document-preview * {
        white-space: normal;
    }
    
    /* Make download button prominent on mobile */
    .fds-success-actions {
        text-align: center;
        margin: 20px 0;
    }
    
    .fds-success-actions .fds-btn {
        display: block;
        width: 100%;
        margin: 10px 0;
        padding: 15px;
        font-size: 16px;
    }
}

.fds-document-logo {
    text-align: center;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #ddd;
}

.fds-document-logo img {
    max-width: 250px;
    max-height: 100px;
    height: auto;
    object-fit: contain;
}

.fds-field-wrapper {
    display: inline-block;
    position: relative;
}

.fds-inline-field {
    border: none;
    border-bottom: 1px dotted #333;
    background: transparent;
    padding: 2px 8px;
    font-size: 16px;
    font-family: Arial, sans-serif;
    color: #333;
    min-width: 150px;
}

.fds-inline-field:focus {
    outline: none;
    background: #f0f8ff;
    border-bottom-color: #005a87;
}

.fds-inline-field::placeholder {
    color: #999;
    font-style: italic;
    font-weight: normal;
}

.fds-inline-field[type="date"] {
    min-width: 150px;
}

.fds-inline-field[type="email"] {
    min-width: 250px;
}

textarea.fds-inline-field {
    min-width: 300px;
    min-height: 60px;
    resize: vertical;
    border: 1px solid #0073aa;
    border-radius: 4px;
    padding: 10px;
}

/* Validation error styling */
.fds-inline-field.error,
.fds-inline-field:invalid {
    border-color: #d63638;
    border-width: 2px;
    background-color: #ffebee;
}

/* Readonly date field styling */
.fds-inline-field.fds-system-date,
.fds-inline-field.fds-signature-date {
    background-color: #f8f9fa;
    color: #495057;
    border: 1px solid #dee2e6;
    cursor: not-allowed;
    font-weight: 500;
}

.fds-inline-field.fds-system-date:focus,
.fds-inline-field.fds-signature-date:focus {
    background-color: #f8f9fa;
    border-color: #dee2e6;
    box-shadow: none;
    outline: none;
}

/* Mobile readonly field styling */
@media screen and (max-width: 768px) {
    body.fds-signature-page .fds-inline-field.fds-system-date,
    body.fds-signature-page .fds-inline-field.fds-signature-date {
        background: #f8f9fa;
        border: 2px solid #6c757d;
        color: #495057;
        cursor: not-allowed;
        font-weight: 500;
    }
    
    body.fds-signature-page .fds-inline-field.fds-system-date:focus,
    body.fds-signature-page .fds-inline-field.fds-signature-date:focus {
        background: #f8f9fa;
        border-color: #6c757d;
    }
}

.fds-integrated-document h1,
.fds-integrated-document h2,
.fds-integrated-document h3 {
    color: #333;
    text-align: center;
}

.fds-integrated-document h1 {
    font-size: 28px;
    font-weight: bold !important;
    margin: 20px 0;
    text-decoration: underline;
}

.fds-integrated-document h2 {
    font-size: 24px;
    font-weight: bold !important;
    margin: 18px 0;
}

.fds-integrated-document h3 {
    font-size: 20px;
    font-weight: bold !important;
    margin: 16px 0;
}

.fds-integrated-document h4,
.fds-integrated-document h5,
.fds-integrated-document h6 {
    font-weight: bold !important;
    margin: 14px 0;
}

.fds-integrated-document p {
    margin: 15px 0;
    text-align: justify;
}

.fds-integrated-document ol {
    margin: 20px 0 20px 0;
    padding-left: 40px;
    list-style: decimal !important; /* Override theme's list-style: none */
}

.fds-integrated-document ol li {
    margin: 12px 0;
    line-height: 1.6;
    text-align: justify;
    list-style-type: decimal !important; /* Ensure numbers show */
    display: list-item !important; /* Ensure proper list display */
}

.fds-integrated-document ul {
    margin: 20px 0;
    padding-left: 40px;
}

.fds-integrated-document ul li {
    margin: 10px 0;
}

/* Text formatting styles - ensure they override theme styles */
.fds-integrated-document strong,
.fds-integrated-document b {
    font-weight: bold !important;
    color: inherit;
}

.fds-integrated-document em,
.fds-integrated-document i {
    font-style: italic !important;
}

.fds-integrated-document u {
    text-decoration: underline !important;
}

.fds-document-preview {
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 20px;
    margin-bottom: 20px;
    max-height: 400px;
    overflow-y: auto;
}

.fds-consent-section {
    background: #f0f8ff;
    border: 1px solid #b3d9ff;
    border-radius: 4px;
    padding: 15px;
    margin: 20px 0;
}

.fds-checkbox-label {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    cursor: pointer;
}

.fds-checkbox-label input[type="checkbox"] {
    margin-right: 10px;
    width: 18px;
    height: 18px;
}

.fds-button-group {
    display: flex;
    gap: 10px;
    justify-content: space-between;
    margin-top: 30px;
}

.fds-btn {
    padding: 12px 30px;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
}

.fds-btn-primary {
    background: #0073aa;
    color: white;
}

.fds-btn-primary:hover {
    background: #005a87;
}

.fds-btn-secondary {
    background: #f0f0f1;
    color: #333;
}

.fds-btn-secondary:hover {
    background: #dcdcde;
}

.fds-btn-success {
    background: #00a32a;
    color: white;
}

.fds-btn-success:hover {
    background: #008a20;
}

.fds-footer {
    text-align: center;
    margin-top: 30px;
    padding: 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.fds-legal-text {
    font-size: 14px;
    color: #666;
    margin-bottom: 10px;
}

.fds-security-info {
    font-size: 12px;
    color: #999;
}

/* Success Page Styles */
.fds-success-container {
    background: white;
    border-radius: 8px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.fds-success-icon {
    display: inline-block;
    width: 80px;
    height: 80px;
    line-height: 80px;
    font-size: 48px;
    color: white;
    background: #00a32a;
    border-radius: 50%;
    margin-bottom: 20px;
}

.fds-success-details {
    background: #f9f9f9;
    border-radius: 4px;
    padding: 20px;
    margin: 30px 0;
    text-align: left;
}

.fds-details-table {
    width: 100%;
    margin: 10px 0;
}

.fds-details-table td {
    padding: 8px;
    border-bottom: 1px solid #eee;
}

.fds-details-table td:first-child {
    width: 40%;
    color: #666;
}

.fds-success-actions {
    margin: 30px 0;
}

.fds-success-actions .fds-btn {
    display: inline-block;
    margin: 10px;
    text-decoration: none;
}

.fds-legal-notice {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 4px;
    padding: 15px;
    margin-top: 30px;
    text-align: left;
}

.fds-legal-notice h4 {
    color: #856404;
    margin-top: 0;
}

.fds-legal-notice p {
    color: #856404;
    font-size: 14px;
    margin: 0;
}


/* Preview Page Styles */
.fds-preview-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 20px;
    padding: 15px;
    background: #f0f8ff;
    border-radius: 4px;
}


.fds-btn-large {
    padding: 15px 40px;
    font-size: 18px;
}

.fds-icon {
    margin-right: 5px;
}

.fds-preview-container {
    background: #e0e0e0;
    border: 1px solid #999;
    border-radius: 8px;
    padding: 20px;
    margin: 0 auto 20px;
    height: 80vh;
    max-height: 900px;
    overflow-y: auto;
    overflow-x: auto;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.fds-document-preview {
    font-family: 'Times New Roman', Times, serif;
    font-size: 12pt;
    line-height: 1.5;
    color: #000;
    background: white;
    width: 816px; /* 8.5 inches at 96dpi */
    min-height: 1056px; /* 11 inches at 96dpi */
    padding: 72px; /* 0.75 inch margins */
    box-shadow: 0 0 20px rgba(0,0,0,0.2);
    transform: scale(0.8); /* Scale to 80% to fit viewport */
    transform-origin: top center;
    margin: 0 auto;
    position: relative;
}

.fds-document-header {
    text-align: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
}

.fds-document-content {
    margin: 30px 0;
    font-size: 12pt;
    line-height: 1.5;
}

.fds-document-content p {
    margin: 10px 0;
    text-align: left;
}

.fds-document-content p.center,
.fds-document-content .center {
    text-align: center;
}

.fds-document-content .underline {
    text-decoration: underline;
}

.fds-document-content h1,
.fds-document-content h2,
.fds-document-content h3,
.fds-document-content h4 {
    font-weight: bold;
    margin: 15px 0 10px 0;
}

.fds-document-content h1 { font-size: 16pt; }
.fds-document-content h2 { font-size: 14pt; }
.fds-document-content h3 { font-size: 13pt; }
.fds-document-content h4 { font-size: 12pt; }

.fds-document-content strong,
.fds-document-content b {
    font-weight: bold;
}

.fds-document-content ol,
.fds-document-content ul {
    margin: 10px 0;
    padding-left: 30px;
}

.fds-document-content li {
    margin: 5px 0;
}

.fds-signature-block {
    margin-top: 30px;
    padding: 15px;
    border: 1px solid #000;
    background: #f9f9f9;
}

.fds-signature-block h3 {
    text-align: center;
    margin: 0 0 15px 0;
    font-size: 14pt;
    font-weight: bold;
    text-decoration: underline;
}

.fds-signature-table {
    width: 100%;
    margin: 10px 0;
    border-collapse: collapse;
    font-size: 11pt;
}

.fds-signature-table td {
    padding: 5px 10px;
    border-bottom: 1px solid #ccc;
    vertical-align: top;
}

.fds-signature-table td:first-child {
    width: 30%;
    font-weight: bold;
}

.fds-final-consent {
    background: #fffbf0;
    border: 2px solid #ff9800;
    border-radius: 4px;
    padding: 20px;
    margin: 20px 0;
}

.fds-final-consent-check {
    font-size: 16px;
}

.fds-final-consent-check input[type="checkbox"] {
    margin-right: 12px;
    width: 20px;
    height: 20px;
}

/* Final Document Step Styles */
.fds-success-notice {
    background: #d4edda;
    border: 2px solid #c3e6cb;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 30px;
    text-align: center;
}

.fds-success-notice .fds-success-icon {
    display: inline-block;
    width: 50px;
    height: 50px;
    line-height: 50px;
    font-size: 30px;
    color: white;
    background: #28a745;
    border-radius: 50%;
    margin-bottom: 15px;
}

.fds-success-notice p {
    margin: 10px 0;
    color: #155724;
}

.fds-final-document-actions {
    text-align: center;
    margin: 30px 0;
}

.fds-final-document-actions h4 {
    margin-bottom: 20px;
    color: #333;
}

.fds-download-buttons {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.fds-btn small {
    display: block;
    font-size: 12px;
    font-weight: normal;
    opacity: 0.8;
    margin-top: 2px;
}

.fds-final-footer {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 20px;
    margin-top: 30px;
    text-align: center;
}

.fds-final-footer p {
    margin: 5px 0;
}

#step-4 h3 {
    text-align: center;
    color: #28a745;
    margin-bottom: 30px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .fds-container {
        padding: 10px;
    }
    
    .fds-document-container {
        padding: 20px;
    }
    
    .fds-button-group {
        flex-direction: column;
    }
    
    .fds-btn {
        width: 100%;
    }
    
    .fds-preview-actions {
        flex-direction: column;
    }
}

/* Print Styles for PDF Generation */
@media print {
    @page {
        size: 8.5in 11in;
        margin: 0.75in;
    }
    
    /* Hide non-printable elements */
    .fds-preview-actions,
    .fds-final-consent,
    .fds-button-group,
    .fds-btn,
    .fds-no-print,
    .fds-step h3,
    .fds-preview-container {
        display: none !important;
    }
    
    /* Reset body styles for print */
    body {
        margin: 0;
        padding: 0;
        background: white;
        font-family: 'Times New Roman', Times, serif;
        font-size: 12pt;
        line-height: 1.5;
        color: #000;
    }
    
    /* Document preview becomes the main content */
    .fds-document-preview {
        display: block !important;
        margin: 0;
        padding: 0;
        border: none;
        box-shadow: none;
        max-height: none;
        overflow: visible;
    }
    
    /* Header styling for print */
    .fds-document-header {
        text-align: center;
        margin-bottom: 30pt;
        padding-bottom: 15pt;
        border-bottom: 2pt solid #000;
        page-break-after: avoid;
    }
    
    .fds-document-logo img {
        max-width: 200pt;
        max-height: 80pt;
        margin: 0 auto;
        display: block;
    }
    
    /* Content styling for print */
    .fds-document-content {
        margin: 20pt 0;
    }
    
    .fds-document-content h1,
    .fds-document-content h2,
    .fds-document-content h3 {
        font-weight: bold;
        page-break-after: avoid;
        margin: 15pt 0 10pt 0;
    }
    
    .fds-document-content h1 { font-size: 18pt; }
    .fds-document-content h2 { font-size: 16pt; }
    .fds-document-content h3 { font-size: 14pt; }
    
    .fds-document-content p {
        margin: 8pt 0;
        text-align: justify;
        orphans: 3;
        widows: 3;
    }
    
    .fds-document-content .center {
        text-align: center;
    }
    
    .fds-document-content .underline {
        text-decoration: underline;
    }
    
    .fds-document-content ol,
    .fds-document-content ul {
        margin: 10pt 0;
        padding-left: 30pt;
    }
    
    .fds-document-content li {
        margin: 5pt 0;
        page-break-inside: avoid;
    }
    
    /* Signature block for print */
    .fds-signature-block {
        margin-top: 40pt;
        padding: 15pt;
        border: 2pt solid #000;
        background: #f5f5f5 !important;
        page-break-inside: avoid;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    .fds-signature-block h3 {
        text-align: center;
        font-size: 14pt;
        font-weight: bold;
        margin-bottom: 15pt;
        text-decoration: underline;
    }
    
    .fds-signature-table {
        width: 100%;
        border-collapse: collapse;
    }
    
    .fds-signature-table td {
        padding: 6pt 10pt;
        border-bottom: 1pt solid #999;
        font-size: 11pt;
    }
    
    .fds-signature-table td:first-child {
        font-weight: bold;
        width: 35%;
    }
    
    /* Legal notice for print */
    .fds-legal-notice {
        margin-top: 20pt;
        padding: 10pt;
        border: 1pt solid #666;
        background: #fffbf0 !important;
        page-break-inside: avoid;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    .fds-legal-notice h4 {
        font-size: 12pt;
        font-weight: bold;
        margin: 0 0 8pt 0;
    }
    
    .fds-legal-notice p {
        font-size: 10pt;
        margin: 0;
        text-align: justify;
    }
    
    /* Ensure proper page breaks */
    h1, h2, h3, h4, h5, h6 {
        page-break-after: avoid;
    }
    
    p {
        orphans: 3;
        widows: 3;
    }
    
    table {
        page-break-inside: avoid;
    }
}