@import url('https://fonts.googleapis.com/css2?family=El+Messiri:wght@400;500;600;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'El Messiri', sans-serif;
    background: #F0F2F8;
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(102, 126, 234, 0.08) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 20%, rgba(118, 75, 162, 0.06) 0%, transparent 50%);
    min-height: 100vh;
    padding: 40px 20px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

/* ─── Main Container ─── */
.container {
    width: 100%;
    max-width: 1100px;
    background: #FFFFFF;
    box-shadow:
        0px 187px 75px rgba(0, 0, 0, 0.01),
        0px 105px 63px rgba(0, 0, 0, 0.04),
        0px 47px 47px rgba(0, 0, 0, 0.07),
        0px 12px 26px rgba(0, 0, 0, 0.08),
        0px 0px 0px rgba(0, 0, 0, 0.08);
    border-radius: 26px;
    padding: 36px 32px 32px;
    margin: 0 auto;
}

/* ─── Header ─── */
h1 {
    text-align: center;
    font-size: 1.5rem;
    font-weight: 800;
    color: #1a1a2e;
    margin-bottom: 6px;
    letter-spacing: -0.3px;
    
}

.subtitle {
    text-align: center;
    font-size: 0.875rem;
    color: #1a1a1a;
    font-weight: 500;
    margin-bottom: 28px;
}



/* ─── Buttons ─── */
button {
    width: 100%;
    height: 50px;
    border-radius: 11px;
    border: 0;
    outline: none;
    font-size: 0.9rem;
    font-weight: 700;
    font-family: 'El Messiri', sans-serif;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.15, 0.83, 0.66, 1);
}


button:disabled {
    background: #F2F2F2;
    color: #8B8E98;
    cursor: not-allowed;
    box-shadow: none;
}


/* ─── Status Messages ─── */
.status {
    margin-top: 14px;
    padding: 12px 16px;
    border-radius: 11px;
    text-align: center;
    font-size: 0.85rem;
    font-weight: 600;
}

.status.error {
    background: #FFF0F0;
    color: #c53030;
}

.status.success {
    background: #F0FFF4;
    color: #22543d;
}

/* ─── Template Grid ─── */
.template-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin-top: 10px;
}

.template-card {
    border: 2px solid #F2F2F2;
    border-radius: 14px;
    padding: 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.15, 0.83, 0.66, 1);
    background: #FAFAFA;
}

.template-card:hover {
    border-color: #d0d0d0;
    background: #F5F5F5;
}

.template-card.selected {
    border-color: #1a1a2e;
    background: #F8F8FF;
    
}

.template-card img {
    width: 100%;
    height: auto;
    aspect-ratio: 3 / 2;
    object-fit: cover;
    border-radius: 8px;
    background: #e8e8e8;
}

.template-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.template-modal-content {
    background: #fff;
    border-radius: 12px;
    width: 100%;
    max-width: 1100px;
    height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.template-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid #e2e8f0;
    font-weight: 600;
    font-size: 15px;
}

.template-modal-close {
    min-width: 44px;
    min-height: 44px;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f7fafc;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    color: #2d3748;
    flex-shrink: 0;
}

.template-modal-close:hover {
    background: #f7fafc;
    color: #2d3748;
}

#templateModalFrame {
    flex: 1;
    width: 100%;
    border: none;
}

@media (max-width: 640px) {
    .template-modal-overlay {
        padding: 16px;
        align-items: center;
    }
    .template-modal-content {
        border-radius: 12px;
        height: 85vh;
        width: 100%;
    }
}

.preview-btn {
    margin-top: 8px;
    width: 100%;
    height: 32px;
    padding: 0;
    font-size: 0.78rem;
    font-weight: 600;
    background: #a259ff;
    color: #ffffff;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.preview-btn:hover {
    background: #e0e0e0;
}



/* ─── Nav Buttons ─── */
.nav-buttons {
   display: flex;
    gap: 10px;
    margin-top: 24px;
    justify-content: space-between;
}


.nav-buttons button {
    flex: 0 0 auto;
}

#prevBtn {
    width: 110px;
}

#nextBtn {
    margin-right: auto;
}



@media (max-width: 480px) {
  body {
    padding: 12px 10px;
  }

  .container {
    padding: 20px 16px 20px;
    border-radius: 14px;
    max-width: 100%;
  }

  .template-options {
    grid-template-columns: 1fr;
  }
}