/**
 * Event Forms Public Styles
 *
 * @package TES_Publisher_Connect
 * @subpackage Modules/StandSales
 */

/* Form Wrapper */
.tespc-form-wrapper {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* Event Info */
.tespc-form-event-info {
    background: #f0f6fc;
    border-left: 4px solid #0073aa;
    padding: 15px 20px;
    margin-bottom: 25px;
    border-radius: 0 4px 4px 0;
}

.tespc-form-event-info strong {
    display: block;
    font-size: 1.1em;
    color: #1d2327;
    margin-bottom: 5px;
}

.tespc-event-date {
    color: #50575e;
    font-size: 0.9em;
}

/* Form Description */
.tespc-form-description {
    margin-bottom: 25px;
    color: #50575e;
    line-height: 1.6;
}

/* Form */
.tespc-form {
    background: #fff;
}

/* Form Groups */
.tespc-form-group {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e2e4e7;
}

.tespc-form-group:last-child {
    border-bottom: none;
}

/* Form Fields */
.tespc-form-field {
    margin-bottom: 20px;
}

.tespc-form-field label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #1d2327;
}

.tespc-form-field .tespc-required {
    color: #d63638;
    margin-left: 3px;
}

/* Input Styles */
.tespc-form-field input[type="text"],
.tespc-form-field input[type="email"],
.tespc-form-field input[type="tel"],
.tespc-form-field input[type="url"],
.tespc-form-field input[type="number"],
.tespc-form-field input[type="date"],
.tespc-form-field input[type="time"],
.tespc-form-field select,
.tespc-form-field textarea {
    width: 100%;
    max-width: 100%;
    padding: 10px 12px;
    font-size: 14px;
    line-height: 1.5;
    color: #1d2327;
    background-color: #fff;
    border: 1px solid #8c8f94;
    border-radius: 4px;
    box-sizing: border-box;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.tespc-form-field input:focus,
.tespc-form-field select:focus,
.tespc-form-field textarea:focus {
    border-color: #0073aa;
    box-shadow: 0 0 0 1px #0073aa;
    outline: none;
}

.tespc-form-field input:disabled,
.tespc-form-field select:disabled,
.tespc-form-field textarea:disabled {
    background-color: #f0f0f1;
    cursor: not-allowed;
}

.tespc-form-field textarea {
    min-height: 120px;
    resize: vertical;
}

.tespc-form-field select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px 12px;
    padding-right: 35px;
}

/* Checkbox & Radio */
.tespc-form-field.tespc-field-type-checkbox label,
.tespc-form-field.tespc-field-type-radio label {
    display: inline-flex;
    align-items: flex-start;
    font-weight: normal;
    cursor: pointer;
}

.tespc-form-field input[type="checkbox"],
.tespc-form-field input[type="radio"] {
    width: 18px;
    height: 18px;
    margin-right: 10px;
    margin-top: 2px;
    flex-shrink: 0;
}

/* Checkbox Group & Radio Group */
.tespc-checkbox-group,
.tespc-radio-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.tespc-checkbox-group label,
.tespc-radio-group label {
    display: inline-flex;
    align-items: flex-start;
    font-weight: normal;
    cursor: pointer;
}

/* File Upload */
.tespc-form-field input[type="file"] {
    padding: 8px;
    border: 2px dashed #c3c4c7;
    border-radius: 4px;
    width: 100%;
    background: #f6f7f7;
    cursor: pointer;
}

.tespc-form-field input[type="file"]:hover {
    border-color: #0073aa;
    background: #f0f6fc;
}

/* Help Text */
.tespc-help-text {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: #646970;
    line-height: 1.4;
}

/* Field Errors */
.tespc-field-error {
    margin-top: 6px;
    padding: 8px 12px;
    background: #fcf0f1;
    border-left: 4px solid #d63638;
    border-radius: 0 4px 4px 0;
    color: #d63638;
    font-size: 13px;
}

.tespc-form-field.tespc-has-error input,
.tespc-form-field.tespc-has-error select,
.tespc-form-field.tespc-has-error textarea {
    border-color: #d63638;
}

