/*
 * Elkarim Trial Plugin - Madrassat Elkarim Theme Integration
 * Matches the Islamic color palette and design patterns of the main theme
 */

/* Islamic Color Palette - Matching Theme */
:root {
    --primary-color: #8a092f;
    --secondary-color: #a50d37;
    --light-primary: #c41e4a;
    --gold: #f7bf00;
    --light-gold: #ffd633;
    --dark-gold: #e6ac00;
    --cream: #fefdf8;
    --light-cream: #fffef9;
    --dark-red: #6b0724;
    --white: #ffffff;
    --text-dark: #2c2c2c;
    --text-light: #666666;
    --shadow-light: rgba(138, 9, 47, 0.1);
    --shadow-medium: rgba(138, 9, 47, 0.2);
    --shadow-dark: rgba(138, 9, 47, 0.3);
}

/* Override global max-width limitation */
.child-registration-form input[type="text"],
.child-registration-form input[type="password"],
.child-registration-form input[type="email"],
.child-registration-form input[type="tel"],
.child-registration-form input[type="url"],
.child-registration-form input[type="number"],
.child-registration-form input[type="date"],
.child-registration-form select,
.child-registration-form textarea {
    max-width: none !important;
    width: 100% !important;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
}

/* Override Auxin theme container limitations */
.child-registration-wrapper .aux-resp.aux-hd .aux-fold,
.child-registration-wrapper .aux-resp.aux-hd .aux-fold-width,
.child-registration-wrapper .aux-resp.aux-hd .aux-boxed-container > .aux-container,
.child-registration-wrapper .aux-container,
.child-registration-wrapper .aux-fold,
.child-registration-wrapper .aux-fold-width {
    width: 100% !important;
    max-width: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* Additional Auxin container overrides */
.aux-resp.aux-hd .aux-fold,
.aux-resp.aux-hd .aux-fold-width,
.aux-resp.aux-hd .aux-boxed-container > .aux-container {
    width: auto !important;
    max-width: none !important;
    margin-top: -110px;
    margin-bottom: -80px;
}

/* Force our container to be full width with theme-matching background */
.child-registration-wrapper {
    width: 100vw !important;
    max-width: 100vw !important;
    margin-left: calc(-50vw + 50%) !important;
    margin-right: calc(-50vw + 50%) !important;
    position: relative;
    min-height: 100vh;
    padding: 0;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow-x: hidden;
    overflow-y: auto;
}

/* Background image with Islamic pattern overlay */
.background-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 550px;
    background-image: url('../images/student-child.jpg');
    background-size: cover;
    background-position: center;
    z-index: 1;
    border-bottom-left-radius: 50% 80px;
    border-bottom-right-radius: 50% 80px;
}

.background-image::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url('https://i.ibb.co/ZzTYmhqL/elkarim-background.png');
    background-size: cover;
    background-position: center;
    opacity: 0.15;
    z-index: 1;
}

/* Form container with theme styling */
.child-registration-container {
    max-width: 800px;
    width: 90%;
    margin: 0 auto;
    padding: 20px;
    position: relative;
    z-index: 2;
    margin-top: 200px;
    padding-bottom: 50px;
}

/* Form styling matching theme cards */
.child-registration-form {
    background: var(--white);
    padding: 3rem 2.5rem;
    border-radius: 20px;
    box-shadow: 0 10px 40px var(--shadow-light);
    direction: ltr;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(247, 191, 0, 0.1);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.child-registration-form::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: linear-gradient(90deg, var(--primary-color), var(--gold), var(--primary-color));
    background-size: 200% 100%;
    animation: gradientShift 3s ease-in-out infinite;
}

.child-registration-form::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url('https://i.ibb.co/ZzTYmhqL/elkarim-background.png');
    background-size: cover;
    background-position: center;
    opacity: 0.02;
    z-index: -1;
    transition: opacity 0.3s ease;
}

.child-registration-form:hover::after {
    opacity: 0.05;
}

.child-registration-form h2 {
    text-align: center;
    color: var(--primary-color);
    margin-bottom: 2rem;
    font-size: 2rem;
    font-weight: 600;
    position: relative;
}

