/* =================================================================== */
/* ============== ANIMATIONS & FONTS ============== */
/* =================================================================== */

@keyframes slideUpFadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
    0% { box-shadow: 0 4px 15px rgba(247, 119, 55, 0.4); }
    50% { box-shadow: 0 4px 30px rgba(247, 119, 55, 0.8); }
    100% { box-shadow: 0 4px 15px rgba(247, 119, 55, 0.4); }
}

@keyframes starFall {
    from { background-position: 0 0, 25px 25px; }
    to { background-position: 0 1000px, 25px 1025px; }
}

/* --- Global Styles --- */
html { height: 100%; }
body {
    margin: 0; padding: 2rem; box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
    background-color: #0c0c2b;
    background-image: linear-gradient(135deg, #0c0c2b, #00205b);
    background-repeat: no-repeat;
    background-attachment: fixed; 
    display: flex; justify-content: center; align-items: center;
    min-height: 100vh; position: relative; overflow-x: hidden; 
}

/* FALLING STARS EFFECT */
body::before {
    content: ''; position: fixed; top: 0; left: 0; width: 100%; height: 100%; 
    background-image: radial-gradient(circle, rgba(255,255,255,0.8) 1px, transparent 1px), radial-gradient(circle, rgba(255,255,255,0.6) 1px, transparent 1px); 
    background-size: 60px 60px, 90px 90px; background-position: 0 0, 30px 30px; 
    animation: starFall 60s linear infinite; z-index: -1; opacity: 0.6; 
}

/* === Registration Card Style === */
.registration-container {
    width: 100%; max-width: 700px; 
    background-color: rgba(0, 32, 91, 0.9); color: #ffffff;
    border-radius: 12px; border: 1px solid #5570a7;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px);
    padding: 0; box-sizing: border-box;
    animation: slideUpFadeIn 0.8s ease-out; overflow: hidden; 
}

.header-container { width: 100%; margin-bottom: 1.5rem; text-align: center; padding: 0; box-sizing: border-box; }
.banner-image-container { width: 100%; background-color: #000; }
.banner-img { width: 100%; height: auto; display: block; }

.event-details { padding: 0 3rem; margin-top: 1.5rem; margin-bottom: 1rem; display: flex; justify-content: space-around; align-items: center; flex-wrap: wrap; gap: 0.5rem; }
.detail-item { font-size: 1rem; font-weight: 400; color: #d0d0d0; margin: 0; }
.sub-title { font-size: 1.3rem; font-weight: 700; color: #ffffff; margin: 0; padding: 0 3rem; border-bottom: 2px solid #5570a7; padding-bottom: 1.5rem; margin-bottom: 1rem; }

/* --- Form Element Styling --- */
#registration-form { width: 100%; padding: 0 3rem 2.5rem 3rem; box-sizing: border-box; }
.form-row { display: flex; align-items: center; margin-top: 1rem; border-radius: 8px; padding: 0.25rem; transition: background-color 0.3s ease; }
.form-row:hover { background-color: rgba(255, 255, 255, 0.05); }
.form-row label { flex-basis: 150px; flex-shrink: 0; font-size: 1.1rem; font-weight: 600; color: #ffffff; margin: 0; padding-right: 1rem; }
.form-row input { flex-grow: 1; width: auto; background: transparent; border: none; border-bottom: 2px solid #5570a7; color: #ffffff; font-family: 'Poppins', sans-serif; font-size: 1.1rem; padding: 0.5rem 0.2rem; box-sizing: border-box; transition: border-color 0.3s, box-shadow 0.3s; }
.form-row input:focus { outline: none; border-bottom-color: #f77737; box-shadow: 0 5px 15px -5px rgba(247, 119, 55, 0.5); }
label, legend { font-size: 1.1rem; font-weight: 600; color: #ffffff; margin-bottom: 0.75rem; }

/* --- Fieldset --- */
fieldset { border: none; padding: 0; margin: 0; margin-top: 2rem; }
legend { font-size: 1.2rem; }
.checkbox-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem 1rem; padding-left: 10px; }
.checkbox-grid div { margin: 0; display: flex; align-items: center; padding: 0.25rem; border-radius: 6px; transition: background-color 0.3s ease; }
.checkbox-grid div:hover { background-color: rgba(255, 255, 255, 0.05); }
.checkbox-grid div label { font-weight: 400; font-size: 1rem; display: inline; margin: 0; color: #d0d0d0; }
input[type="checkbox"] { margin-right: 0.5rem; transform: scale(1.2); accent-color: #f77737; }

/* --- Register Button --- */
#submit-btn {
    width: 100%; background-image: linear-gradient(90deg, #e63946, #f77737);
    color: white; font-size: 1.2rem; font-weight: 700; font-family: 'Poppins', sans-serif;
    text-transform: uppercase; letter-spacing: 1px; border: none; border-radius: 50px;
    padding: 1rem 3rem; margin-top: 2.5rem; cursor: pointer; position: relative;
    transition: transform 0.2s, box-shadow 0.2s; animation: pulse 2s infinite ease-in-out;
}
#submit-btn:hover:not(:disabled) { transform: translateY(-3px) scale(1.02); box-shadow: 0 6px 20px rgba(247, 119, 55, 0.6); animation-play-state: paused; }
#submit-btn:active:not(:disabled) { transform: translateY(0) scale(0.98); box-shadow: 0 2px 10px rgba(247, 119, 55, 0.4); }
#submit-btn:disabled { background-image: none; background-color: #aaa; box-shadow: none; animation: none; }

#message { text-align: center; margin: 1.5rem 0 0 0; font-size: 1rem; font-weight: 600; animation-delay: 1.0s; animation-fill-mode: both; opacity: 0; }
#message[style*="green"] { color: #48c774; }
#message[style*="red"] { color: #f14668; }
#message[style*="orange"] { color: #ff9f1c; }

/* Animation Delays */
.header-container > *, #registration-form > .form-row, #registration-form > fieldset, #registration-form > button { animation: slideUpFadeIn 0.5s ease-out; animation-fill-mode: both; }
.banner-image-container { animation-delay: 0.1s; }
.event-details { animation-delay: 0.2s; }
.sub-title { animation-delay: 0.3s; } 
#registration-form > *:nth-child(1) { animation-delay: 0.4s; } 
#registration-form > *:nth-child(2) { animation-delay: 0.45s; }
#registration-form > *:nth-child(3) { animation-delay: 0.5s; } 
#registration-form > *:nth-child(4) { animation-delay: 0.55s; }
#registration-form > *:nth-child(5) { animation-delay: 0.6s; } 
#registration-form > *:nth-child(6) { animation-delay: 0.65s; } 
#registration-form > *:nth-child(7) { animation-delay: 0.7s; } 
#message { animation-delay: 0.75s; opacity: 0; }

/* Responsive */
@media (max-width: 768px) {
    body { padding: 1rem; align-items: flex-start; overflow-y: auto; }
    .registration-container { padding: 0; }
    .header-container, .event-details, .sub-title, #registration-form { padding-left: 1.5rem; padding-right: 1.5rem; }
    #registration-form { padding-bottom: 2rem; }
    .header-container { padding-top: 0; }
    .event-details { flex-direction: column; align-items: center; gap: 0.25rem; }
    .detail-item { font-size: 0.9rem; }
    .sub-title { font-size: 1.1rem; }
    .form-row { flex-direction: column; align-items: stretch; margin-top: 1rem; padding: 0; }
    .form-row:hover { background-color: transparent; }
    .form-row label { flex-basis: auto; padding-right: 0; margin-bottom: 0.5rem; }
    label, legend { font-size: 1rem; }
    input[type="text"], input[type="email"] { font-size: 1rem; }
    .checkbox-grid { padding-left: 0; gap: 0.25rem; }
    #submit-btn { font-size: 1.1rem; padding: 0.9rem 2.5rem; }
}

/* =================================================================== */
/* ============== MODAL & TICKET STYLES (iOS Fix) ================== */
/* =================================================================== */

.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.85); z-index: 9999;
    display: flex; justify-content: center; align-items: center;
    backdrop-filter: blur(5px); overflow-y: auto; 
}

.modal-content {
    background: #00205b; padding: 20px; border-radius: 12px;
    width: 90%; max-width: 380px; position: relative;
    text-align: center; box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    border: 1px solid #5570a7;
    margin: 20px 0; /* Space for scrolling on small screens */
}

.close-btn {
    position: absolute; top: 5px; right: 15px; font-size: 32px;
    color: white; cursor: pointer; z-index: 1000;
}

/* Ticket Wrapper (The part we capture) */
.ticket-wrapper {
    background-color: #00205b; padding: 10px; margin-bottom: 10px;
    border-radius: 8px;
}
.ticket-banner img { width: 100%; display: block; border-radius: 4px; margin-bottom: 15px; }

#qr-code-container {
    width: 180px; height: 180px; background: white; padding: 10px;
    margin: 0 auto; display: flex; justify-content: center; align-items: center;
    border-radius: 4px;
}
#qr-code-container img { width: 100%; height: auto; }

.attendee-info {
    background: white; color: #333; width: 200px; /* Match QR width */
    margin: -5px auto 0 auto; padding: 15px 10px;
    border-bottom-left-radius: 8px; border-bottom-right-radius: 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}
#modal-name { font-size: 1.3rem; margin: 0; color: #000; font-weight: 700; word-wrap: break-word; }
#modal-date { font-size: 0.8rem; color: #555; margin: 5px 0 0 0; }
.footer-text { color: #ccc; font-size: 0.7rem; margin-top: 15px; font-weight: 400; opacity: 0.8; }

/* The Generated Image Display */
#final-image-container img {
    width: 100%; height: auto;
    border: 2px solid #48c774; /* Green border indicates success */
    border-radius: 8px;
    box-shadow: 0 0 15px rgba(72, 199, 116, 0.4);
}