/* ================================
   GLOBAL RESET & BASE STYLING
================================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Roboto', Arial, sans-serif;
    background: linear-gradient(135deg, #3c862d 0%, #764ba2 100%);
    background-attachment: fixed;
    padding: 20px;
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

/* ================================
   NAVBAR
================================= */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 24px;
    background: #1f2937;
    color: #fff;
    border-radius: 10px;
    margin-bottom: 20px;
}

.navbar a {
    color: #fff;
    text-decoration: none;
    margin-left: 16px;
}

.brand {
    font-weight: bold;
    font-size: 18px;
}

.nav-link:hover {
    text-decoration: underline;
}

.btn-primary {
    background: #2563eb;
    padding: 6px 12px;
    border-radius: 6px;
}

/* ================================
   HEADER STYLING
================================= */
.header {
    background: #2D9CDB;
    color: white;
    text-align: center;
    border-radius: 15px;
    padding: 35px 20px;
    margin-bottom: 25px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
    position: relative;
}

.header h1 {
    font-size: 2em;
    margin-bottom: 10px;
}

.header p {
    font-size: 1em;
    color: #f0f0f0;
}

/* ================================
   FORM STYLING
================================= */
.form-container {
    background: #fff;
    border-radius: 12px;
    padding: 30px 25px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

label {
    font-weight: 500;
    margin-bottom: 8px;
    font-size: 0.95em;
}

label.required::after {
    content: " *";
    color: red;
}

label.optional {
    color: #2563eb;
    font-weight: 400;
}

/* Prevent ugly zoom on mobile */
input, select, textarea, button {
    font-size: 16px;
}

input, select, textarea {
    padding: 12px 15px;
    border: 1.5px solid #ccc;
    border-radius: 10px;
    font-size: 0.95em;
    transition: all 0.3s;
    width: 100%;
    box-sizing: border-box;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #2D9CDB;
    box-shadow: 0 0 6px rgba(45,156,219,0.3);
}

/* DOUBLE INPUT (Lesson No / Total Lessons) */
.double-input {
    display: flex;
    gap: 12px;
    flex-wrap: nowrap;
    width: 100%;
}

.double-input .input-group {
    display: flex;
    flex-direction: column;
    flex: 1 1 0;
    min-width: 0;
}

.double-input input {
    width: 100%;
    box-sizing: border-box;
}

/* ================================
   BUTTONS
================================= */
.generate-btn, .premium-btn {
    padding: 15px 40px;
    border: none;
    border-radius: 12px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: block;
    margin: 25px auto 0 auto;
}

.generate-btn {
    background: #2D9CDB;
    color: #fff;
}

.generate-btn:hover {
    background: #1B7BB8;
    transform: scale(1.03);
    box-shadow: 0 6px 20px rgba(0,0,0,0.2);
}

.generate-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.premium-btn {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
}

.premium-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.btn-pay {
    background: #f59e0b;
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
}

.btn-pay:hover {
    transform: scale(1.05);
}

/* ERROR MESSAGES */
.error-message {
    color: red;
    text-align: center;
    margin-top: 12px;
    font-size: 0.9em;
}

/* ================================
   RESULT / LESSON PLAN STYLING
================================= */
.result-container {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    display: none;
}

.result-container.show {
    display: block;
}

.download-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.download-btn {
    padding: 12px 28px;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    color: #fff;
    background: #2D9CDB;
    font-size: 0.95rem;
}

.download-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 14px rgba(0,0,0,0.15);
}

.btn-word  { background: #2D9CDB; }
.btn-pdf   { background: #10b981; }

/* ================================
   LESSON PLAN CONTENT (screen)
================================= */
.lesson-plan {
    font-size: 10pt;
    line-height: 1.6;
}

.lesson-plan table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 10px;
}

.lesson-plan td {
    border: 1px solid black;
    padding: 8px;
    vertical-align: top;
}

.lesson-plan .bold { font-weight: bold; }

.lesson-plan ul {
    margin: 5px 0;
    padding-left: 20px;
}

.lesson-plan li { margin: 2px 0; }

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

/* ================================
   FOOTER
================================= */
footer {
    text-align: center;
    padding: 30px 20px;
    background: #f1f3f6;
    color: #555;
    font-size: 0.95rem;
    margin-top: 20px;
    border-radius: 10px;
}

/* ================================
   MODAL — BASE OVERLAY
================================= */
.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    inset: 0;
    background-color: rgba(0,0,0,0.65);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 16px;
    box-sizing: border-box;
}