.child-registration-form h2::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 4px;
    background: linear-gradient(90deg, var(--gold), var(--light-gold), var(--gold));
    border-radius: 2px;
    animation: underlineGlow 2s ease-in-out infinite alternate;
}

@keyframes underlineGlow {
    0% {
        box-shadow: 0 0 5px var(--gold);
        width: 80px;
    }
    100% {
        box-shadow: 0 0 15px var(--gold), 0 0 25px var(--light-gold);
        width: 100px;
    }
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.student-form {
    background: var(--cream);
    padding: 2rem;
    border-radius: 15px;
    margin-bottom: 2rem;
    border: 1px solid rgba(247, 191, 0, 0.2);
    box-shadow: 0 5px 20px var(--shadow-light);
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.student-form::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url('https://i.ibb.co/ZzTYmhqL/elkarim-background.png');
    background-size: cover;
    background-position: center;
    opacity: 0.03;
    z-index: -1;
}

.student-form:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--shadow-medium);
}

/* Form fields styling */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group input,
.form-group select {
    width: 100%;
    height: 50px;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 16px;
    box-sizing: border-box;
    text-align: left;
    background-color: var(--white);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    transition: all 0.3s ease;
}


/* Flag display in select */
.flag-icon {
    display: inline-block;
    width: 24px;
    height: 16px;
    margin-left: 10px;
    vertical-align: middle; 
    background-size: cover;
    background-position: center;
}


.whatsapp-group {
    display: flex;
    gap: 15px;
}

.whatsapp-group .country-code {
    width: 30%;
}

.whatsapp-group .phone-number {
    width: 70%;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(247, 191, 0, 0.2);
    transform: translateY(-1px);
}