/* Headings */
.tespc-field-heading {
    font-size: 1.25em;
    font-weight: 600;
    color: #1d2327;
    margin: 30px 0 15px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid #0073aa;
}

.tespc-form-group:first-child .tespc-field-heading:first-child {
    margin-top: 0;
}

/* HTML Content */
.tespc-field-html {
    margin: 15px 0;
    line-height: 1.6;
    color: #50575e;
}

/* Divider */
.tespc-field-divider hr {
    border: none;
    border-top: 1px solid #e2e4e7;
    margin: 25px 0;
}

/* Hidden Fields */
.tespc-field-type-hidden {
    display: none;
}

/* Form Messages */
.tespc-form-messages {
    margin-bottom: 20px;
}

.tespc-form-success,
.tespc-form-error {
    padding: 15px 20px;
    border-radius: 4px;
    margin-bottom: 15px;
}

.tespc-form-success {
    background: #edfaef;
    border-left: 4px solid #00a32a;
    color: #1e4620;
}

.tespc-form-error {
    background: #fcf0f1;
    border-left: 4px solid #d63638;
    color: #8a1116;
}

/* Submit Section */
.tespc-form-submit {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e2e4e7;
}

.tespc-form-submit-btn {
    display: inline-block;
    padding: 12px 30px;
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    background-color: #0073aa;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.15s ease-in-out;
}

.tespc-form-submit-btn:hover {
    background-color: #005a87;
}

.tespc-form-submit-btn:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

.tespc-form-submit-btn:disabled {
    background-color: #a7aaad;
    cursor: not-allowed;
}

/* Loading State */
.tespc-form-loading {
    display: inline-flex;
    align-items: center;
    margin-left: 15px;
    color: #50575e;
}

.tespc-form-loading .spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #0073aa;
    border-radius: 50%;
    animation: tespc-spin 1s linear infinite;
    margin-right: 8px;
}

@keyframes tespc-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Success Message */
.tespc-form-success-message {
    padding: 30px;
    text-align: center;
    background: #edfaef;
    border: 1px solid #00a32a;
    border-radius: 4px;
}

.tespc-form-success-message strong {
    color: #1e4620;
}

/* Pre-filled Fields */
.tespc-field-prefilled input,
.tespc-field-prefilled select,
.tespc-field-prefilled textarea {
    background-color: #f7f9fc;
    border-color: #0073aa;
}

.tespc-field-prefilled::after {
    content: "Pre-filled";
    display: inline-block;
    font-size: 11px;
    color: #0073aa;
    background: #f0f6fc;
    padding: 2px 8px;
    border-radius: 3px;
    margin-left: 8px;
    vertical-align: middle;
}

/* =====================================================
   RISK ASSESSMENT FORM STYLES
   ===================================================== */

/* Risk Assessment Form Wrapper */
.tespc-risk-assessment-form {
    max-width: 900px;
}

