/* --- style.css (Mobile Frame Redesign - Bottom Anchor) --- */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700&display=swap');

:root {
    --primary-color: #0f2027; 
    --secondary-color: #ffc107;
    --background-gradient : linear-gradient(135deg, #0f2027, #203a43, #2c5364);
    --text-color: #333; 
    --ramadan-red: #c0392b;
}
/* --- BODY & BACKGROUND --- */
body {
    font-family: 'Cairo', sans-serif;
    
    /* 1. UNIFIED GRADIENT BACKGROUND */
    /* This color shows through where the image fades out */
    background: radial-gradient(circle at center, #ffffff 0%, #eaeeda 100%);
    
    color: #0a0c00; 
    
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow-x: hidden;
    margin: 0;
}

header {
    flex-shrink: 0;
    width: 100%;
    z-index: 10;
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 5%;
    max-width: 400px;
    margin: 0 auto;
}

.logo img, 
.logo-40 img { 
    width: 80px; 
    height: auto;
    display: block;
    margin-left: auto;
}

main {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0;
    min-height: 85vh;
    min-width: max-content;

}

/* BACKGROUND IMAGE WITH MELTING EDGES */
main::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    
    background-image: url('../images/1000003465.webp');
    background-position: center top;
    background-repeat: no-repeat;
    /* 'contain' keeps the whole portrait visible */
    background-size: contain; 
    z-index: -1; 
    aspect-ratio: 9 / 16;

    
    /* THE FIX:
       1. 'closest-side': Ensures the gradient respects the narrow width of a portrait image.
       2. 'black 75%': Keeps the inner 75% of the image TOTALLY SOLID (No blur/fade).
       3. 'transparent 100%': Fades to invisible only in the last 25% of space.
    
    -webkit-mask-image: radial-gradient(ellipse closest-side at center, black 95%, transparent 100%);
    mask-image: radial-gradient(ellipse closest-side at center, black 95%, transparent 100%);*/
    
    /* Optional: Adds a very slight real blur to the pixels if supported, 
       but creates a softer 'dreamy' edge combined with the mask */
    filter: blur(0px); 
    
    pointer-events: none;
}

.animation-container {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9999;
}

/* --- FORM WRAPPER --- */
.form-wrapper {
    position: relative;
    z-index: 1;
    width: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    max-width: 600px;
}

.form-wrapper .container {
    background: rgba(255, 255, 255, 0.45);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: 24px;
    padding: 25px;
    
    /* Big Size */
    width: 50%;
    max-width: 300px;
    min-width: 250px;
    height: auto;
    
    filter: drop-shadow(0 25px 40px rgba(0,0,0,0.2));
    display: block;
    cursor: pointer;
}

/* Floating Ramadan Kareem */
.ramadan-kareem-img {
    position: absolute;
    left: 50%;
    top: calc(clamp(180px, 35vw, 220px) - 30px);
    transform: translate(-50%, -20px);
    width: clamp(140px, 45vw, 180px);
    z-index: 25;
}


.container h1 {
    text-align: center;  /* h1 text itself is centered */
}

/* --- TEXT & SECTIONS --- */
h1 {
    color: var(--primary-color);
    margin-bottom: 12px;
    font-size: 22px;
}

.error-msg {
    color: var(--ramadan-red);
    font-size: 13px;
    font-weight: bold;
    min-height: 18px;
}

.section { display: none; }
.section.active {
    display: block;
    animation: fadeIn .4s ease;
}

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

/* --- FORM --- */
.form-group {
    margin-bottom: 10px;
    text-align: right;
}

label {
    display: block;
    margin-bottom: 4px;
    font-weight: 600;
    color: var(--primary-color);
    font-size: 14px;
    padding-right: 5px;
    padding-left: 5px;
}

input {
    width: 100%;
    padding: 10px 12px;
    font-size: 15px;
    border: 1px solid #ccc;
    border-radius: 8px;
    box-sizing: border-box;
    text-align: right;
}

input:focus {
    border-color: var(--secondary-color);
    outline: none;
}

/* --- BUTTONS --- */
button {
    background-color: #f77118;
    color: white;
    border: none;

    padding: 12px 16px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 700;

    width: 100%;
    margin-top: 12px;

    cursor: pointer;
    border-bottom: 4px solid #d8b261;
    transition: .25s;
}

button:hover:not(:disabled) {
    background-color: #eca451;
}

button:disabled {
    background-color: #ccc;
    border-bottom: none;
}

/* --- LOADER --- */
.loader {
    border: 6px solid #f3f3f3;
    border-top: 6px solid var(--secondary-color);
    border-radius: 50%;
    width: 48px;
    height: 48px;
    animation: spin 1.2s linear infinite;
    margin: 16px auto;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* --- WHEEL --- */
/* --- ROUE (Mobile Friendly Size) --- */
.wheel-wrapper {
    position: relative;
    width: 80%;               /* full width of container 100 */ 
    max-width: 360px;          /* never bigger than container 360*/
    height: 0;
    padding-bottom: 80%;      /* makes the wrapper square 100*/
    margin: 0 auto 8px auto;  /* center horizontally, spacing below 30 */
    box-sizing: border-box;
}

.wheel-wrapper canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;               /* fits wrapper */
    height: 100%;              /* fits wrapper */
    border-radius: 50%;
    filter: drop-shadow(0 10px 15px rgba(0,0,0,0.5));
}


.wheel-pointer {
    position: absolute;
    top: 50%;
    right: -2%;                  /* relative to wrapper width */
    width: 15%;                    /* responsive to wrapper */
    height: 8%;
    background: #cc0a2a;
    clip-path: polygon(0 50%,100% 0,100% 100%);
    transform: translateY(-50%);
    z-index: 10;
}


/* --- TERMS --- */
.terms-container {
    display: flex;
    align-items: center;
    justify-content: flex-end; /* pushes content to the right */
    gap: 8px;
}

.terms-text {
    direction: rtl;     /* keep Arabic readable */
    text-align: right;
}

.terms-container input {
    order: 1; /* ensure checkbox stays after text visually */
    width: 20px;
    height: 20px;
}

/* --- SMALL HEIGHT SAFETY --- */
@media (max-height: 700px) {
    .form-wrapper {
        padding-top: 160px;
    }

    .wheel-wrapper {
        width: 240px;
        height: 240px;
    }
}

/* --- EXTRA MOBILE SAFETY --- */
@media (max-width: 420px) {
    .container {
        max-width: calc(100% - 24px);
        padding: 14px 12px;
    }

    h1 {
        font-size: 20px;
    }
}

/* --- FIX: Celebration Section Visibility --- */
#celebration-section {
    /* Remove display: none; so it uses the .section logic */
    text-align: center;
}

