/* ORPP Complaints Frontend Styles */

.orpp-complaint-form-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Form Header */
.form-header {
    text-align: center;
    margin-bottom: 30px;
}

.form-header h2 {
    color: #333;
    margin-bottom: 10px;
    font-size: 24px;
    border-bottom: 2px solid #0073aa;
    padding-bottom: 10px;
}

.form-header .form-description {
    font-style: italic;
    color: #666;
    margin-bottom: 20px;
}

/* Progress Bar */
.progress-container {
    margin: 20px 0;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background-color: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #0073aa 0%, #005a87 100%);
    transition: width 0.3s ease;
    border-radius: 4px;
}

.progress-text {
    font-size: 14px;
    color: #666;
    text-align: center;
}

.progress-text .current-step {
    font-weight: bold;
    color: #0073aa;
}

/* Wizard Form Steps */
.orpp-complaint-form.wizard-form .form-step {
    display: none !important;
    opacity: 0;
    transform: translateX(20px);
    transition: all 0.3s ease;
    position: relative;
}

.orpp-complaint-form.wizard-form .form-step.active {
    display: block !important;
    opacity: 1;
    transform: translateX(0);
}

/* Force hide all steps that don't have active class */
.orpp-complaint-form.wizard-form .form-step:not(.active) {
    display: none !important;
    visibility: hidden !important;
}

.form-section {
    margin-bottom: 30px;
    border: 1px solid #e1e1e1;
    border-radius: 8px;
    padding: 25px;
    background: #fafafa;
    min-height: 400px;
}

.form-section legend {
    font-weight: bold;
    font-size: 18px;
    color: #0073aa;
    padding: 0 15px;
    background: #fff;
    border: 1px solid #0073aa;
    border-radius: 4px;
    margin-bottom: 20px;
}

.form-field {
    margin-bottom: 20px;
}

.form-field.required label {
    font-weight: bold;
}

.form-field label {
    display: block;
    margin-bottom: 5px;
    color: #333;
    font-size: 14px;
    line-height: 1.4;
}

.required-asterisk {
    color: #d63638;
    font-weight: bold;
}

.form-control {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1.4;
    background-color: #fff;
    transition: border-color 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.2);
}

.form-control.error {
    border-color: #d63638;
    box-shadow: 0 0 0 2px rgba(214, 54, 56, 0.2);
}

.form-checkbox {
    width: auto;
    margin-right: 8px;
    transform: scale(1.2);
}

.form-checkbox + label {
    display: inline;
    margin-left: 5px;
    cursor: pointer;
}

/* Wizard Navigation */
.wizard-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #e1e1e1;
}