/* Intro Box */
.tespc-form-intro,
.tespc-intro-box {
    background: linear-gradient(135deg, #f0f6fc 0%, #e8f4fc 100%);
    border: 1px solid #c3daf2;
    border-left: 4px solid #0073aa;
    border-radius: 0 6px 6px 0;
    padding: 20px 25px;
    margin-bottom: 30px;
}

.tespc-form-intro p,
.tespc-intro-box p {
    margin: 0 0 12px 0;
    line-height: 1.7;
    color: #1d2327;
}

.tespc-form-intro p:last-child,
.tespc-intro-box p:last-child {
    margin-bottom: 0;
}

.tespc-form-intro strong,
.tespc-intro-box strong {
    color: #0073aa;
}

/* Collapsible Guidance Section */
.tespc-guidance-section {
    margin-bottom: 25px;
    border: 1px solid #e2e4e7;
    border-radius: 6px;
    overflow: hidden;
    background: #fff;
}

.tespc-guidance-toggle {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 15px 20px;
    background: #f6f7f7;
    border: none;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    color: #1d2327;
    text-align: left;
    transition: background-color 0.2s ease;
}

.tespc-guidance-toggle:hover {
    background: #eef0f1;
}

.tespc-toggle-icon {
    display: inline-block;
    margin-right: 10px;
    transition: transform 0.3s ease;
    font-size: 12px;
    color: #0073aa;
}

.tespc-collapsible.tespc-open .tespc-toggle-icon {
    transform: rotate(90deg);
}

.tespc-guidance-content {
    display: none;
    padding: 20px 25px;
    border-top: 1px solid #e2e4e7;
    background: #fff;
    line-height: 1.7;
}

.tespc-collapsible.tespc-open .tespc-guidance-content {
    display: block;
}

.tespc-guidance-content h4 {
    margin: 0 0 10px 0;
    font-size: 14px;
    font-weight: 600;
    color: #1d2327;
}

.tespc-guidance-content p {
    margin: 0 0 15px 0;
    color: #50575e;
}

.tespc-guidance-content p:last-child {
    margin-bottom: 0;
}

.tespc-guidance-content ul,
.tespc-guidance-content ol {
    margin: 0 0 15px 0;
    padding-left: 25px;
}

.tespc-guidance-content li {
    margin-bottom: 8px;
    color: #50575e;
}

/* Inline Guidance Box (for within form sections) */
.tespc-guidance-box {
    background: #fffbeb;
    border: 1px solid #f0d78c;
    border-left: 4px solid #dba617;
    border-radius: 0 4px 4px 0;
    padding: 15px 20px;
    margin: 15px 0 20px 0;
    font-size: 13px;
    line-height: 1.6;
}

.tespc-guidance-box p {
    margin: 0 0 10px 0;
    color: #614a0a;
}

.tespc-guidance-box p:last-child {
    margin-bottom: 0;
}

.tespc-guidance-box strong {
    color: #4a3908;
}

/* Declaration Box */
.tespc-declaration-box {
    background: #f8f9fa;
    border: 2px solid #1d2327;
    border-radius: 6px;
    padding: 25px;
    margin: 20px 0;
}

.tespc-declaration-box h4 {
    margin: 0 0 15px 0;
    font-size: 16px;
    font-weight: 700;
    color: #1d2327;
    text-transform: uppercase;
}

.tespc-declaration-box p {
    margin: 0 0 15px 0;
    line-height: 1.7;
    color: #1d2327;
}

.tespc-declaration-box p:last-child {
    margin-bottom: 0;
}

/* Risk Assessment Section Headers */
.tespc-risk-assessment-form .tespc-form-heading {
    background: #0073aa;
    color: #fff;
    padding: 12px 20px;
    margin: 30px -20px 20px -20px;
    border-radius: 0;
    font-size: 1.1em;
    font-weight: 600;
    border-bottom: none;
}

.tespc-risk-assessment-form .tespc-form-group:first-child .tespc-form-heading {
    margin-top: -20px;
    border-radius: 4px 4px 0 0;
}

/* Risk Assessment Table-like Layout for Hazard Rows */
.tespc-risk-assessment-form .tespc-form-group[data-group="risk"],
.tespc-risk-assessment-form .tespc-form-group[data-group="fire"],
.tespc-risk-assessment-form .tespc-form-group[data-group="camping"] {
    background: #f9fafb;
    border: 1px solid #e2e4e7;
    border-radius: 6px;
    padding: 20px;
    margin-bottom: 25px;
}

/* Hazard Row Styling */
.tespc-risk-assessment-form .tespc-form-field[data-field*="hazard_"],
.tespc-risk-assessment-form .tespc-form-field[data-field*="fire_hazard_"],
.tespc-risk-assessment-form .tespc-form-field[data-field*="camping_hazard_"] {
    background: #fff;
    border: 1px solid #e2e4e7;
    border-radius: 4px;
    padding: 15px;
    margin-bottom: 15px;
}

/* Required field asterisk */
.tespc-form-label .required {
    color: #d63638;
    font-weight: bold;
    margin-left: 2px;
}

/* Help Text */
.tespc-form-help {
    margin-top: 6px;
    font-size: 12px;
    color: #646970;
    font-style: italic;
}

/* Form File Info */
.tespc-form-file-info {
    margin-top: 6px;
    font-size: 12px;
    color: #646970;
}

/* Radio and Checkbox Groups in Risk Assessment */
.tespc-form-radio-group,
.tespc-form-checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 8px;
}

