/**
 * TeacherAI Lesson Builder - V2.0 Enhanced Visual Polish
 * ENHANCEMENT: Professional aesthetic with refined interactions
 * AUTHOR: Claude 140 + Tony
 * DATE: November 20, 2025
 * 
 * ENHANCEMENTS IN V2.0:
 * - Custom checkbox styling with gradient borders on checked state
 * - Enhanced button hover states with smooth transforms
 * - Refined fusion badge with improved animation
 * - Polished selection section cards with elevated shadows
 * - Micro-interactions throughout for professional feel
 * - Improved visual hierarchy and spacing
 * 
 * FOUNDATION: Built on V4.0 functional base
 */

/* ========================================
   CSS VARIABLES
   ======================================== */
:root {
    --primary: #6366f1;
    --primary-hover: #5558e3;
    --secondary: #8b5cf6;
    --accent: #ec4899;
    --success: #10b981;
    --text-dark: #1f2937;
    --text-light: #6b7280;
    --background: #f9fafb;
    --white: #ffffff;
    --border: #e5e7eb;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --radius: 12px;
    --radius-sm: 8px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s ease;
}

/* ========================================
   CONTAINER & HEADER
   ======================================== */
.teacherai-lesson-builder {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.builder-header {
    text-align: center;
    margin-bottom: 40px;
    padding-bottom: 30px;
    border-bottom: 2px solid var(--border);
}

.builder-header h1 {
    color: var(--primary);
    font-size: 2.25rem;
    font-weight: 700;
    margin: 0 0 12px 0;
}

.builder-subtitle {
    color: var(--text-light);
    font-size: 1rem;
    margin: 0;
    line-height: 1.6;
    max-width: 700px;
    margin: 0 auto;
}

/* ========================================
   FORM STRUCTURE
   ======================================== */
.builder-form {
    background: var(--white);
    border-radius: var(--radius);
    padding: 40px;
    box-shadow: var(--shadow-lg);
}

.form-step {
    display: none;
}

.form-step.active {
    display: block;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.form-section {
    margin-bottom: 30px;
}

.form-section.compact {
    margin-bottom: 25px;
}

/* ========================================
   CONVERSATIONAL INPUT SECTION
   ======================================== */

/* Inline Teacher Name */
.form-label-inline {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1rem;
    color: var(--text-dark);
    font-weight: 500;
}

.form-input-inline {
    padding: 10px 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    transition: var(--transition);
    font-family: inherit;
    flex: 1;
    max-width: 300px;
}

.form-input-inline:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Main Description Label */
.form-label-main {
    display: block;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 12px;
}

/* Conversational Textarea */
.conversation-textarea {
    width: 100%;
    min-height: 150px;
    padding: 16px;
    font-size: 1rem;
    line-height: 1.6;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    resize: vertical;
    font-family: inherit;
    transition: var(--transition);
    background: var(--background);
}

.conversation-textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--white);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* ========================================
   EXAMPLE SELECTOR
   ======================================== */
.example-selector {
    margin-top: 15px;
}

.btn-examples {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
    border: 2px dashed var(--primary);
    color: var(--primary);
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    width: 100%;
    font-size: 1rem;
}

.btn-examples:hover {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(139, 92, 246, 0.15) 100%);
    border-color: var(--secondary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.example-list {
    margin-top: 15px;
    background: var(--white);
    border: 2px solid var(--primary);
    border-radius: var(--radius);
    padding: 20px;
    animation: slideDown 0.3s ease;
}

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

.example-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border);
}

.example-header h4 {
    color: var(--text-dark);
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
}

.btn-close-examples {
    background: transparent;
    border: none;
    color: var(--text-light);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition);
    font-family: inherit;
}

.btn-close-examples:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-dark);
}

.example-items {
    display: grid;
    gap: 12px;
}

.example-item {
    padding: 16px;
    background: var(--background);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.example-item:hover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
    transform: translateX(4px);
    box-shadow: var(--shadow-sm);
}

.example-badge {
    display: inline-block;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: var(--white);
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.example-text {
    color: var(--text-dark);
    font-size: 0.95rem;
    line-height: 1.5;
}

/* ========================================
   CONVERSATION TIPS
   ======================================== */
.conversation-tips {
    margin-top: 15px;
    padding: 16px;
    background: var(--background);
    border-radius: var(--radius-sm);
    border-left: 4px solid var(--primary);
}

.tip-header {
    color: var(--text-dark);
    font-size: 0.95rem;
    margin-bottom: 10px;
}

.tip-list {
    margin: 0;
    padding-left: 20px;
    color: var(--text-light);
    font-size: 0.9rem;
}

.tip-list li {
    margin: 6px 0;
    line-height: 1.4;
}

/* ========================================
   AI PREVIEW SECTION (STEP 2) - CHECKLIST VERSION
   ======================================== */
.preview-header {
    margin-bottom: 30px;
}

.btn-back {
    background: transparent;
    border: 2px solid var(--border);
    color: var(--text-dark);
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 15px;
    font-family: inherit;
}

.btn-back:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

.preview-header h2 {
    color: var(--primary);
    font-size: 1.8rem;
    font-weight: 600;
    margin: 10px 0 8px 0;
}

.preview-subtitle {
    color: var(--text-light);
    font-size: 1rem;
    margin: 0;
}

/* CHECKLIST/SUMMARY AESTHETIC */
.ai-plan {
    background: #ffffff;
    border: 3px solid var(--primary);
    border-left: 8px solid var(--primary);
    padding: 30px;
    border-radius: var(--radius-sm);
    margin-bottom: 30px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* Summary header */
.plan-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--border);
}

