/**
 * Waiver Form Styles
 * Mobile-first responsive design
 */

/* Hide theme's back-to-top button on waiver form pages */
body:has(.waiver-form-container) .go-top,
body:has(.waiver-form-container) .back-to-top {
    display: none !important;
}

/* Container */
.waiver-form-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Header */
.waiver-form-header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e5e5e5;
}

.waiver-form-header h2 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 28px;
}

.waiver-intro {
    color: #666;
    font-size: 16px;
    line-height: 1.5;
}

/* Sections */
.waiver-section {
    margin-bottom: 30px;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 6px;
    border-left: 4px solid #0073aa;
}

.waiver-section h3 {
    margin: 0 0 20px 0;
    color: #333;
    font-size: 20px;
}

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

.waiver-field label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.waiver-input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    transition: border-color 0.3s;
    box-sizing: border-box;
}

.waiver-input:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1);
}

.waiver-input-readonly {
    background-color: #f5f5f5;
    color: #666;
    cursor: not-allowed;
}

/* Waiver Text Container */
.waiver-terms {
    background: #fff;
    border-left-color: #d63638;
}

.waiver-text-container {
    max-height: 400px;
    overflow-y: auto;
    padding: 20px;
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1.6;
}

.waiver-text-container h2,
.waiver-text-container h3 {
    margin-top: 20px;
    margin-bottom: 10px;
    color: #333;
}

.waiver-text-container h2 {
    font-size: 18px;
}

.waiver-text-container h3 {
    font-size: 16px;
}

.waiver-text-container ul {
    margin: 10px 0;
    padding-left: 30px;
}

.waiver-text-container li {
    margin-bottom: 8px;
}

.waiver-text-container p {
    margin: 10px 0;
}

.waiver-version {
    margin-top: 15px;
    font-size: 12px;
    color: #666;
    font-style: italic;
}

/* Consent Checkbox */
.waiver-consent {
    border-left-color: #00a32a;
}

.waiver-checkbox-label {
    display: flex;
    align-items: flex-start;
    cursor: pointer;
    font-size: 16px;
    line-height: 1.5;
}

.waiver-checkbox {
    width: 20px;
    height: 20px;
    margin-right: 16px;
    margin-top: 2px;
    cursor: pointer;
    flex-shrink: 0;
}

/* Ensure checkbox spacing - higher specificity */
.waiver-consent .waiver-checkbox-label .waiver-checkbox,
input.waiver-checkbox[type="checkbox"] {
    margin-right: 16px !important;
}

/* Signature Section */
.waiver-signature-section {
    border-left-color: #7e57c2;
}

.waiver-signature-instructions {
    margin-bottom: 15px;
    font-size: 14px;
    color: #666;
    line-height: 1.5;
}

.waiver-mobile-hint {
    display: block;
    margin-top: 8px;
    font-weight: 600;
    color: #d63638;
}

.waiver-signature-wrapper {
    position: relative;
    width: 100%;
    background: #fff;
    border: 2px solid #0073aa;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 15px;
}

.signature-pad {
    display: block;
    width: 100%;
    height: 250px;
    cursor: crosshair;
    touch-action: none;
}

.signature-placeholder {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #ccc;
    font-size: 24px;
    font-style: italic;
    pointer-events: none;
    user-select: none;
}

.waiver-signature-controls {
    text-align: right;
}

/* Buttons */
.waiver-button {
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
}

.waiver-button-primary {
    background: #0073aa;
    color: #fff;
    width: 100%;
    font-size: 18px;
    padding: 16px 24px;
}

.waiver-button-primary:hover {
    background: #005a87;
}

.waiver-button-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.waiver-button-secondary {
    background: #f5f5f5;
    color: #333;
    border: 1px solid #ddd;
}

.waiver-button-secondary:hover {
    background: #e5e5e5;
}