.form-group input:hover,
.form-group select:hover {
    border-color: var(--light-primary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Button styling matching theme */
.form-actions {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.add-student-btn,
.save-btn {
    display: inline-block;
    padding: 15px 35px;
    border-radius: 30px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: 2px solid transparent;
    cursor: pointer;
    font-size: 1rem;
    position: relative;
    overflow: hidden;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    min-width: 180px;
    text-align: center;
}

.add-student-btn::before,
.save-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.add-student-btn:hover::before,
.save-btn:hover::before {
    left: 100%;
}

.add-student-btn {
    background: transparent;
    color: var(--primary-color);
    border-color: var(--primary-color);
    box-shadow: 0 4px 15px rgba(138, 9, 47, 0.2);
}

.add-student-btn:hover {
    background: var(--primary-color);
    color: var(--white);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(138, 9, 47, 0.4);
}

.save-btn {
    background: linear-gradient(45deg, var(--gold), var(--light-gold));
    color: var(--primary-color);
    border-color: var(--gold);
    box-shadow: 0 6px 20px rgba(247, 191, 0, 0.4);
}

.save-btn:hover {
    background: linear-gradient(45deg, var(--light-gold), var(--gold));
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(247, 191, 0, 0.6);
}

/* Success message matching theme */
.success-message {
    background: linear-gradient(135deg, var(--gold), var(--light-gold));
    color: var(--primary-color);
    padding: 1.5rem;
    border-radius: 15px;
    margin-bottom: 2rem;
    text-align: center;
    font-size: 1.2rem;
    font-weight: 600;
    box-shadow: 0 6px 20px rgba(247, 191, 0, 0.3);
    position: relative;
    overflow: hidden;
}

.success-message::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.2) 50%, transparent 70%);
    animation: shimmer 2s ease-in-out infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* Placeholder styling */
::placeholder {
    color: var(--text-light);
    opacity: 1;
}

/* Make all inputs equal size and styling */
input[type="text"],
input[type="number"],
input[type="email"],
input[type="date"],
select {
    height: 50px;
    font-size: 16px;
    background-color: #fff;
    font-family: Qatar, sans-serif;
}

/* Country flags specific styling */
.sa-flag { background-image: url('https://flagcdn.com/w20/sa.png'); }
.ae-flag { background-image: url('https://flagcdn.com/w20/ae.png'); }
.kw-flag { background-image: url('https://flagcdn.com/w20/kw.png'); }
.bh-flag { background-image: url('https://flagcdn.com/w20/bh.png'); }
.qa-flag { background-image: url('https://flagcdn.com/w20/qa.png'); }
.om-flag { background-image: url('https://flagcdn.com/w20/om.png'); }
.eg-flag { background-image: url('https://flagcdn.com/w20/eg.png'); }
.jo-flag { background-image: url('https://flagcdn.com/w20/jo.png'); }
.sy-flag { background-image: url('https://flagcdn.com/w20/sy.png'); }
.lb-flag { background-image: url('https://flagcdn.com/w20/lb.png'); }
.ps-flag { background-image: url('https://flagcdn.com/w20/ps.png'); }
.iq-flag { background-image: url('https://flagcdn.com/w20/iq.png'); }
.dz-flag { background-image: url('https://flagcdn.com/w20/dz.png'); }
.ma-flag { background-image: url('https://flagcdn.com/w20/ma.png'); }
.tn-flag { background-image: url('https://flagcdn.com/w20/tn.png'); }
.ly-flag { background-image: url('https://flagcdn.com/w20/ly.png'); }
.sd-flag { background-image: url('https://flagcdn.com/w20/sd.png'); }
.ye-flag { background-image: url('https://flagcdn.com/w20/ye.png'); }

/* Responsive design */
@media (max-width: 992px) {
    .child-registration-container {
        width: 90%;
    }
}

@media (max-width: 768px) {
    .background-image {
        height: 500px;
    }
    
    .child-registration-container {
        margin-top: 170px;
        padding: 15px;
    }
    
    .child-registration-form {
        padding: 20px;
        margin: 30px;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .add-student-btn,
    .save-btn {
        width: 100%;
        margin-bottom: 10px;
    }
}

@media (max-width: 576px) {
    .background-image {
        height: 350px;
    }
    
    .child-registration-container {
        margin-top: 150px;
        width: 95%;
        padding: 10px;
    }
    
    .child-registration-form h2 {
        font-size: 22px;
    }
    
    .whatsapp-group {
        flex-direction: column;
        gap: 15px;
    }
    
    .whatsapp-group .country-code,
    .whatsapp-group .phone-number {
        width: 100%;
    }
    
    .form-group input,
    .form-group select {
        font-size: 14px;
    }
}

/* Fix for date input */
input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(0.5) sepia(1) saturate(5) hue-rotate(300deg);
}

/* Equal height for all selects and inputs in the same row */
.form-group > * {
    box-sizing: border-box;
}

/* Session booking form sections */
.form-section {
    margin-bottom: 2.5rem;
    padding: 1.5rem;
    background: var(--cream);
    border-radius: 15px;
    border: 1px solid rgba(247, 191, 0, 0.1);
    position: relative;
    overflow: hidden;
}

.form-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url('https://i.ibb.co/ZzTYmhqL/elkarim-background.png');
    background-size: cover;
    background-position: center;
    opacity: 0.02;
    z-index: -1;
}

.form-section h3 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    font-weight: 600;
    text-align: center;
    position: relative;
}

.form-section h3::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 50px;
    height: 3px;
    background: linear-gradient(90deg, var(--gold), var(--light-gold));
    border-radius: 2px;
}

/* Selection buttons matching theme cards */
.selection-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
    margin-top: 1rem;
}