.tespc-form-radio-item,
.tespc-form-checkbox-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.tespc-form-radio-item input,
.tespc-form-checkbox-item input {
    margin-top: 3px;
    flex-shrink: 0;
}

.tespc-form-radio-item label,
.tespc-form-checkbox-item label {
    font-weight: normal;
    cursor: pointer;
    line-height: 1.5;
}

/* LPG Question Highlight */
.tespc-risk-assessment-form .tespc-form-field[data-field="lpg_use"] {
    background: #fff8e5;
    border: 1px solid #f0d78c;
    border-radius: 4px;
    padding: 15px;
}

/* Declaration Checkbox */
.tespc-risk-assessment-form .tespc-form-field[data-field="declaration"] {
    background: #f0f6fc;
    border: 2px solid #0073aa;
    border-radius: 6px;
    padding: 20px;
    margin-top: 25px;
}

.tespc-risk-assessment-form .tespc-form-field[data-field="declaration"] label {
    font-weight: 600;
    color: #1d2327;
}

/* Standalone Form Page */
.tespc-standalone-form-page {
    max-width: 960px;
    margin: 0 auto;
    padding: 40px 20px;
}

.tespc-standalone-form-page h1 {
    font-size: 1.75em;
    margin-bottom: 10px;
    color: #1d2327;
}

.tespc-standalone-form-page .tespc-form-wrapper {
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    padding: 30px;
}

/* Responsive */
@media (max-width: 600px) {
    .tespc-form-wrapper {
        padding: 15px;
    }

    .tespc-form-field input[type="text"],
    .tespc-form-field input[type="email"],
    .tespc-form-field input[type="tel"],
    .tespc-form-field input[type="url"],
    .tespc-form-field input[type="number"],
    .tespc-form-field input[type="date"],
    .tespc-form-field input[type="time"],
    .tespc-form-field select,
    .tespc-form-field textarea {
        font-size: 16px; /* Prevent zoom on iOS */
    }

    .tespc-form-submit-btn {
        width: 100%;
        text-align: center;
    }

    .tespc-form-loading {
        display: block;
        margin-left: 0;
        margin-top: 10px;
        text-align: center;
    }

    /* Risk Assessment Mobile */
    .tespc-risk-assessment-form .tespc-form-heading {
        margin-left: -15px;
        margin-right: -15px;
        padding: 10px 15px;
    }

    .tespc-form-intro,
    .tespc-intro-box {
        padding: 15px;
    }

    .tespc-guidance-content {
        padding: 15px;
    }

    .tespc-declaration-box {
        padding: 15px;
    }

    .tespc-standalone-form-page {
        padding: 20px 10px;
    }

    .tespc-standalone-form-page .tespc-form-wrapper {
        padding: 15px;
        border-radius: 0;
    }
}

/* Fields hidden by conditional logic */
.tespc-form-field.tespc-field-hidden {
    display: none !important;
}

/* Booking-reference lookup notice (multi-event risk assessment forms) */
.tespc-booking-notice {
    margin-top: 6px;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 13px;
    line-height: 1.4;
    border-left: 3px solid #c3c4c7;
    background: #f6f7f7;
    color: #1d2327;
}

.tespc-booking-notice.tespc-booking-pending {
    border-left-color: #8c8f94;
    color: #50575e;
    font-style: italic;
}

.tespc-booking-notice.tespc-booking-match {
    border-left-color: #46b450;
    background: #ecf7ed;
    color: #1d2327;
}

.tespc-booking-notice.tespc-booking-warning {
    border-left-color: #dba617;
    background: #fcf3d3;
    color: #1d2327;
}

/* Currency / prefixed number inputs */
.tespc-input-group {
    display: flex;
    align-items: stretch;
}

.tespc-input-group .tespc-input-prefix {
    display: flex;
    align-items: center;
    padding: 0 12px;
    font-size: 14px;
    color: #1d2327;
    background-color: #f0f0f1;
    border: 1px solid #8c8f94;
    border-right: none;
    border-radius: 4px 0 0 4px;
    white-space: nowrap;
}

.tespc-form-field .tespc-input-group input.tespc-form-input {
    border-radius: 0 4px 4px 0;
    flex: 1;
    min-width: 0;
}