/* Messages */
.waiver-error,
.waiver-success {
    padding: 15px 20px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.waiver-error {
    background: #f8d7da;
    border: 1px solid #f5c2c7;
    color: #842029;
}

.waiver-success {
    background: #d1e7dd;
    border: 1px solid #badbcc;
    color: #0f5132;
}

.waiver-error p,
.waiver-success p {
    margin: 0;
    font-size: 15px;
}

.error-message {
    font-weight: 600;
}

/* Submit Section */
.waiver-submit-section {
    background: #fff;
    border-left-color: #00a32a;
}

.waiver-legal-note {
    margin-top: 15px;
    font-size: 12px;
    color: #666;
    text-align: center;
    line-height: 1.5;
}

/* Already Signed */
.waiver-already-signed {
    text-align: center;
    padding: 40px 20px;
}

.waiver-already-signed h3 {
    color: #00a32a;
    margin-bottom: 20px;
}

.waiver-already-signed p {
    margin: 10px 0;
    font-size: 16px;
}

.waiver-already-signed .button {
    margin-top: 20px;
    padding: 12px 24px;
    background: #0073aa;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    display: inline-block;
}

.waiver-already-signed .button:hover {
    background: #005a87;
}

/* Warning Notice */
.waiver-warning {
    margin: 20px 0;
    padding: 15px 20px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 4px;
}

/* Fix waiver warning in MemberPress account nav area */
.mepr-account-nav .waiver-warning,
.mepr_account_nav .waiver-warning {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    width: 100%;
    margin: 10px 0 0 0;
    box-sizing: border-box;
    z-index: 10;
}

/* Ensure parent nav has positioning context */
.mepr-account-nav,
.mepr_account_nav {
    position: relative;
}

/* Add spacing below nav to accommodate the warning */
.mepr-account-container:has(.waiver-warning) .mepr-account-nav,
.mepr-account-container:has(.waiver-warning) .mepr_account_nav {
    margin-bottom: 70px;
}

.waiver-warning a {
    color: #0073aa;
    text-decoration: underline;
}

.waiver-warning a:hover {
    color: #005a87;
}

/* Responsive Design */

/* Large Tablets (iPad Pro, etc.) */
@media (max-width: 1024px) {
    .waiver-form-container {
        max-width: 700px;
        padding: 24px;
    }

    .waiver-section {
        padding: 20px;
    }

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

    .waiver-text-container {
        font-size: 16px;
        line-height: 1.7;
        padding: 24px;
    }

    .waiver-text-container h2 {
        font-size: 20px;
    }

    .waiver-text-container h3 {
        font-size: 18px;
    }

    .waiver-checkbox-label {
        font-size: 17px;
    }

    .waiver-checkbox {
        width: 22px;
        height: 22px;
    }
}

/* Smaller Tablets */
@media (max-width: 768px) {
    .waiver-form-container {
        padding: 15px;
    }

    .waiver-section {
        padding: 15px;
    }

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

    .signature-pad {
        height: 200px;
    }

    .waiver-text-container {
        max-height: none;
        overflow-y: visible;
        font-size: 15px;
    }
}

/* Mobile Phones */
@media (max-width: 480px) {
    .waiver-form-container {
        padding: 10px;
        border-radius: 0;
        box-shadow: none;
    }

    .waiver-section {
        padding: 12px;
        margin-bottom: 16px;
    }

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

    .waiver-intro {
        font-size: 14px;
    }

    .waiver-section h3 {
        font-size: 18px;
        margin-bottom: 12px;
    }

    .signature-pad {
        height: 180px;
    }

    .signature-placeholder {
        font-size: 20px;
    }

    .waiver-button-primary {
        font-size: 16px;
        padding: 14px 20px;
    }

    /* MOBILE UX FIX: Remove fixed height - let waiver text flow naturally */
    .waiver-text-container {
        max-height: none;
        overflow-y: visible;
        font-size: 14px;
        padding: 16px;
        border: none;
        background: transparent;
    }

    /* Remove the scroll box styling on mobile */
    .waiver-terms {
        background: #fff;
        padding: 12px;
    }

    /* Larger checkbox tap target for mobile */
    .waiver-checkbox {
        width: 24px;
        height: 24px;
    }

    .waiver-checkbox-label {
        font-size: 15px;
        padding: 8px 0;
        min-height: 44px;
        align-items: center;
    }

    /* Tighter spacing for member info fields on mobile */
    .waiver-field {
        margin-bottom: 14px;
    }

    .waiver-field label {
        margin-bottom: 6px;
    }

    .waiver-input {
        padding: 10px 12px;
    }
}

/* Landscape on Mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .signature-pad {
        height: 150px;
    }
}

/* Print Styles */
@media print {
    .waiver-signature-controls,
    .waiver-button,
    .waiver-submit-section {
        display: none;
    }

    .waiver-form-container {
        box-shadow: none;
    }
}