.selection-btn {
    display: inline-block;
    padding: 15px 20px;
    border-radius: 15px;
    cursor: pointer;
    background: var(--white);
    border: 2px solid #e0e0e0;
    text-align: center;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    min-width: 100px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.selection-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(247, 191, 0, 0.1) 0%, transparent 50%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.selection-btn:hover::before {
    opacity: 1;
}

.selection-btn input[type="radio"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.selection-btn span {
    display: block;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-dark);
    position: relative;
    z-index: 2;
}

.selection-btn.selected {
    background: linear-gradient(45deg, var(--gold), var(--light-gold));
    border-color: var(--gold);
    color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(247, 191, 0, 0.3);
}

.selection-btn.selected span {
    color: var(--primary-color);
}

.selection-btn:hover {
    border-color: var(--light-primary);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.day-buttons .selection-btn {
    min-width: 120px;
}

.time-buttons .selection-btn {
    min-width: 140px;
}

.count-buttons .selection-btn {
    min-width: 80px;
}

.text-center {
    text-align: center;
}

#confirm-btn {
    margin-top: 2rem;
}

/* Final step styling */
#step-3 {
    padding: 3rem 2rem;
    text-align: center;
    background: linear-gradient(135deg, var(--cream), var(--light-cream));
    position: relative;
}

#step-3::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url('https://i.ibb.co/ZzTYmhqL/elkarim-background.png');
    background-size: cover;
    background-position: center;
    opacity: 0.05;
    z-index: -1;
}

#step-3 p {
    font-size: 1.2rem;
    line-height: 1.8;
    margin-top: 1.5rem;
    color: var(--text-dark);
    position: relative;
    z-index: 2;
}

/* Loading Overlay matching theme */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(138, 9, 47, 0.9) 0%, rgba(165, 13, 55, 0.85) 100%);
    display: none;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    z-index: 9999;
}

.loading-overlay::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url('https://i.ibb.co/ZzTYmhqL/elkarim-background.png');
    background-size: cover;
    background-position: center;
    opacity: 0.2;
    z-index: -1;
}

.loading-spinner {
    position: relative;
    width: 80px;
    height: 80px;
    margin-bottom: 2rem;
}

.loading-spinner .spinner-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 3px solid transparent;
    border-top: 3px solid var(--gold);
    border-radius: 50%;
    animation: spin 1.5s linear infinite;
}

.loading-spinner .spinner-ring:nth-child(2) {
    width: 60px;
    height: 60px;
    top: 10px;
    left: 10px;
    border-top-color: var(--light-gold);
    animation-duration: 1s;
    animation-direction: reverse;
}

.loading-spinner .spinner-ring:nth-child(3) {
    width: 40px;
    height: 40px;
    top: 20px;
    left: 20px;
    border-top-color: var(--white);
    animation-duration: 0.8s;
}

.loading-message {
    color: var(--white);
    font-size: 1.2rem;
    font-weight: 600;
    text-align: center;
    max-width: 80%;
    line-height: 1.6;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.3);
    position: relative;
    z-index: 2;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Additional responsive improvements */
@media (max-width: 768px) {
    .selection-buttons {
        gap: 0.5rem;
    }

    .selection-btn {
        padding: 12px 15px;
        min-width: 80px;
        font-size: 14px;
    }

    .day-buttons .selection-btn {
        min-width: 90px;
    }

    .time-buttons .selection-btn {
        min-width: 100px;
    }

    .count-buttons .selection-btn {
        min-width: 60px;
    }

    .form-section {
        padding: 1rem;
        margin-bottom: 1.5rem;
    }

    .form-section h3 {
        font-size: 1.2rem;
    }
}

@media (max-width: 480px) {
    .selection-buttons {
        flex-direction: column;
        align-items: center;
    }

    .selection-btn {
        width: 100%;
        max-width: 200px;
    }

    .child-registration-form {
        padding: 2rem 1.5rem;
    }

    .child-registration-form h2 {
        font-size: 1.5rem;
    }

    .form-actions {
        flex-direction: column;
        align-items: center;
    }

    .add-student-btn,
    .save-btn {
        width: 100%;
        max-width: 250px;
        margin-bottom: 1rem;
    }
}

/* Ensure compatibility with theme's mobile menu */
@media (max-width: 768px) {
    .child-registration-wrapper {
        margin-top: 0 !important;
        padding-top: 80px; /* Account for mobile header */
    }

    .background-image {
        height: 400px;
    }

    .child-registration-container {
        margin-top: 150px;
    }
}

/* Print styles */
@media print {
    .child-registration-wrapper {
        background: white !important;
    }

    .background-image {
        display: none;
    }

    .loading-overlay {
        display: none !important;
    }
}