/* DariaSignature - CSS Styling
   Colors: Primary #182947 (Dark Blue), Accent #9B866E (Bronze/Gold)
   Font: Arial
*/

/* Reset and Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: Arial, sans-serif;
    background-color: #f5f5f5;
    color: #182947;
    line-height: 1.6;
    min-height: 100vh;
}

/* Container - wider for two-column layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header - Compact */
header {
    text-align: center;
    padding: 20px;
    background-color: #182947;
    color: #fff;
    border-radius: 8px 8px 0 0;
    margin-bottom: 0;
}

header h1 {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 5px;
    color: #fff;
}

header .instructions {
    font-size: 14px;
    color: #d0d0d0;
}

/* Main Grid - Two Column Layout */
.main-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    background-color: #fff;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Section Titles */
h2 {
    font-size: 18px;
    font-weight: bold;
    color: #182947;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #9B866E;
}

/* Form Section - Left Column */
.form-section {
    padding: 25px;
    border-right: 1px solid #e0e0e0;
}

/* Form Section Titles (within form) */
.form-section-title {
    font-size: 15px;
    font-weight: bold;
    color: #182947;
    margin-top: 25px;
    margin-bottom: 8px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
}

.form-hint {
    font-size: 12px;
    color: #666;
    margin-bottom: 12px;
}

/* Form Groups */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: bold;
    color: #182947;
    margin-bottom: 4px;
}

.form-group input {
    width: 100%;
    padding: 10px 12px;
    font-size: 14px;
    font-family: Arial, sans-serif;
    border: 1px solid #ccc;
    border-radius: 4px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: #9B866E;
    box-shadow: 0 0 0 3px rgba(155, 134, 110, 0.2);
}

.form-group input::placeholder {
    color: #999;
}

.form-group input.error {
    border-color: #c0392b;
    background-color: #fef5f5;
}

.form-group input.error:focus {
    border-color: #c0392b;
    box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.2);
}

.error-message {
    display: block;
    color: #c0392b;
    font-size: 11px;
    margin-top: 3px;
}

/* Required Field Indicator */
.required {
    color: #c0392b;
    font-weight: bold;
}

/* Signatures Column - Right Column */
.signatures-column {
    padding: 25px;
    background-color: #fafafa;
    position: sticky;
    top: 20px;
    align-self: start;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    /* Force GPU compositing to prevent scroll repaint artifacts */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

/* Signature Boxes */
.signature-box {
    background-color: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    margin-bottom: 20px;
    overflow: hidden;
}

.signature-box:last-child {
    margin-bottom: 0;
}

.signature-label {
    font-size: 12px;
    font-weight: bold;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 10px 15px;
    background-color: #f0f0f0;
    border-bottom: 1px solid #e0e0e0;
    margin: 0;
}

.signature-content {
    padding: 20px;
    min-height: 180px;
    overflow-x: auto;
    /* Force GPU compositing to prevent scroll repaint artifacts */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

/* Preview Box - Highlighted */
.preview-box {
    border-color: #9B866E;
}

.preview-box .signature-label {
    background-color: #182947;
    color: #fff;
    border-bottom-color: #182947;
}

.preview-box .signature-content {
    background-color: #fff;
}

/* Placeholder Text */
.placeholder-text {
    color: #999;
    text-align: center;
    font-style: italic;
    padding: 60px 20px;
    font-size: 14px;
}

/* Output Actions */
.output-actions {
    padding: 15px;
    background-color: #f8f8f8;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 10px;
}

/* Buttons */
button {
    font-family: Arial, sans-serif;
    font-size: 14px;
    font-weight: bold;
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
}

button:active {
    transform: scale(0.98);
}

#copy-btn,
#copy-html-btn {
    flex: 1;
    background-color: #182947;
    color: #fff;
}

#copy-btn:hover:not(:disabled),
#copy-html-btn:hover:not(:disabled) {
    background-color: #0f1c33;
}

#copy-btn:disabled,
#copy-html-btn:disabled {
    background-color: #ccc;
    color: #666;
    cursor: not-allowed;
}

#copy-btn.success,
#copy-html-btn.success {
    background-color: #27ae60;
}