.plan-header-icon {
    font-size: 2rem;
}

.plan-header-text h3 {
    margin: 0 0 5px 0;
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--text-dark);
}

.plan-header-text p {
    margin: 0;
    color: var(--text-light);
    font-size: 0.95rem;
}

/* Summary sections */
.plan-section {
    margin-bottom: 25px;
}

.plan-section:last-child {
    margin-bottom: 0;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.section-icon {
    font-size: 1.3rem;
}

.section-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-dark);
    margin: 0;
}

.section-content {
    color: var(--text-dark);
    line-height: 1.6;
    font-size: 0.95rem;
}

.section-list {
    margin: 8px 0 0 0;
    padding-left: 20px;
}

.section-list li {
    margin: 6px 0;
    color: var(--text-dark);
}

/* Standards display */
.standards-grid {
    display: grid;
    gap: 10px;
    margin-top: 12px;
}

.standard-item {
    background: var(--background);
    padding: 12px;
    border-radius: var(--radius-sm);
    border-left: 4px solid var(--primary);
}

.standard-code {
    font-weight: 600;
    color: var(--primary);
    font-size: 0.9rem;
    margin-bottom: 4px;
}

.standard-description {
    color: var(--text-dark);
    font-size: 0.9rem;
    line-height: 1.5;
}

/* Materials list */
.materials-list {
    margin: 12px 0 0 0;
    padding-left: 0;
    list-style: none;
}

.materials-list li {
    padding: 8px 12px;
    margin: 6px 0;
    background: var(--background);
    border-left: 4px solid var(--success);
    border-radius: var(--radius-sm);
    color: var(--text-dark);
}

/* Time estimate badge */
.time-estimate {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: var(--white);
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9rem;
}

.time-saver-message {
    color: var(--text-light);
    font-size: 0.95rem;
    font-style: italic;
    margin-top: 20px;
}

/* ========================================
   BUTTONS
   ======================================== */
.form-actions {
    margin-top: 30px;
    display: flex;
    gap: 15px;
    justify-content: flex-end;
}

.preview-actions {
    justify-content: space-between;
}

.btn {
    padding: 14px 28px;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    font-family: inherit;
}

.btn-large {
    padding: 16px 32px;
    font-size: 1rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: var(--white);
    box-shadow: var(--shadow-md);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-secondary {
    background: transparent;
    border: 2px solid var(--border);
    color: var(--text-dark);
}

.btn-secondary:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

/* ========================================
   TOAST NOTIFICATIONS
   ======================================== */
#toast-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 9999;
}

.toast-notification {
    background: var(--white);
    border: 2px solid var(--success);
    border-radius: var(--radius-sm);
    padding: 16px 20px;
    box-shadow: var(--shadow-lg);
    margin-top: 10px;
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.3s ease;
    max-width: 350px;
}

.toast-notification.show {
    opacity: 1;
    transform: translateX(0);
}

/* ========================================
   SUPPLY CLOSET MATERIAL STYLING
   ======================================== */

.supply-closet-item {
    background: linear-gradient(90deg, #f0f4ff 0%, #ffffff 100%);
    padding: 8px 12px;
    margin: 4px 0;
    border-left: 4px solid #667eea;
    border-radius: 4px;
}

.supply-tag {
    background: #667eea;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    margin-right: 8px;
}

.basic-item {
    padding: 8px 12px;
    margin: 4px 0;
    color: #4a5568;
}

/* ========================================
   V2.0 ENHANCED - GRADE/SUBJECT SELECTORS
   ======================================== */

/* Selection Section Container - Enhanced Card */
.selection-section {
    background: linear-gradient(to bottom, #ffffff, #f7fafc);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    border: 2px solid #e2e8f0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    transition: var(--transition);
}

.selection-section:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.selection-label {
    font-size: 16px;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 14px;
    display: block;
}

/* Checkbox Grid Layout */
.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 10px;
}

/* Individual Checkbox Items - ENHANCED */
.checkbox-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: white;
    border: 2px solid #cbd5e0;
    border-radius: 10px;
    cursor: pointer;
    transition: var(--transition);
    overflow: hidden;
}

