/* =============================================================
   Axe Arena – Waiver Form Styles
   public/css/waiver.css
   ============================================================= */

/* ── Wrap ─────────────────────────────────────────────────────── */
.axearena-waiver-wrap {
    max-width: 860px;
    margin: 40px auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: #1a1a1a;
    line-height: 1.6;
}

/* ── Header ───────────────────────────────────────────────────── */
.aw-header {
    text-align: center;
    padding: 40px 30px 24px;
    background: #ffffff;
    color: #111;
    border-radius: 12px 12px 0 0;
    border-bottom: 3px solid var(--aw-primary, #FF6B35);
}
.aw-title {
    font-size: 2rem;
    font-weight: 800;
    margin: 0 0 10px;
    color: #111111;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.aw-subtitle {
    font-size: .95rem;
    margin: 0 0 8px;
    color: #444;
}
.aw-notice {
    background: rgba(255,107,53,.08);
    border: 1px solid var(--aw-primary, #FF6B35);
    border-radius: 6px;
    padding: 10px 16px;
    font-size: .9rem;
    color: var(--aw-primary, #FF6B35);
    display: inline-block;
    margin-top: 8px;
}

/* ── Legal Text ───────────────────────────────────────────────── */
.aw-legal {
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-top: none;
    padding: 28px 32px;
    font-size: .9rem;
    color: #333;
    max-height: 340px;
    overflow-y: auto;
    scroll-behavior: smooth;
}
.aw-legal h3 {
    font-size: 1rem;
    font-weight: 700;
    margin: 18px 0 6px;
    color: var(--aw-primary, #FF6B35);
}
.aw-legal p {
    margin: 0 0 12px;
}

/* ── Form ─────────────────────────────────────────────────────── */
.aw-form {
    background: #fff;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 12px 12px;
    padding: 0 0 30px;
}

.aw-section {
    padding: 28px 32px 0;
    border-top: 1px solid #eee;
    margin-top: 0;
}
.aw-section:first-child,
.aw-section + .aw-section {
    border-top: 1px solid #eee;
}
.aw-section-title {
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0 0 18px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--aw-primary, #FF6B35);
    color: #111;
}

.aw-row {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}
.aw-field {
    flex: 1;
    min-width: 220px;
    margin-bottom: 18px;
}
.aw-field label {
    display: block;
    font-weight: 600;
    font-size: .88rem;
    margin-bottom: 6px;
    color: #444;
}
.aw-field input[type="text"],
.aw-field input[type="email"],
.aw-field input[type="tel"],
.aw-field input[type="date"] {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: .95rem;
    box-sizing: border-box;
    transition: border-color .2s;
}
.aw-field input:focus {
    outline: none;
    border-color: var(--aw-primary, #FF6B35);
    box-shadow: 0 0 0 3px rgba(255,107,53,.12);
}
.aw-field input.aw-error {
    border-color: #e74c3c;
}

.aw-req { color: #e74c3c; }
.aw-optional { color: #999; font-weight: 400; font-size: .82rem; }
.aw-info {
    background: #fff8f4;
    border-left: 3px solid var(--aw-primary, #FF6B35);
    padding: 10px 14px;
    border-radius: 0 6px 6px 0;
    font-size: .88rem;
    margin-bottom: 16px;
}

/* ── Checkbox ─────────────────────────────────────────────────── */
.aw-checkbox-field {
    display: flex;
    align-items: center;
}
.aw-checkbox-field label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    margin: 0;
    font-weight: 600;
    color: #333;
}
.aw-checkbox-field input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--aw-primary, #FF6B35);
    flex-shrink: 0;
}

/* ── Signature ────────────────────────────────────────────────── */
.aw-sig-instruction {
    font-size: .88rem;
    color: #666;
    margin: 0 0 10px;
}
.aw-sig-container {
    border: 2px dashed #ccc;
    border-radius: 8px;
    background: #fafafa;
    cursor: crosshair;
    display: inline-block;
    width: 100%;
    max-width: 620px;
    overflow: hidden;
}
.aw-sig-canvas {
    display: block;
    width: 100%;
    height: 150px;
    touch-action: none;
}
.aw-clear-sig {
    margin-top: 8px;
    background: none;
    border: 1px solid #ccc;
    padding: 6px 16px;
    border-radius: 6px;
    font-size: .82rem;
    cursor: pointer;
    color: #666;
    transition: all .2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.aw-clear-sig:hover {
    border-color: var(--aw-primary, #FF6B35);
    color: var(--aw-primary, #FF6B35);
    background: rgba(255,107,53,.05);
}
.aw-sig-container.aw-sig-signed {
    border-color: #27ae60;
    border-style: solid;
}

/* ── Submit ───────────────────────────────────────────────────── */
.aw-submit-section {
    text-align: center;
    padding-top: 28px;
    padding-bottom: 20px;
}
.aw-date-note {
    font-size: .9rem;
    color: #555;
    margin-bottom: 18px;
}
.aw-btn-submit {
    background: var(--aw-primary, #FF6B35);
    color: var(--aw-primary-text, #fff);
    border: none;
    padding: 16px 48px;
    font-size: 1.05rem;
    font-weight: 700;
    border-radius: 8px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: background .2s, transform .1s;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}
.aw-btn-submit:hover { opacity: .88; }
.aw-btn-submit:active { transform: scale(.98); }
.aw-btn-submit:disabled { opacity: .6; cursor: not-allowed; }
.aw-spinner {
    width: 18px;
    height: 18px;
    border: 3px solid rgba(255,255,255,.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: aw-spin .7s linear infinite;
}
@keyframes aw-spin { to { transform: rotate(360deg); } }

/* ── Messages ─────────────────────────────────────────────────── */
.aw-message {
    margin: 20px 32px;
    padding: 14px 18px;
    border-radius: 6px;
    font-weight: 600;
}
.aw-message.aw-msg-error {
    background: #fdf0f0;
    border: 1px solid #e74c3c;
    color: #c0392b;
}
.aw-message.aw-msg-success {
    background: #f0fdf4;
    border: 1px solid #27ae60;
    color: #1e7e34;
}

/* ── Hidden / Toggle ──────────────────────────────────────────── */
.aw-hidden { display: none !important; }

/* ── Success State ────────────────────────────────────────────── */
.aw-success {
    text-align: center;
    padding: 60px 30px;
    background: #fff;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 12px 12px;
}
.aw-success-icon {
    width: 80px;
    height: 80px;
    background: var(--aw-primary, #FF6B35);
    color: #fff;
    font-size: 2.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
}
.aw-success h2 {
    font-size: 1.6rem;
    font-weight: 800;
    color: #111;
    margin: 0 0 12px;
}
.aw-success p { color: #444; margin-bottom: 10px; }
.aw-success-small { font-size: .85rem; color: #888; }

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 600px) {
    .aw-header { padding: 28px 18px 16px; }
    .aw-legal,
    .aw-section { padding-left: 18px; padding-right: 18px; }
    .aw-row { flex-direction: column; gap: 0; }
    .aw-title { font-size: 1.5rem; }
}

/* =============================================================
   RESPONSIVE FIXES — fully proportional at every viewport
   ============================================================= */

/* ── Outer wrap: safe padding on all sides ─────────────────── */
.axearena-waiver-wrap {
    width: 100%;
    max-width: 860px;
    box-sizing: border-box;
    padding-left: 16px;
    padding-right: 16px;
    margin-left: auto;
    margin-right: auto;
    overflow-x: hidden;
}

/* ── Header: never clip on small screens ──────────────────── */
.aw-header {
    box-sizing: border-box;
    width: 100%;
}
.aw-title {
    word-break: break-word;
    hyphens: auto;
}
.aw-notice {
    max-width: 100%;
    box-sizing: border-box;
    word-break: break-word;
}

/* ── Legal block: legible on all sizes ────────────────────── */
.aw-legal {
    box-sizing: border-box;
    width: 100%;
    overflow-x: hidden;
    overflow-y: auto;
}

/* ── Form: contained ──────────────────────────────────────── */
.aw-form {
    box-sizing: border-box;
    width: 100%;
    overflow-x: hidden;
}

/* ── Inputs: iOS zoom prevention ─────────────────────────── */
@media (max-width: 768px) {
    .aw-field input[type="text"],
    .aw-field input[type="email"],
    .aw-field input[type="tel"],
    .aw-field input[type="date"] {
        font-size: 16px !important;
    }
}

/* ── Section padding: proportional at every size ─────────── */
.aw-section {
    box-sizing: border-box;
    width: 100%;
}

/* ── Signature canvas: always fills its container ─────────── */
.aw-sig-container {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}
.aw-sig-canvas {
    width: 100% !important;
    height: clamp(120px, 22vw, 150px);
    display: block;
    box-sizing: border-box;
}

/* ── Submit button: full-width on small phones ────────────── */
@media (max-width: 480px) {
    .aw-btn-submit {
        width: 100%;
        justify-content: center;
        padding: 14px 24px;
        font-size: .95rem;
    }
    .aw-submit-section {
        padding-left: 0;
        padding-right: 0;
    }
}

/* ── Row fields: min-width prevents cramping ─────────────── */
.aw-field {
    min-width: min(220px, 100%);
    box-sizing: border-box;
}

/* ── Tablet (≤ 768px) ─────────────────────────────────────── */
@media (max-width: 768px) {
    .axearena-waiver-wrap {
        margin-top: 24px;
        margin-bottom: 24px;
    }
    .aw-header {
        padding: 32px 20px 18px;
    }
    .aw-legal {
        padding: 22px 20px;
        max-height: 280px;
    }
    .aw-section {
        padding: 22px 20px 0;
    }
    .aw-title {
        font-size: 1.65rem;
    }
    .aw-message {
        margin: 16px 20px;
    }
    .aw-success {
        padding: 40px 20px;
    }
}

/* ── Phone (≤ 480px) ─────────────────────────────────────── */
@media (max-width: 480px) {
    .axearena-waiver-wrap {
        margin-top: 12px;
        padding-left: 8px;
        padding-right: 8px;
    }
    .aw-header {
        padding: 22px 14px 14px;
        border-radius: 8px 8px 0 0;
    }
    .aw-title {
        font-size: 1.3rem;
        letter-spacing: 0;
    }
    .aw-subtitle {
        font-size: .85rem;
    }
    .aw-notice {
        font-size: .82rem;
        padding: 8px 12px;
        display: block;
        text-align: left;
    }
    .aw-legal {
        padding: 16px 14px;
        font-size: .84rem;
        max-height: 220px;
    }
    .aw-legal h3 {
        font-size: .9rem;
    }
    .aw-section {
        padding: 18px 14px 0;
    }
    .aw-section-title {
        font-size: 1rem;
    }
    .aw-row {
        gap: 0;
    }
    .aw-field {
        min-width: 100%;
        margin-bottom: 14px;
    }
    .aw-info {
        font-size: .82rem;
    }
    .aw-message {
        margin: 12px 14px;
        font-size: .88rem;
    }
    .aw-success {
        padding: 32px 14px;
        border-radius: 0 0 8px 8px;
    }
    .aw-success h2 {
        font-size: 1.3rem;
    }
    .aw-success-icon {
        width: 60px;
        height: 60px;
        font-size: 2rem;
        margin-bottom: 16px;
    }
}

/* ── Landscape phones ────────────────────────────────────── */
@media (max-width: 900px) and (max-height: 500px) and (orientation: landscape) {
    .axearena-waiver-wrap {
        margin-top: 8px;
    }
    .aw-header {
        padding: 16px 20px 12px;
    }
    .aw-title {
        font-size: 1.3rem;
    }
    .aw-legal {
        max-height: 160px;
        padding: 14px 20px;
    }
    .aw-section {
        padding: 14px 20px 0;
    }
    .aw-row {
        flex-direction: row;
    }
    .aw-sig-canvas {
        height: 100px;
    }
}

/* ── Touch devices: finger-friendly tap targets ──────────── */
@media (hover: none) and (pointer: coarse) {
    .aw-field input[type="text"],
    .aw-field input[type="email"],
    .aw-field input[type="tel"],
    .aw-field input[type="date"] {
        min-height: 44px;
        padding: 12px 14px;
    }
    .aw-checkbox-field input[type="checkbox"] {
        width: 22px;
        height: 22px;
    }
    .aw-clear-sig {
        min-height: 40px;
        padding: 8px 18px;
    }
    .aw-btn-submit {
        min-height: 52px;
    }
}

/* ── iOS safe area ───────────────────────────────────────── */
@supports (-webkit-touch-callout: none) {
    .axearena-waiver-wrap {
        padding-left:  max(16px, env(safe-area-inset-left));
        padding-right: max(16px, env(safe-area-inset-right));
        padding-bottom: max(20px, env(safe-area-inset-bottom));
    }
}