.prize-text {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--ramadan-red);
    margin: 15px 0;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* --- FIX: Confetti/Flying Elements Animation --- */
.floating-element {
    position: absolute;
    bottom: -5vh;
    pointer-events: none;
    animation: floatUp ease-in-out forwards;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

@keyframes floatUp {
    0% {
        transform: translateX(0) translateY(0);
        opacity: 0;  /* semi-transparent start */
    }
    20% {
        opacity: 0;    /* fully opaque early */
    }
    30% {
        opacity: 0.4;    /* fully opaque early */
    }
    50% {
        opacity: 1;    /* fully opaque early */
    }
    60% {
        opacity: 0.8;    /* fully opaque early */
    }
    80% {
        opacity: 0.4;    /* stay opaque while floating */
    }
    90% {
        opacity: 0;    /* stay opaque while floating */
    }
    100% {
        transform: translateX(var(--x-drift)) translateY(-80vh);
        opacity: 0;    /* fade out at top */
    }
}

/* Slow, calm spin */
.floating-element img {
    display: block;
    animation: spinSlow 12s linear infinite;
}

@keyframes spinSlow {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}
.back-btn {
    display: inline-block;
    margin-top: 25px;
    padding: 14px 30px;
    background-color: #f77118;
    color: white;
    border: none;
    border-radius: 10px;
    text-decoration: none;
    font-weight: bold;
    font-size: 16px;
    transition: all 0.3s ease;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}
.back-btn:hover {
    background-color: #eca451;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(74, 20, 140, 0.4);
}

.container .section {
    display: none;       /* hide by default */
    width: 100%;         /* fit container width */
    box-sizing: border-box;
}

.container .section.active {
    display: block;      /* only active section shows */
    animation: fadeIn 0.5s;
}


/* --- FOOTER --- */
footer {
    flex-shrink: 0;
    text-align: center;
    z-index: 2;
    width: 100%;
}

.foot {
    background: transparent;
    font-size: 12px;
    color: #0a0c00;
}

.social {
    margin: 0;
}
.social span {
    display: block;
    font-weight: 700;
    letter-spacing: 2px;
    font-size: 14px;
}

.social-items {
    list-style: none;
    padding: 0;
    display: flex;
    justify-content: center;
    gap: 30px;
    margin: 0;
}

.social-items img {
    width: 32px;
    transition: transform 0.3s ease;
}

.social-items a:hover img {
    transform: translateY(-5px);
}