.nav-button {
    background: linear-gradient(135deg, #0073aa 0%, #005a87 100%);
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-button:hover {
    background: linear-gradient(135deg, #005a87 0%, #004066 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 115, 170, 0.3);
}

.nav-button:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.prev-button {
    background: linear-gradient(135deg, #6c757d 0%, #5a6268 100%);
}

.prev-button:hover {
    background: linear-gradient(135deg, #5a6268 0%, #495057 100%);
    box-shadow: 0 4px 12px rgba(108, 117, 125, 0.3);
}

.submit-button {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    padding: 12px 30px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.submit-button:hover {
    background: linear-gradient(135deg, #218838 0%, #1e7e34 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

.submit-button:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Step Indicator */
.step-indicator {
    display: flex;
    gap: 10px;
    align-items: center;
}

.step-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #ddd;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.step-dot.active {
    background: #0073aa;
    transform: scale(1.2);
}

.step-dot.completed {
    background: #28a745;
}

.step-dot:hover {
    transform: scale(1.1);
}

/* Button Icons */
.button-icon {
    font-size: 16px;
    line-height: 1;
}

.loading-spinner {
    display: inline-block;
    margin-left: 15px;
    color: #666;
    font-style: italic;
}

.form-messages {
    margin-top: 20px;
    padding: 15px;
    border-radius: 5px;
    display: none;
}

.form-messages.success {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
    display: block;
}

.form-messages.error {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    display: block;
}

.form-messages.info {
    background-color: #d1ecf1;
    border: 1px solid #bee5eb;
    color: #0c5460;
    display: block;
}

.field-error {
    color: #d63638;
    font-size: 12px;
    margin-top: 5px;
    display: block;
}

/* Helper/description text under an input */
.field-description {
    color: #555;
    font-size: 12px;
    margin: 6px 0 0 0;
    line-height: 1.4;
}

/* Radio group (used for the confidentiality choice) */
.radio-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 6px 0;
}

.radio-group.error {
    background: rgba(214, 54, 56, 0.05);
    border-radius: 4px;
    padding: 8px;
    border: 1px solid #d63638;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
    background: #fff;
}

.radio-option:hover {
    background: #f5f9fc;
    border-color: #0073aa;
}

.radio-option input[type="radio"] {
    margin: 0;
    accent-color: #0073aa;
    transform: scale(1.1);
}

.radio-option input[type="radio"]:focus-visible {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

.radio-option .radio-label {
    color: #333;
    font-size: 14px;
}

/* Live word counter shown beneath textareas with data-min-words */
.word-counter {
    margin-top: 6px;
    font-size: 12px;
    font-weight: 500;
}

.word-counter.under {
    color: #b54708;
}

.word-counter.met {
    color: #1f7a39;
}

/* Static declaration block shown in the final step */
.declaration-text-block {
    background: #f7f9fc;
    border-left: 4px solid #0073aa;
    padding: 14px 16px;
    margin: 18px 0;
    color: #1d2327;
    font-size: 14px;
    line-height: 1.55;
    border-radius: 4px;
}

/* Fields hidden by the conditional-show logic. !important to defeat
   the wizard step's .form-step.active { display: block } cascade. */
.form-field.conditional-field.conditional-hidden {
    display: none !important;
}

/* File input — custom drop-zone affordance.
   The native <input type="file"> is visually hidden but stays focusable. */
.file-dropzone {
    position: relative;
}

.file-dropzone .form-file {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
}

.file-dropzone-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 24px 16px;
    border: 2px dashed #b6c1cb;
    border-radius: 8px;
    background: #fafbfc;
    cursor: pointer;
    text-align: center;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.file-dropzone-inner:hover,
.file-dropzone.is-focused .file-dropzone-inner {
    border-color: #0073aa;
    background: #f0f7fc;
}

.file-dropzone.is-dragover .file-dropzone-inner {
    border-color: #0073aa;
    background: #e8f1f8;
    border-style: solid;
}

.file-dropzone.has-error .file-dropzone-inner {
    border-color: #d63638;
    background: rgba(214, 54, 56, 0.04);
}

.file-dropzone-icon {
    font-size: 28px;
    line-height: 1;
    color: #0073aa;
}

.file-dropzone-primary {
    color: #0073aa;
    font-weight: 600;
    font-size: 14px;
}

.file-dropzone-secondary {
    color: #6b7c8a;
    font-size: 12px;
}

/* Native file input retains focus ring via its label when focused */
.file-dropzone .form-file:focus + .file-dropzone-inner {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

.file-selected {
    margin-top: 8px;
    font-size: 13px;
}

.file-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px;
    background: #e8f1f8;
    color: #0a4f76;
    border-radius: 999px;
    font-size: 13px;
    max-width: 100%;
}

.file-chip-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 360px;
}

.file-chip-size {
    color: #6b7c8a;
    font-size: 12px;
}

/* Signature widget (type-or-draw) */
.signature-widget {
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 10px;
    background: #fff;
}

.signature-widget.error {
    border-color: #d63638;
    background: rgba(214, 54, 56, 0.04);
}

.signature-tabs {
    display: inline-flex;
    gap: 4px;
    margin-bottom: 10px;
    border-bottom: 1px solid #e1e1e1;
    padding-bottom: 4px;
}

.signature-tab {
    background: transparent;
    border: 1px solid transparent;
    padding: 6px 12px;
    border-radius: 4px 4px 0 0;
    cursor: pointer;
    color: #555;
    font-size: 13px;
    font-weight: 600;
}

.signature-tab:hover {
    color: #0073aa;
    background: #f5f9fc;
}

.signature-tab.active {
    color: #0073aa;
    border-color: #ddd #ddd #fff;
    background: #fff;
    margin-bottom: -1px;
}

.signature-tab:focus-visible {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

.signature-panel-type .signature-type-input {
    font-family: 'Brush Script MT', 'Lucida Handwriting', cursive;
    font-size: 22px;
    letter-spacing: 0.5px;
}

.signature-canvas {
    display: block;
    width: 100%;
    max-width: 600px;
    height: 160px;
    border: 1px dashed #b6c1cb;
    border-radius: 4px;
    background: #fff;
    cursor: crosshair;
    touch-action: none;
}

.signature-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
}

.signature-clear {
    background: #f1f3f5;
    color: #1d2327;
    border: 1px solid #c5ccd3;
    padding: 6px 14px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
}

.signature-clear:hover {
    background: #e5e8eb;
}

.signature-hint {
    color: #6b7c8a;
    font-size: 12px;
    font-style: italic;
}

/* Responsive Design */
@media (max-width: 768px) {
    .orpp-complaint-form-container {
        margin: 10px;
        padding: 15px;
    }

    .form-section {
        padding: 20px 15px;
        min-height: 350px;
    }

    .form-header h2 {
        font-size: 20px;
    }

    .form-section legend {
        font-size: 16px;
        padding: 0 10px;
    }

    .wizard-navigation {
        flex-direction: column;
        gap: 15px;
    }

    .nav-button,
    .submit-button {
        width: 100%;
        max-width: 300px;
    }

    .step-indicator {
        order: -1;
        margin-bottom: 10px;
    }
}

@media (max-width: 480px) {
    .orpp-complaint-form-container {
        margin: 5px;
        padding: 10px;
    }

    .form-section {
        padding: 15px 10px;
        min-height: 300px;
    }

    .form-header h2 {
        font-size: 18px;
    }

    .form-section legend {
        font-size: 14px;
    }

    .nav-button,
    .submit-button {
        padding: 15px;
        font-size: 16px;
    }

    .step-dot {
        width: 10px;
        height: 10px;
    }

    .progress-bar {
        height: 6px;
    }
}

/* Print Styles */
@media print {
    .orpp-complaint-form-container {
        box-shadow: none;
        border: none;
    }
    
    .form-actions {
        display: none;
    }
    
    .form-messages {
        display: none;
    }
}

/* Accessibility Improvements */
.form-control:focus,
.form-checkbox:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

.submit-button:focus {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .form-section {
        border: 2px solid #000;
        background: #fff;
    }
    
    .form-control {
        border: 2px solid #000;
    }
    
    .submit-button {
        border: 2px solid #000;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .form-control,
    .submit-button {
        transition: none;
    }
}

/* =====================================================================
   ORPP organisation header (above the form heading)
   ===================================================================== */

.orpp-org-header {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 18px 20px;
    margin-bottom: 18px;
    border-bottom: 2px solid #2271b1;
    background: linear-gradient(to bottom, #ffffff, #f7f9fc);
}
.orpp-org-logo {
    flex: 0 0 auto;
    height: 84px;
    width: auto;
    max-width: 120px;
    object-fit: contain;
}
.orpp-org-meta {
    flex: 1 1 auto;
    min-width: 0;
}
.orpp-org-name {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.3px;
    color: #1d2327;
    line-height: 1.25;
    text-transform: uppercase;
    margin-bottom: 4px;
}
.orpp-org-address {
    font-size: 13px;
    color: #50575e;
    line-height: 1.5;
}
@media (max-width: 600px) {
    .orpp-org-header {
        flex-direction: column;
        text-align: center;
        gap: 10px;
        padding: 14px 12px;
    }
    .orpp-org-logo { height: 64px; max-width: 100px; }
    .orpp-org-name { font-size: 14px; }
    .orpp-org-address { font-size: 12px; }
}
