/* ========================================
   GLOBAL STYLES
======================================== */


body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding-bottom: 50px;
}

/* ========================================
   PAGE HEADER
======================================== */
.page-header {
    margin-top: 50px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 40px 0;
    margin-bottom: 50px;
    border-bottom: 3px solid rgba(255, 255, 255, 0.2);
}

.header-title {
    color: white;
    font-size: 3rem;
    font-weight: 900;
    text-align: center;
    margin-bottom: 15px;
    text-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.header-subtitle {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.3rem;
    text-align: center;
    font-weight: 500;
}

/* ========================================
   TEMPLATE CARDS
======================================== */
.template-card {
    background: white;
    border-radius: 25px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.template-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.4);
}

.template-preview {
    padding: 30px;
    background: #f8f9fa;
    border-bottom: 3px solid #e9ecef;
    height: 400px;
    overflow: hidden;
    display: flex;
    justify-content: center;
}

.certificate-mini {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    transform: scale(0.45);
    transform-origin: top center;
    margin-bottom: -400px;
}

.template-info {
    padding: 30px;
}

.template-name {
    font-size: 1.5rem;
    font-weight: 800;
    color: #2d3748;
    margin-bottom: 10px;
}

.template-desc {
    color: #718096;
    font-size: 1rem;
    margin-bottom: 20px;
}

.btn-customize {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 12px;
    font-weight: 700;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-customize:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
}

