/* AI Lesson Generator - v5.0 Studio & High-Accessibility Styling */
.ailg-frontend-container {
    max-width: 960px;
    margin: 24px auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: #1e293b;
    font-size: 16px;
    line-height: 1.55;
}

.ailg-header-banner {
    background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 60%, #0284c7 100%);
    color: #fff;
    padding: 26px 32px;
    border-radius: 12px;
    margin-bottom: 26px;
    box-shadow: 0 6px 20px rgba(15, 23, 42, 0.18);
}
.ailg-header-top-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}
.ailg-header-banner h2 {
    margin: 0 0 8px 0;
    color: #fff;
    font-size: 28px;
    font-weight: 800;
}
.ailg-header-banner p {
    margin: 0;
    opacity: 0.94;
    font-size: 16px;
}

/* Signed-in User Badge & Top Controls */
.ailg-user-badge-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    background: rgba(255, 255, 255, 0.12);
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.22);
}
.ailg-user-info-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #fff;
    font-size: 15px;
}
.ailg-user-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #4ade80;
    display: inline-block;
    box-shadow: 0 0 8px #4ade80;
}
.ailg-btn-header-pill {
    background: #38bdf8;
    color: #0f172a;
    padding: 8px 14px;
    font-size: 14px;
    font-weight: 700;
    border-radius: 6px;
}
.ailg-btn-header-pill:hover {
    background: #7dd3fc;
    color: #0f172a;
}
.ailg-btn-header-logout {
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
    padding: 8px 12px;
    font-size: 14px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 6px;
}
.ailg-btn-header-logout:hover {
    background: rgba(239, 68, 68, 0.85);
    border-color: transparent;
    color: #fff;
}

/* Authentication Gate Card */
.ailg-auth-container {
    max-width: 640px;
    margin: 0 auto 28px auto;
}
.ailg-auth-header {
    text-align: center;
    margin-bottom: 20px;
}
.ailg-google-auth-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 18px;
}
.ailg-google-btn-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 14px;
}
.ailg-auth-or-divider {
    width: 100%;
    text-align: center;
    border-bottom: 1px solid #cbd5e1;
    line-height: 0.1em;
    margin: 12px 0 18px 0;
}
.ailg-auth-or-divider span {
    background: #fff;
    padding: 0 12px;
    color: #64748b;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.05em;
}
.ailg-auth-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 22px;
    background: #f1f5f9;
    padding: 6px;
    border-radius: 8px;
}
.ailg-auth-tab {
    flex: 1;
    padding: 12px 16px;
    font-size: 16px;
    font-weight: 700;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s;
}
.ailg-auth-tab.active {
    background: #fff;
    color: #0284c7;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08);
}
.ailg-auth-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* Persistent Frontend User History Table */
.ailg-user-history-table-wrap {
    overflow-x: auto;
    margin-top: 12px;
}
.ailg-history-frontend-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 15px;
}
.ailg-history-frontend-table th {
    background: #f1f5f9;
    color: #1e293b;
    font-weight: 700;
    text-align: left;
    padding: 12px 14px;
    border-bottom: 2px solid #cbd5e1;
}
.ailg-history-frontend-table td {
    padding: 14px;
    border-bottom: 1px solid #e2e8f0;
    vertical-align: middle;
}

.ailg-card {
    background: #fff;
    border-radius: 10px;
    padding: 30px 34px;
    box-shadow: 0 3px 14px rgba(0, 0, 0, 0.08);
    border: 1px solid #cbd5e1;
    margin-bottom: 26px;
}
.ailg-card h3 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #0f172a;
    font-size: 22px;
    font-weight: 800;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 12px;
}

.ailg-form-group {
    margin-bottom: 24px;
}
.ailg-label {
    display: block;
    font-weight: 700;
    margin-bottom: 8px;
    color: #0f172a;
    font-size: 17px;
}
.ailg-input, .ailg-select, .ailg-textarea, .ailg-file-input {
    width: 100%;
    padding: 13px 16px;
    border: 2px solid #94a3b8;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    color: #0f172a;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #fff;
    box-sizing: border-box;
}
.ailg-input:focus, .ailg-select:focus, .ailg-textarea:focus {
    border-color: #0284c7;
    outline: none;
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.18);
}

.ailg-radio-cards {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}
.ailg-radio-cards-3 .radio-card {
    min-width: 220px;
}
.radio-card {
    flex: 1;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 18px;
    border: 2px solid #cbd5e1;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    background: #f8fafc;
}
.radio-card input[type="radio"] {
    margin-top: 5px;
    transform: scale(1.25);
    cursor: pointer;
}
.radio-card:hover {
    border-color: #64748b;
}
.radio-card.active {
    border-color: #0284c7;
    background: #e0f2fe;
}
.radio-card span {
    font-size: 16px;
    line-height: 1.45;
    color: #0f172a;
}
.radio-card small {
    color: #334155;
    font-size: 14px;
}