.modal[style*="display: flex"],
.modal[style*="display:flex"] {
    display: flex !important;
    align-items: flex-start;
    justify-content: center;
}

/* ================================
   MODAL CONTENT BOX
================================= */
.modal-content {
    background: #fff;
    border-radius: 16px;
    width: 100%;
    max-width: 980px;
    margin: auto;
    padding: 0;
    box-shadow: 0 16px 48px rgba(0,0,0,0.28);
    animation: modalSlideIn 0.3s ease-out;
    position: relative;
    overflow: hidden;
}

@keyframes modalSlideIn {
    from { transform: translateY(-40px); opacity: 0; }
    to   { transform: translateY(0);     opacity: 1; }
}

/* ================================
   CLOSE BUTTON
================================= */
.close {
    position: absolute;
    top: 14px;
    right: 18px;
    font-size: 30px;
    font-weight: bold;
    color: #888;
    cursor: pointer;
    z-index: 10;
    line-height: 1;
    background: none;
    border: none;
    transition: color 0.2s;
}

.close:hover { color: #222; }

/* ================================
   PRICING MODAL WRAPPER
================================= */
.pricing-modal {
    padding: 38px 32px 32px;
}

/* ================================
   PRICING HEADER
================================= */
.pricing-header {
    text-align: center;
    margin-bottom: 28px;
}

.pricing-header h1 {
    color: #e53935;
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 6px;
    line-height: 1.4;
}

.pricing-header h2 {
    color: #1a1a2e;
    font-size: 1.85rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.pricing-header p {
    color: #666;
    font-size: 1rem;
    margin: 0;
}

/* ================================
   PRICING GRID
================================= */
.pricing-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 22px;
}

/* ================================
   PRICING CARD
================================= */
.pricing-card {
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 14px;
    padding: 28px 20px 24px;
    text-align: center;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    position: relative;
}

.pricing-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 28px rgba(0,0,0,0.12);
}

.pricing-card.featured {
    border-color: #f57c00;
    background: #fff8f0;
    transform: scale(1.03);
}

.pricing-card.featured::before {
    content: "⭐ BEST VALUE";
    position: absolute;
    top: -13px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #ff9800, #f57c00);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 14px;
    border-radius: 20px;
    white-space: nowrap;
    letter-spacing: 0.5px;
}

.pricing-card h3 {
    font-size: 1.25rem;
    color: #1a1a2e;
    margin-bottom: 12px;
    font-weight: 700;
}

.pricing-card .price {
    font-size: 2.2rem;
    font-weight: 800;
    color: #2D9CDB;
    margin: 8px 0 2px;
    line-height: 1.1;
}

.pricing-card .duration {
    color: #888;
    font-size: 0.9rem;
    margin-bottom: 18px;
}

.pricing-card ul {
    list-style: none;
    padding: 0;
    margin: 0 0 22px;
    text-align: left;
}

.pricing-card ul li {
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
    color: #444;
    font-size: 0.9rem;
}

.pricing-card ul li:last-child { border-bottom: none; }

.pricing-card .badge {
    background: #2D9CDB;
    color: #fff;
    font-size: 11px;
    font-weight: bold;
    padding: 4px 10px;
    border-radius: 20px;
    position: absolute;
    top: 14px;
    right: 14px;
}