/* ========================================
   CERTIFICATE 1: CLASSIC ISLAMIC
======================================== */
.cert-classic {
    width: 1000px;
    max-width: 100%;
    padding: 80px 50px;
    background: linear-gradient(135deg, #fdfbfb 0%, #f7f4ed 100%);
    min-height: 750px;
    position: relative;
    text-align: center;
    font-family: 'Amiri', serif;
    box-shadow: 0 0 50px rgba(0,0,0,0.1);
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    letter-spacing: normal;
    word-spacing: normal;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.islamic-border {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    bottom: 20px;
    border: 4px solid #8B4513;
    border-radius: 10px;
}

.islamic-border::before {
    content: '';
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    bottom: 10px;
    border: 2px solid #D4AF37;
}

.cert-classic .mosque-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.cert-classic .cert-title {
    font-size: 3rem;
    color: #2c5f2d;
    font-weight: 700;
    font-family: 'Rakkas', cursive;
    margin-bottom: 30px;
    position: relative;
    z-index: 10;
}

.cert-classic .quran-icon {
    font-size: 3.5rem;
    margin: 20px 0;
}

.cert-classic .cert-text {
    font-size: 1.5rem;
    color: #555;
    margin-bottom: 15px;
}

.cert-classic .student-name {
    font-size: 2.8rem;
    color: #8B4513;
    font-weight: 700;
    margin: 20px 0;
    font-family: 'Scheherazade New', serif;
}

.cert-classic .cert-achievement {
    font-size: 1.8rem;
    color: #2c5f2d;
    margin: 25px 0;
    font-weight: 600;
}

.cert-classic .quran-verse {
    font-size: 1.8rem;
    color: #8B4513;
    margin: 30px 0;
    font-family: 'Scheherazade New', serif;
    font-weight: 700;
}

.cert-classic .cert-footer {
    margin-top: 50px;
    position: relative;
    z-index: 10;
}

.cert-classic .signature-section {
    display: flex;
    justify-content: space-between;
    padding: 0 50px;
}

.cert-classic .date,
.cert-classic .teacher {
    font-size: 1.3rem;
    color: #555;
    font-weight: 600;
}

.decorative-corners {
    position: absolute;
    top: 40px;
    left: 40px;
    right: 40px;
    bottom: 40px;
}

.decorative-corners::before,
.decorative-corners::after {
    content: '✦';
    position: absolute;
    font-size: 2rem;
    color: #D4AF37;
}

.decorative-corners::before {
    top: 0;
    left: 0;
}

.decorative-corners::after {
    bottom: 0;
    right: 0;
}

/* ========================================
   CERTIFICATE 2: MODERN COLORFUL
======================================== */
.cert-modern {
    width: 1000px;
    max-width: 100%;
    padding: 60px 40px;
    background: white;
    min-height: 750px;
    position: relative;
    text-align: center;
    box-shadow: 0 0 50px rgba(0,0,0,0.1);
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    letter-spacing: normal;
    word-spacing: normal;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.gradient-bg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 200px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 0 0 50% 50%;
}

.stars-decoration {
    position: relative;
    z-index: 10;
    margin-bottom: 20px;
    font-size: 2.5rem;
}

.stars-decoration span {
    margin: 0 10px;
    animation: twinkle 2s infinite;
}

.cert-badge {
    position: relative;
    z-index: 10;
    margin-bottom: 30px;
}

.badge-circle {
    width: 120px;
    height: 120px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    box-shadow: 0 10px 40px rgba(102, 126, 234, 0.4);
    border: 5px solid #ffd700;
}

.badge-circle i {
    font-size: 4rem;
    color: #ffd700;
}

.cert-modern .cert-title {
    font-size: 3rem;
    font-weight: 900;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 15px;
}

.cert-modern .cert-subtitle {
    font-size: 1.3rem;
    color: #718096;
    margin-bottom: 30px;
}

.cert-modern .student-name {
    font-size: 3rem;
    color: #2d3748;
    font-weight: 900;
    margin: 25px 0;
    font-family: 'Cairo', sans-serif;
}

.achievement-box {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
    padding: 30px;
    border-radius: 20px;
    margin: 30px 0;
    border: 3px solid #667eea;
}

.achievement-box p {
    font-size: 1.8rem;
    color: #2d3748;
    margin: 0;
    font-weight: 700;
}

.achievement-detail {
    font-size: 1.5rem !important;
    color: #667eea !important;
    margin-top: 10px !important;
    font-weight: 800 !important;
}

.cert-footer-modern {
    display: flex;
    justify-content: space-around;
    margin-top: 40px;
}

.footer-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.2rem;
    color: #555;
    font-weight: 600;
}

.footer-item i {
    color: #667eea;
    font-size: 1.5rem;
}

.rainbow-line {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 15px;
    background: linear-gradient(90deg,
        #ff0000 0%,
        #ff7f00 16.66%,
        #ffff00 33.33%,
        #00ff00 50%,
        #0000ff 66.66%,
        #4b0082 83.33%,
        #9400d3 100%);
}

/* ========================================
   CERTIFICATE 3: GOLDEN LUXURY
======================================== */
.cert-luxury {
    width: 1000px;
    max-width: 100%;
    padding: 60px 40px;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    min-height: 750px;
    position: relative;
    text-align: center;
    color: white;
    box-shadow: 0 0 50px rgba(0,0,0,0.1);
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    letter-spacing: normal;
    word-spacing: normal;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.golden-border {
    position: absolute;
    top: 15px;
    left: 15px;
    right: 15px;
    bottom: 15px;
    border: 5px solid #D4AF37;
    border-radius: 15px;
    box-shadow: 0 0 30px rgba(212, 175, 55, 0.5);
}

.golden-border::before {
    content: '';
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    bottom: 10px;
    border: 2px solid rgba(212, 175, 55, 0.5);
    border-radius: 10px;
}

.luxury-header {
    position: relative;
    z-index: 10;
    margin-bottom: 30px;
}

.crown-icon {
    font-size: 4rem;
    margin-bottom: 15px;
    filter: drop-shadow(0 5px 15px rgba(212, 175, 55, 0.6));
}

.cert-luxury .cert-title {
    font-size: 2.8rem;
    font-weight: 900;
    color: #D4AF37;
    text-shadow: 0 3px 10px rgba(212, 175, 55, 0.5);
    margin-bottom: 20px;
}

.islamic-pattern {
    width: 100px;
    height: 3px;
    background: linear-gradient(90deg,
        transparent 0%,
        #D4AF37 50%,
        transparent 100%);
    margin: 20px auto;
}

.award-seal {
    margin: 30px 0;
}

.seal-inner {
    width: 150px;
    height: 150px;
    background: linear-gradient(135deg, #D4AF37, #FFD700);
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    box-shadow: 0 10px 40px rgba(212, 175, 55, 0.6);
    border: 5px solid #FFF;
}

.seal-inner i {
    font-size: 3rem;
    color: #1a1a2e;
    margin-bottom: 5px;
}

.seal-inner span {
    font-size: 1.5rem;
    font-weight: 900;
    color: #1a1a2e;
}

.honor-text {
    font-size: 1.5rem;
    color: rgba(255, 255, 255, 0.9);
    margin: 25px 0;
}

.student-name-luxury {
    font-size: 3.5rem;
    font-weight: 900;
    color: #FFD700;
    text-shadow: 0 5px 20px rgba(255, 215, 0, 0.5);
    margin: 25px 0;
    font-family: 'Scheherazade New', serif;
}

.achievement-ribbon {
    background: rgba(212, 175, 55, 0.2);
    border: 2px solid #D4AF37;
    padding: 25px;
    border-radius: 15px;
    margin: 30px 0;
}

.achievement-ribbon p {
    font-size: 1.8rem;
    color: #FFD700;
    margin: 0;
    font-weight: 700;
}

.parts-count {
    font-size: 1.5rem !important;
    color: rgba(255, 255, 255, 0.9) !important;
    margin-top: 10px !important;
}

.blessing-text {
    font-size: 1.6rem;
    color: #D4AF37;
    margin: 30px 0;
    font-family: 'Amiri', serif;
    font-weight: 700;
}

.luxury-footer {
    display: flex;
    justify-content: space-around;
    align-items: center;
    margin-top: 40px;
    position: relative;
    z-index: 10;
}

.footer-seal i {
    font-size: 3rem;
    color: #D4AF37;
}

.footer-details p {
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.9);
    margin: 5px 0;
}

/* ========================================
   CERTIFICATE 4: KIDS FRIENDLY
======================================== */
.cert-kids {
    width: 1000px;
    max-width: 100%;
    padding: 60px 40px;
    background: linear-gradient(135deg, #fff5f5 0%, #ffe5e5 100%);
    min-height: 750px;
    position: relative;
    text-align: center;
    box-shadow: 0 0 50px rgba(0,0,0,0.1);
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    letter-spacing: normal;
    word-spacing: normal;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.balloons {
    font-size: 3rem;
    margin-bottom: 20px;
}

.balloon {
    display: inline-block;
    margin: 0 10px;
    animation: float 3s ease-in-out infinite;
}

.balloon:nth-child(2) {
    animation-delay: 0.5s;
}

.balloon:nth-child(3) {
    animation-delay: 1s;
}

.kids-header {
    margin-bottom: 30px;
}

.cert-kids .cert-title {
    font-size: 3.5rem;
    font-weight: 900;
    background: linear-gradient(135deg, #ff6b6b, #ee5a6f);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 15px;
}

.happy-faces {
    font-size: 2.5rem;
}

.happy-faces span {
    margin: 0 10px;
    display: inline-block;
    animation: bounce 1s ease infinite;
}

.medal-display {
    margin: 30px 0;
}

.medal {
    width: 120px;
    height: 120px;
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    box-shadow: 0 10px 30px rgba(255, 215, 0, 0.5);
    border: 5px solid #ff6b6b;
}

.medal i {
    font-size: 4rem;
    color: #ff6b6b;
}

.kids-text {
    font-size: 1.5rem;
    color: #555;
    margin: 25px 0;
    font-weight: 600;
}

.student-name-kids {
    font-size: 3rem;
    color: #ff6b6b;
    font-weight: 900;
    margin: 20px 0;
    font-family: 'Cairo', sans-serif;
}

.achievement-card {
    background: white;
    padding: 30px;
    border-radius: 20px;
    margin: 30px 0;
    box-shadow: 0 10px 30px rgba(255, 107, 107, 0.2);
    border: 4px solid #ff6b6b;
}

.achievement-icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

.achievement-card p {
    font-size: 1.8rem;
    color: #2d3748;
    font-weight: 700;
    margin-bottom: 15px;
}

.stars-rating {
    color: #ffd700;
    font-size: 2rem;
}

.stars-rating i {
    margin: 0 5px;
}

.encouragement {
    font-size: 1.6rem;
    color: #ff6b6b;
    font-weight: 800;
    margin: 25px 0;
}

.kids-footer {
    display: flex;
    justify-content: space-around;
    margin-top: 30px;
}

.footer-box {
    background: white;
    padding: 15px 25px;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(255, 107, 107, 0.2);
    border: 3px solid #ff6b6b;
}

.footer-box span {
    font-size: 1.2rem;
    color: #555;
    font-weight: 600;
}

.confetti {
    font-size: 2.5rem;
    margin-top: 20px;
    letter-spacing: 20px;
}

/* ========================================
   CUSTOMIZER MODAL
======================================== */
.modal-content {
    border-radius: 25px;
    overflow: hidden;
}

.modal-header {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 25px;
}

.modal-title {
    font-size: 1.8rem;
    font-weight: 800;
}

.customizer-form {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 15px;
    height: 100%;
}

.form-section-title {
    color: #667eea;
    font-weight: 800;
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.form-label {
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 8px;
}

.form-control,
.form-select {
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    padding: 12px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.form-control:focus,
.form-select:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.live-preview {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 15px;
    height: 100%;
    overflow-x: auto;
    overflow-y: auto; /* Added vertical scroll */
    display: flex;
    flex-direction: column;
    align-items: center; /* Center the certificate horizontally */
}

.preview-title {
    color: #667eea;
    font-weight: 800;
    margin-bottom: 20px;
    font-size: 1.2rem;
}

.certificate-preview {
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    /* Removed max-height and overflow to prevent cutting during capture */
}

.modal-footer {
    padding: 20px 30px;
    background: #f8f9fa;
}

.modal-footer .btn {
    padding: 12px 30px;
    border-radius: 10px;
    font-weight: 700;
    transition: all 0.3s ease;
}

.modal-footer .btn:hover {
    transform: translateY(-3px);
}

/* ========================================
   ANIMATIONS
======================================== */
@keyframes twinkle {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.7;
    }
}

@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-20px);
    }
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* ========================================
   PRINT STYLES
======================================== */
@media print {
    body {
        background: white;
    }

    .page-header,
    .template-info,
    .modal-header,
    .modal-footer {
        display: none;
    }

    .certificate-preview {
        box-shadow: none;
        page-break-inside: avoid;
    }
}

/* ========================================
   RESPONSIVE DESIGN
======================================== */
@media (max-width: 992px) {
    .header-title {
        font-size: 2rem;
    }

    .customizer-form,
    .live-preview {
        margin-bottom: 20px;
    }

    .cert-classic,
    .cert-modern,
    .cert-luxury,
    .cert-kids {
        padding: 40px 30px;
        min-height: 500px;
    }
}

@media (max-width: 768px) {
    .cert-classic .cert-title,
    .cert-modern .cert-title,
    .cert-luxury .cert-title,
    .cert-kids .cert-title {
        font-size: 2rem;
    }

    .student-name,
    .student-name-luxury,
    .student-name-kids {
        font-size: 2rem !important;
    }

    .cert-classic .signature-section {
        flex-direction: column;
        gap: 15px;
    }
}


.modal-content{
    max-width: 100% !important;
    max-height: 100%;
}


.modal-header{
    display: flex;
    justify-content: space-between;
}

.modal-header .btn-close{
    margin: 0 !important;
}