.ailg-divider {
    border: 0;
    height: 2px;
    background: #e2e8f0;
    margin: 30px 0;
}

.ailg-help-text {
    color: #334155;
    font-size: 14px;
    line-height: 1.5;
    display: block;
    margin-top: 6px;
}

.ailg-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 26px;
    font-size: 17px;
    font-weight: 700;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: transform 0.1s, background-color 0.2s, box-shadow 0.2s;
    text-decoration: none;
}
.ailg-btn:active {
    transform: scale(0.98);
}
.ailg-btn-primary {
    background-color: #0284c7;
    color: #fff;
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.3);
}
.ailg-btn-primary:hover {
    background-color: #0369a1;
    color: #fff;
}
.ailg-btn-success {
    background-color: #16a34a;
    color: #fff;
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.3);
}
.ailg-btn-success:hover {
    background-color: #15803d;
    color: #fff;
}
.ailg-btn-secondary {
    background-color: #e2e8f0;
    color: #0f172a;
}
.ailg-btn-secondary:hover {
    background-color: #cbd5e1;
}
.ailg-btn-outline {
    background: transparent;
    border: 2px solid #94a3b8;
    color: #1e293b;
    padding: 9px 18px;
    font-size: 15px;
}
.ailg-btn-outline:hover {
    background: #f1f5f9;
}
.ailg-btn-download {
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
    color: #fff;
    font-size: 19px;
    padding: 16px 32px;
    margin-top: 10px;
    box-shadow: 0 4px 14px rgba(21, 128, 61, 0.4);
}

.ailg-submit-wrapper {
    margin-top: 26px;
    text-align: right;
}
.ailg-status-text {
    margin-top: 16px;
    font-weight: 700;
    font-size: 16px;
    text-align: center;
}

/* Step 2 Timeline Editor */
.step-header-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 12px;
    margin-bottom: 16px;
}
.step-header-flex h3 {
    border-bottom: none;
    padding-bottom: 0;
    margin: 0;
}

.timeline-container {
    margin: 20px 0;
    max-height: 680px;
    overflow-y: auto;
    padding-right: 8px;
}
.timeline-block-card {
    background: #f8fafc;
    border: 2px solid #cbd5e1;
    border-radius: 10px;
    margin-bottom: 20px;
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}
.block-card-header {
    background: #e2e8f0;
    padding: 12px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    border-bottom: 1px solid #cbd5e1;
}
.block-card-header h4 {
    margin: 0;
    font-size: 17px;
    font-weight: 800;
    color: #0f172a;
}
.block-controls {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
    font-size: 14px;
}
.block-flag-select {
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid #94a3b8;
    font-size: 14px;
    font-weight: 600;
    background: #fff;
}
.btn-remove-block {
    background: #fee2e2;
    border: 1px solid #fca5a5;
    border-radius: 6px;
    padding: 2px 10px;
    cursor: pointer;
    font-size: 18px;
    font-weight: 700;
    color: #dc2626;
}
.block-card-body {
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.block-script-area label, .block-slides-area label {
    display: block;
    font-size: 15px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 6px;
}
.block-script-text, .block-slides-text {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid #94a3b8;
    border-radius: 6px;
    font-size: 16px;
    line-height: 1.5;
    font-family: inherit;
    box-sizing: border-box;
}

.timeline-actions-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 25px;
    border-top: 2px solid #e2e8f0;
    padding-top: 20px;
}

/* Step 3 Dashboard */
.ailg-progress-container {
    background: #e2e8f0;
    border-radius: 20px;
    height: 28px;
    width: 100%;
    margin: 30px 0 12px 0;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.08);
}
.ailg-progress-fill {
    background: linear-gradient(90deg, #0284c7, #16a34a);
    height: 100%;
    border-radius: 20px;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
.progress-stats {
    display: flex;
    justify-content: space-between;
    font-weight: 700;
    font-size: 16px;
    color: #1e293b;
    margin-bottom: 25px;
}
.ailg-step-box {
    background: #e0f2fe;
    border: 2px solid #7dd3fc;
    color: #0369a1;
    padding: 18px 22px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 17px;
    box-shadow: 0 2px 6px rgba(2, 132, 199, 0.12);
}
.success-icon {
    font-size: 52px;
    margin-bottom: 10px;
}

@media (max-width: 680px) {
    .ailg-radio-cards, .ailg-auth-grid-2 {
        flex-direction: column;
        grid-template-columns: 1fr;
    }
    .timeline-actions-footer {
        flex-direction: column;
        gap: 15px;
    }
    .ailg-btn {
        width: 100%;
    }
}