/* ================================
   CHOOSE / PRICING BUTTONS
================================= */
.choose-btn,
.pricing-btn {
    display: block;
    width: 100%;
    padding: 13px 18px;
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    background: linear-gradient(135deg, #4CAF50, #43a047);
    color: #fff;
    transition: all 0.25s ease;
    box-shadow: 0 4px 12px rgba(76,175,80,0.25);
    margin-top: 0;
}

.choose-btn:hover,
.pricing-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(76,175,80,0.35);
    background: linear-gradient(135deg, #43a047, #388e3c);
}

.choose-btn:active { transform: scale(0.97); }

.choose-btn.primary {
    background: linear-gradient(135deg, #ff9800, #f57c00);
    box-shadow: 0 4px 12px rgba(255,152,0,0.3);
}

.choose-btn.primary:hover {
    background: linear-gradient(135deg, #f57c00, #ef6c00);
    box-shadow: 0 8px 20px rgba(255,152,0,0.4);
}

/* ================================
   FIELD VALIDATION
================================= */
.field-error {
    border: 2px solid #f44336 !important;
    background-color: #fff5f5 !important;
}

.field-error:focus {
    outline-color: #f44336;
}

/* ================================
   PRINT / PDF — SINGLE PAGE FIT
   Forces the entire lesson plan
   onto one A4 page with no splits.
================================= */
@page {
    size: A4 portrait;
    margin: 8mm;
}

@media print {

    /* Hide everything except the plan */
    body {
        background: white !important;
        padding: 0 !important;
        margin: 0 !important;
        color: #000 !important;
    }

    .header,
    .form-container,
    .download-buttons,
    .navbar,
    footer {
        display: none !important;
    }

    .result-container {
        box-shadow: none !important;
        padding: 0 !important;
        display: block !important;
        width: 100% !important;
    }

    /* Shrink font to fit A4 */
    .lp-wrap {
        font-size: 7.5pt !important;
        line-height: 1.15 !important;
    }

    /* Tighten cell padding at print time */
    .lp-wrap td,
    .lp-wrap th {
        padding: 2px 3px !important;
    }

    /* Prevent tables from splitting across pages */
    .lp-wrap table {
        page-break-inside: avoid !important;
        break-inside:      avoid !important;
    }

    /* Prevent individual rows from splitting */
    .lp-wrap tr {
        page-break-inside: avoid !important;
        break-inside:      avoid !important;
    }

    /* Hard lock — nothing inside .lp-wrap may split */
    .lp-wrap,
    .lp-wrap * {
        page-break-inside: avoid !important;
        break-inside:      avoid !important;
    }
}

/* ================================
   TABLET  769px – 1024px
================================= */
@media (min-width: 769px) and (max-width: 1024px) {
    .container   { max-width: 900px; }
    .header h1   { font-size: 2em; }

    .pricing-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 14px;
    }

    .pricing-card         { padding: 22px 14px 20px; }
    .pricing-card .price  { font-size: 1.9rem; }
    .pricing-card.featured { transform: scale(1.0); }
    .pricing-modal        { padding: 28px 20px 24px; }
    .pricing-header h2    { font-size: 1.5rem; }
}

/* ================================
   MOBILE  ≤ 768px
================================= */
@media (max-width: 768px) {
    body { padding: 10px; }

    .header            { padding: 25px 15px; border-radius: 12px; }
    .header h1         { font-size: 1.6em; }
    .header p          { font-size: 1em; }

    .form-container,
    .result-container  { padding: 20px 15px; border-radius: 12px; }

    .form-grid         { grid-template-columns: 1fr; gap: 15px; }

    .generate-btn,
    .premium-btn       { width: 100%; padding: 16px; font-size: 1.05em; border-radius: 14px; }

    .download-buttons  { flex-direction: column; gap: 10px; }
    .download-btn      { width: 100%; padding: 14px; }

    .modal             { padding: 10px; }
    .modal-content     { border-radius: 14px; }

    .pricing-modal     { padding: 22px 16px 20px; }

    .pricing-header h1 { font-size: 0.92rem; }
    .pricing-header h2 { font-size: 1.35rem; }
    .pricing-header p  { font-size: 0.9rem; }

    .pricing-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .pricing-card          { padding: 22px 18px 18px; }
    .pricing-card.featured {
        transform: none;
        order: -1;
    }
    .pricing-card .price   { font-size: 2rem; }

    .close { top: 10px; right: 12px; font-size: 26px; }
}

/* ================================
   SMALL PHONES  ≤ 380px
================================= */
@media (max-width: 380px) {
    .double-input      { flex-direction: column; }
    .pricing-header h2 { font-size: 1.2rem; }
    .pricing-card .price { font-size: 1.75rem; }
    .choose-btn        { font-size: 0.88rem; padding: 11px 14px; }
}