/* Subtle gradient overlay on hover */
.checkbox-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05) 0%, rgba(139, 92, 246, 0.05) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.checkbox-item:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(99, 102, 241, 0.15);
}

.checkbox-item:hover::before {
    opacity: 1;
}

/* Custom checkbox styling */
.checkbox-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--primary);
    transition: transform 0.2s ease;
}

.checkbox-item input[type="checkbox"]:checked {
    transform: scale(1.1);
}

/* CHECKED STATE - Enhanced with gradient border */
.checkbox-item.checked {
    border: 2px solid transparent;
    background: linear-gradient(white, white) padding-box,
                linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%) border-box;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
    transform: translateY(-2px);
}

.checkbox-item.checked::before {
    opacity: 1;
}

.checkbox-item.checked label {
    color: var(--primary);
    font-weight: 600;
}

.checkbox-item label {
    cursor: pointer;
    font-weight: 500;
    color: #2d3748;
    margin: 0;
    user-select: none;
    flex: 1;
    transition: var(--transition-fast);
}

.selection-hint {
    font-size: 13px;
    color: #718096;
    font-style: italic;
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ========================================
   V2.0 ENHANCED - FUSION BADGE
   ======================================== */

.fusion-badge {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 24px;
    border-radius: 14px;
    margin: 24px 0;
    display: none;
    animation: fusionEntrance 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
    position: relative;
    overflow: hidden;
}

/* Animated shimmer effect */
.fusion-badge::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

.fusion-badge.active {
    display: block;
}

@keyframes fusionEntrance {
    0% {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    60% {
        transform: scale(1.02) translateY(0);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.fusion-badge-header {
    font-size: 21px;
    font-weight: 700;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
    z-index: 1;
}

.fusion-badge-content {
    font-size: 14px;
    line-height: 1.7;
    position: relative;
    z-index: 1;
}

.fusion-badge-content ul {
    margin: 12px 0 0 0;
    padding-left: 20px;
}

.fusion-badge-content li {
    margin: 8px 0;
}

.fusion-pulse {
    display: inline-block;
    animation: fusionPulse 2s ease-in-out infinite;
}

@keyframes fusionPulse {
    0%, 100% { 
        transform: scale(1); 
        filter: brightness(1);
    }
    50% { 
        transform: scale(1.15); 
        filter: brightness(1.2);
    }
}

/* ========================================
   V2.0 ENHANCED - SELECTION WARNING
   ======================================== */

.selection-warning {
    background: linear-gradient(to right, #fff5e6, #ffffff);
    border: 2px solid #ff9800;
    border-left: 6px solid #ff9800;
    border-radius: 10px;
    padding: 18px;
    margin: 18px 0;
    display: none;
    animation: warningEntrance 0.4s ease-out;
    box-shadow: 0 2px 8px rgba(255, 152, 0, 0.15);
}

.selection-warning.active {
    display: block;
}

@keyframes warningEntrance {
    0% {
        opacity: 0;
        transform: translateX(-20px);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

.warning-icon {
    font-size: 20px;
    font-weight: 700;
    color: #ff9800;
    margin-bottom: 8px;
    display: inline-block;
    animation: warningPulse 2s ease-in-out infinite;
}

@keyframes warningPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.warning-text {
    font-size: 14px;
    color: #663c00;
    line-height: 1.6;
}

/* ========================================
   MOBILE RESPONSIVE
   ======================================== */
@media (max-width: 768px) {
    .teacherai-lesson-builder {
        padding: 15px;
    }
    
    .builder-header h1 {
        font-size: 1.5rem;
    }
    
    .builder-subtitle {
        font-size: 0.9rem;
    }
    
    .builder-form {
        padding: 25px;
    }
    
    .conversation-textarea {
        min-height: 120px;
        font-size: 0.95rem;
    }
    
    .example-items {
        gap: 10px;
    }
    
    .example-item {
        padding: 14px;
    }
    
    .example-text {
        font-size: 0.9rem;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .preview-actions {
        flex-direction: column-reverse;
    }
    
    .btn {
        width: 100%;
    }
    
    #toast-container {
        bottom: 20px;
        right: 20px;
        left: 20px;
    }
    
    .toast-notification {
        max-width: 100%;
    }
    
    /* V2.0 Mobile Adjustments */
    .checkbox-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .selection-section {
        padding: 18px;
    }
    
    .fusion-badge {
        padding: 18px;
    }
    
    .fusion-badge-header {
        font-size: 18px;
    }
}

@media (max-width: 480px) {
    .builder-form {
        padding: 20px;
    }
    
    .form-label-inline {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .form-input-inline {
        max-width: 100%;
    }
    
    /* V2.0 Mobile Adjustments */
    .checkbox-grid {
        grid-template-columns: 1fr;
    }
    
    .checkbox-item {
        padding: 10px 12px;
    }
}
