* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #1e40af 0%, #7c3aed 100%);
    padding: 20px;
    min-height: 100vh;
}

.form-container {
    max-width: 950px;
    margin: 0 auto;
    background: white;
    border: 8px solid #1e40af;
    border-radius: 10px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    animation: slideIn 0.6s ease;
    overflow: hidden;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(30px); }
    to   { opacity: 1; transform: translateY(0); }
}

.required {
    color: #dc2626;
    font-weight: bold;
    margin-left: 3px;
}

/* ==================== FORM HEADER ==================== */
.form-header {
    background: linear-gradient(to bottom, white 0%, #f0f0f0 100%);
    padding: 25px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 4px solid #1e40af;
    gap: 16px;
    flex-wrap: wrap;
}

.logo-left, .logo-right {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.form-title {
    flex: 1;
    min-width: 0;
    text-align: center;
    padding: 0 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
}

.form-title h1 {
    color: #dc2626;
    font-size: 17px;
    font-weight: 800;
    line-height: 1.3;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    word-break: break-word;
}

.form-title h2 {
    color: #1e40af;
    font-size: 15px;
    font-weight: 700;
    text-transform: uppercase;
}

.form-title h3 {
    color: #1e40af;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
}

.form-title .presents-tag {
    color: #f59e0b;
    font-size: 13px;
    font-style: italic;
    font-weight: 500;
}

.form-title h4 {
    color: #0f172a;
    font-size: 14px;
    font-weight: bold;
    text-transform: uppercase;
}

/* ==================== FORM BODY ==================== */
.registration-form {
    padding: 30px;
    width: 100%;
    box-sizing: border-box;
}

.form-row {
    margin-bottom: 18px;
    display: flex;
    gap: 20px;
    width: 100%;
    box-sizing: border-box;
    align-items: center;
}

/* First row: name + photo side by side */
.form-row.first-row {
    align-items: flex-start;
}

.form-row.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.form-group {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
    box-sizing: border-box;
}

.form-group.full-width {
    width: 100%;
    flex: 1 1 100%;
}

.form-group.full-width-with-photo {
    flex: 1;
    min-width: 0;
}

.form-group label {
    font-weight: bold;
    color: #0f172a;
    margin-right: 12px;
    min-width: 140px;
    font-size: 14px;
    flex-shrink: 0;
}

.form-group input,
.form-group textarea {
    flex: 1;
    min-width: 0;
    width: 100%;
    padding: 10px;
    border: none;
    border-bottom: 2px solid #1e40af;
    background: transparent;
    font-size: 14px;
    transition: border-color 0.3s ease;
    font-family: inherit;
    box-sizing: border-box;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-bottom-color: #f59e0b;
}

/* ==================== PHOTO UPLOAD ==================== */
/* Label acts as the clickable trigger — no JS click() needed */
.photo-upload {
    flex: 0 0 160px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.photo-upload-label {
    display: block;
    font-weight: bold;
    text-align: center;
    margin-bottom: 8px;
    font-size: 13px;
    color: #0f172a;
}

/* The label IS the photo box — clicking it opens file dialog natively */
.photo-box {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 140px;
    height: 170px;
    border: 3px solid #1e40af;
    cursor: pointer;
    background: #f9f9f9;
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    transition: all 0.3s ease;
    flex-direction: column;
}

.photo-box:hover {
    background: #e2e8f0;
    border-color: #f59e0b;
}

/* Hide the actual file input but keep it accessible */
.photo-box input[type="file"] {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.photo-placeholder {
    font-size: 12px;
    color: #64748b;
    text-align: center;
    padding: 10px;
    pointer-events: none;
}

#photoPreview {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
}

/* ==================== PLAYER TYPE ==================== */
.player-type-section {
    background: rgba(226, 232, 240, 0.4);
    padding: 20px;
    margin: 20px 0;
    border: 3px solid #1e40af;
    border-radius: 10px;
    width: 100%;
    box-sizing: border-box;
}

.player-type-section h3 {
    color: #1e40af;
    font-weight: bold;
    margin-bottom: 16px;
    font-size: 16px;
    text-align: center;
}

.selection-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.selection-group h4 {
    font-weight: bold;
    margin-bottom: 10px;
    font-size: 14px;
    color: #0f172a;
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: bold;
    font-size: 14px;
    color: #1e293b;
    transition: color 0.2s;
    user-select: none;
}

.checkbox-label:hover { color: #f59e0b; }

.checkbox-label input[type="radio"] { display: none; }

.checkbox-custom {
    width: 20px;
    height: 20px;
    border: 2px solid #1e40af;
    margin-right: 10px;
    display: inline-block;
    position: relative;
    border-radius: 3px;
    flex-shrink: 0;
    transition: all 0.2s;
}

.checkbox-label input[type="radio"]:checked + .checkbox-custom {
    background: #1e40af;
}

.checkbox-label input[type="radio"]:checked + .checkbox-custom::after {
    content: '✓';
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 13px;
    font-weight: bold;
}

/* ==================== JERSEY SIZE ==================== */
.jersey-size-section {
    margin: 20px 0;
    width: 100%;
    box-sizing: border-box;
}

.jersey-size-section h4 {
    font-weight: bold;
    margin-bottom: 14px;
    font-size: 15px;
    color: #0f172a;
}

.size-options {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 12px;
}

.size-label { cursor: pointer; }
.size-label input[type="radio"] { display: none; }

.size-box {
    display: block;
    width: 100%;
    padding: 12px 6px;
    border: 2px solid #1e40af;
    text-align: center;
    font-weight: bold;
    background: white;
    transition: all 0.2s;
    border-radius: 8px;
    font-size: 15px;
}

.size-label input[type="radio"]:checked + .size-box {
    background: #1e40af;
    color: white;
    transform: scale(1.05);
}

.size-label:hover .size-box {
    background: #e2e8f0;
    border-color: #f59e0b;
}

/* ==================== ENTRY FEE ==================== */
.entry-fee-box {
    background: linear-gradient(135deg, #1e40af 0%, #0f172a 100%);
    color: white;
    padding: 22px;
    text-align: center;
    border-radius: 10px;
    margin: 20px 0;
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
    width: 100%;
    box-sizing: border-box;
}

.entry-fee-box h3 { font-size: 18px; margin-bottom: 8px; letter-spacing: 1px; }
.fee-amount { font-size: 26px; font-weight: bold; color: #f59e0b; }

/* ==================== SIGNATURE ==================== */
.signature-section {
    margin: 20px 0;
    padding: 20px;
    background: rgba(226, 232, 240, 0.4);
    border: 3px solid #1e40af;
    border-radius: 10px;
    width: 100%;
    box-sizing: border-box;
}

.signature-section h4 {
    font-weight: bold;
    margin-bottom: 6px;
    font-size: 15px;
    color: #0f172a;
}

.signature-instruction {
    font-size: 12px;
    color: #64748b;
    margin-bottom: 12px;
    font-style: italic;
}

.signature-container {
    background: white;
    border: 2px solid #1e40af;
    border-radius: 8px;
    padding: 8px;
    width: 100%;
    box-sizing: border-box;
}

/* FIX: explicit width:100% + height, touch-action:none to prevent scroll conflict */
#signatureCanvas {
    display: block;
    width: 100%;
    height: 150px;
    border: 2px dashed #cbd5e1;
    border-radius: 5px;
    cursor: crosshair;
    touch-action: none;   /* prevents page scroll while drawing on mobile */
    background: #fafafa;
    box-sizing: border-box;
}

.signature-actions {
    margin-top: 8px;
    text-align: center;
}

.clear-signature-btn {
    padding: 8px 20px;
    background: #dc2626;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.clear-signature-btn:hover {
    background: #b91c1c;
    transform: translateY(-2px);
}

/* ==================== FORM FOOTER ==================== */
.form-footer {
    background: rgba(226, 232, 240, 0.4);
    padding: 20px;
    margin-top: 18px;
    border: 3px solid #1e40af;
    border-radius: 10px;
    width: 100%;
    box-sizing: border-box;
}

.footer-points { list-style: none; margin-bottom: 14px; }
.footer-points li { margin-bottom: 7px; font-size: 13px; line-height: 1.6; color: #1e293b; }

.contact-details { margin: 14px 0; font-size: 13px; }
.contact-details p { margin-bottom: 5px; color: #1e293b; }
.contact-details strong { color: #1e40af; }

.form-bottom { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; flex-wrap: wrap; gap: 10px; }
.contact-info p { font-size: 13px; color: #1e293b; }
.contact-info strong { color: #1e40af; }

/* ==================== FORM ACTIONS ==================== */
.form-actions { margin-top: 24px; display: flex; justify-content: center; }

.submit-btn {
    padding: 16px 44px;
    background: linear-gradient(135deg, #f59e0b 0%, #dc2626 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 8px 20px rgba(245,158,11,0.3);
    display: flex;
    align-items: center;
    gap: 10px;
}

.submit-btn:hover { background: linear-gradient(135deg, #dc2626 0%, #f59e0b 100%); transform: translateY(-3px); }
.btn-icon { font-size: 20px; }

/* ==================== SUCCESS MODAL ==================== */
.success-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0; top: 0;
    width: 100%; height: 100%;
    background-color: rgba(0,0,0,0.88);
    overflow-y: auto;
}

.success-modal-content {
    background: white;
    margin: 5% auto;
    padding: 36px;
    width: 90%;
    max-width: 580px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 25px 50px rgba(0,0,0,0.5);
    box-sizing: border-box;
}

.success-icon { font-size: 70px; margin-bottom: 14px; }
.success-modal-content h2 { color: #10b981; font-size: 26px; margin-bottom: 10px; }
.success-modal-content p  { color: #64748b; font-size: 14px; margin-bottom: 18px; line-height: 1.6; }

.registration-id {
    background: #f8fafc;
    padding: 12px;
    border-radius: 10px;
    margin: 14px 0;
    border: 2px solid #1e40af;
    word-break: break-all;
}
.registration-id strong { color: #1e40af; font-size: 14px; }
.registration-id span   { color: #dc2626; font-size: 16px; font-weight: bold; font-family: monospace; }

.payment-success-badge {
    display: none;
    background: #d1fae5;
    border: 1px solid #10b981;
    border-radius: 8px;
    padding: 10px 16px;
    margin: 10px auto;
    color: #065f46;
    font-weight: 600;
    font-size: 14px;
    text-align: center;
}

.success-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin: 20px 0;
    flex-wrap: wrap;
}

.pay-now-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #3399cc 0%, #0066aa 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 12px 22px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0,102,170,0.4);
    transition: transform 0.15s;
}
.pay-now-btn:hover { transform: translateY(-2px); }

.download-btn {
    padding: 12px 22px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(16,185,129,0.3);
}
.download-btn:hover { transform: translateY(-2px); }

.close-modal-btn {
    padding: 12px 22px;
    background: #64748b;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
}
.close-modal-btn:hover { background: #475569; transform: translateY(-2px); }

.next-steps {
    text-align: left;
    background: #f8fafc;
    padding: 18px;
    border-radius: 10px;
    margin-top: 18px;
    border-left: 4px solid #1e40af;
}
.next-steps h3 { color: #1e40af; font-size: 15px; margin-bottom: 10px; }
.next-steps ul { list-style: none; padding: 0; }
.next-steps li { color: #475569; padding: 5px 0; font-size: 13px; line-height: 1.6; }

/* ═══════════════════════════════════════════
   RESPONSIVE — TABLET ≤ 768px
═══════════════════════════════════════════ */
@media (max-width: 768px) {
    body { padding: 10px; }

    .form-container { border-width: 4px; }

    .form-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 16px 12px;
    }

    .logo-left img  { width: 80px !important; height: 80px !important; }
    .logo-right img { width: 65px !important; height: 65px !important; }

    .form-title h1 { font-size: 13px; }
    .form-title h2 { font-size: 12px; }
    .form-title h3, .form-title h4 { font-size: 11px; }

    .registration-form { padding: 18px 14px; }

    /* Stack first row: name on top, photo below & centered */
    .form-row.first-row {
        flex-direction: column;
        align-items: center;
    }

    .form-row.first-row .form-group.full-width-with-photo {
        width: 100%;
    }

    .photo-upload {
        flex: none;
        width: 100%;
        align-items: center;
        margin-top: 8px;
    }

    /* Stack all other rows */
    .form-row {
        flex-direction: column;
        gap: 14px;
    }

    /* Pincode fix — stack city and pincode vertically */
    .form-row.two-col {
        grid-template-columns: 1fr;
        display: flex;
        flex-direction: column;
        gap: 14px;
    }

    .form-group {
        width: 100%;
        flex-direction: row;
        align-items: center;
    }

    .form-group label {
        min-width: 120px;
        font-size: 13px;
    }

    .selection-row { grid-template-columns: 1fr; gap: 16px; }

    .size-options { grid-template-columns: repeat(3, 1fr); gap: 10px; }

    #signatureCanvas { height: 130px; }

    .form-bottom { flex-direction: column; align-items: flex-start; }

    .success-modal-content { padding: 24px 16px; margin: 6% auto; }
    .success-actions { flex-direction: column; align-items: stretch; }
    .pay-now-btn, .download-btn, .close-modal-btn { width: 100%; justify-content: center; }
}

/* ═══════════════════════════════════════════
   RESPONSIVE — MOBILE ≤ 480px
═══════════════════════════════════════════ */
@media (max-width: 480px) {
    body { padding: 6px; }

    .form-container { border-width: 3px; border-radius: 6px; }

    .form-header { padding: 12px 10px; }
    .logo-left img  { width: 65px !important; height: 65px !important; }
    .logo-right img { width: 50px !important; height: 50px !important; }
    .form-title h1  { font-size: 11px; }
    .form-title h2  { font-size: 10px; }
    .form-title h3, .form-title h4 { font-size: 10px; }

    .registration-form { padding: 12px 10px; }

    /* On small phones: stack label above input */
    .form-group {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .form-group label {
        min-width: unset;
        width: 100%;
        margin-right: 0;
        font-size: 12px;
    }

    .form-group input,
    .form-group textarea {
        width: 100%;
        font-size: 13px;
        padding: 8px 4px;
    }

    .photo-box { width: 120px; height: 150px; }

    .player-type-section { padding: 14px 10px; }
    .checkbox-label { font-size: 13px; }

    .size-options { grid-template-columns: repeat(3, 1fr); gap: 8px; }
    .size-box { padding: 10px 4px; font-size: 13px; }

    .entry-fee-box { padding: 16px 12px; }
    .entry-fee-box h3 { font-size: 15px; }
    .fee-amount { font-size: 20px; }

    .signature-section { padding: 14px 10px; }
    #signatureCanvas { height: 110px; }

    .form-footer { padding: 14px 10px; }
    .footer-points li, .contact-details p, .contact-info p { font-size: 11px; }

    .submit-btn { padding: 14px 24px; font-size: 15px; width: 100%; justify-content: center; }

    .success-modal-content { padding: 18px 12px; margin: 5% auto; }
    .success-icon { font-size: 50px; }
    .success-modal-content h2 { font-size: 20px; }
}