#copy-btn.error,
#copy-html-btn.error {
    background-color: #c0392b;
}

#copy-html-btn {
    background-color: #9B866E;
}

#copy-html-btn:hover:not(:disabled) {
    background-color: #8a7660;
}

/* Secondary Button (Reset) */
.secondary-btn {
    background-color: transparent;
    color: #666;
    border: 1px solid #ccc;
}

.secondary-btn:hover {
    background-color: #f0f0f0;
    border-color: #999;
    color: #333;
}

/* Mobile Notice - Hidden by default on desktop */
.mobile-notice {
    display: none;
}

/* Responsive Design */
@media (max-width: 900px) {
    /* Show mobile notice */
    .mobile-notice {
        display: flex;
        align-items: center;
        gap: 12px;
        background-color: #f8f4ef;
        border: 1px solid #9B866E;
        border-radius: 6px;
        padding: 12px 15px;
        margin-bottom: 15px;
    }

    .mobile-notice-icon {
        font-size: 24px;
        flex-shrink: 0;
    }

    .mobile-notice p {
        margin: 0;
        font-size: 13px;
        color: #182947;
        line-height: 1.4;
    }

    /* Prevent horizontal overflow on mobile */
    html, body {
        overflow-x: hidden;
    }

    .container {
        padding: 10px;
        max-width: 100%;
        overflow-x: hidden;
    }

    /* Stack columns on mobile */
    .main-grid {
        grid-template-columns: 1fr;
        max-width: 100%;
    }

    header {
        border-radius: 8px 8px 0 0;
    }

    header h1 {
        font-size: 20px;
    }

    .form-section {
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
        padding: 20px 15px;
        order: 2; /* Form below signatures on mobile */
        max-width: 100%;
    }

    .signatures-column {
        position: static;
        max-height: none;
        overflow-y: visible;
        padding: 15px;
        order: 1; /* Signatures on top on mobile */
        max-width: 100%;
    }

    .signature-box {
        margin-bottom: 15px;
        max-width: 100%;
    }

    .signature-content {
        padding: 15px;
        min-height: 150px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        max-width: 100%;
    }

    /* Scale signature tables on mobile */
    .signature-content > table {
        transform-origin: top left;
        max-width: 100%;
    }

    h2 {
        font-size: 16px;
    }

    button {
        padding: 14px 20px;
    }

    .output-actions {
        flex-direction: column;
    }

    .output-actions button {
        width: 100%;
    }

    /* Form inputs - ensure they fit within container */
    .form-group {
        max-width: 100%;
    }

    .form-group input {
        padding: 12px 10px;
        font-size: 16px; /* Prevents zoom on iOS */
        max-width: 100%;
        width: 100%;
        box-sizing: border-box;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 8px;
    }

    header {
        padding: 15px 10px;
    }

    header h1 {
        font-size: 18px;
    }

    header .instructions {
        font-size: 12px;
    }

    .form-section {
        padding: 15px 12px;
    }

    .signatures-column {
        padding: 12px;
    }

    .form-group label {
        font-size: 12px;
    }

    .signature-content {
        padding: 10px;
        overflow-x: auto;
    }

    /* Make signature scrollable but indicate it */
    .signature-box {
        position: relative;
    }

    .output-actions {
        padding: 12px;
    }

    button {
        padding: 12px 16px;
        font-size: 13px;
    }
}

/* Extra small devices - scale signature for better fit */
@media (max-width: 380px) {
    .container {
        padding: 5px;
    }

    .form-section,
    .signatures-column {
        padding: 10px;
    }

    .signature-content {
        padding: 8px;
    }

    /* Scale signature on very small screens */
    .signature-content > table {
        transform: scale(0.85);
        transform-origin: top left;
    }

    header h1 {
        font-size: 16px;
    }

    header .instructions {
        font-size: 11px;
    }
}

/* Print Styles */
@media print {
    header,
    .form-section,
    .output-actions,
    .example-box {
        display: none;
    }

    .signatures-column {
        position: static;
    }

    .signature-content {
        border: none;
        padding: 0;
    }
}
