/**
 * Student Engagement Plugin - Frontend Shortcode Styles
 * Colorful interfaces for teachers and students on the frontend
 */

/* ============================================================================
   COMMON FRONTEND STYLES
   ============================================================================ */

.se-frontend-dashboard {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
}

.se-dashboard-header {
    text-align: center;
    margin-bottom: 48px;
}

.se-dashboard-title {
    font-size: 3rem;
    font-weight: 900;
    margin-bottom: 12px;
    line-height: 1.2;
}

.se-dashboard-subtitle {
    font-size: 1.25rem;
    color: #64748b;
    margin: 0;
}

.se-teacher-dashboard .se-dashboard-subtitle {
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.se-section-title {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 24px;
    padding-bottom: 12px;
    border-bottom: 4px solid;
}

/* Frontend Notices */
.se-frontend-notice {
    padding: 20px 24px;
    border-radius: 16px;
    margin: 24px 0;
    font-size: 1.125rem;
    font-weight: 600;
    border-left: 6px solid;
}

.se-notice-error {
    background: rgba(239, 68, 68, 0.1);
    border-color: #ef4444;
    color: #991b1b;
}

.se-notice-info {
    background: rgba(59, 130, 246, 0.1);
    border-color: #3b82f6;
    color: #1e3a8a;
}

/* Empty State */
.se-empty-state {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.se-empty-icon {
    font-size: 4rem;
    margin-bottom: 16px;
}

.se-empty-state p {
    font-size: 1.25rem;
    color: #64748b;
    margin-bottom: 24px;
}

/* ============================================================================
   TEACHER DASHBOARD STYLES (Blue/Purple Theme)
   ============================================================================ */

.se-teacher-dashboard {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 24px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

.se-teacher-dashboard .se-dashboard-title {
    color: white;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.se-teacher-dashboard .se-section-title {
    color: white;
    border-color: rgba(255, 255, 255, 0.3);
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Dashboard Actions */
.se-dashboard-actions {
    text-align: center;
    margin: 32px 0;
}

.se-teacher-dashboard .se-btn-primary {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    border: none;
    font-weight: 700;
    font-size: 1.125rem;
    padding: 16px 32px;
    border-radius: 16px;
    box-shadow: 0 8px 20px rgba(245, 87, 108, 0.4);
    transition: all 0.3s ease;
    cursor: pointer;
}

.se-teacher-dashboard .se-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(245, 87, 108, 0.5);
}

/* Create Task Container */
.se-create-task-container {
    margin: 32px 0;
    animation: slideDown 0.3s ease;
}

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

/* Frontend Forms */
.se-frontend-form .se-form-group {
    margin-bottom: 24px;
}

.se-frontend-form .se-form-label {
    display: block;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 8px;
    font-size: 1rem;
}

.se-frontend-form .se-form-input,
.se-frontend-form .se-form-textarea,
.se-frontend-form .se-form-select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.se-frontend-form .se-form-input:focus,
.se-frontend-form .se-form-textarea:focus,
.se-frontend-form .se-form-select:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.se-frontend-form .se-form-textarea {
    min-height: 120px;
    resize: vertical;
}

.se-frontend-form .se-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.se-frontend-form .se-form-actions {
    display: flex;
    gap: 12px;
    margin-top: 32px;
}

.se-frontend-form .se-form-message {
    margin-top: 20px;
    padding: 16px 20px;
    border-radius: 12px;
    font-weight: 600;
}

.se-frontend-form .se-form-message.se-success {
    background: rgba(16, 185, 129, 0.1);
    border: 2px solid #10b981;
    color: #065f46;
}

.se-frontend-form .se-form-message.se-error {
    background: rgba(239, 68, 68, 0.1);
    border: 2px solid #ef4444;
    color: #991b1b;
}

/* Tasks Section */
.se-tasks-section {
    margin: 48px 0;
}

.se-tasks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 24px;
}

/* Task Cards */
.se-task-card {
    background: white;
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    border: 3px solid transparent;
    transition: all 0.3s ease;
}

.se-teacher-dashboard .se-task-card:hover {
    border-color: #2563eb;
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(37, 99, 235, 0.2);
}

.se-task-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
    gap: 12px;
}

.se-task-card-title {
    font-size: 1.5rem;
    font-weight: 800;
    margin: 0;
    color: #1e293b;
    flex: 1;
}

.se-task-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}

.se-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.875rem;
    color: #64748b;
    font-weight: 600;
}

.se-task-card-content {
    color: #475569;
    line-height: 1.6;
    margin-bottom: 20px;
}

.se-task-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

/* ============================================================================
   STUDENT DASHBOARD STYLES (Cyan/Pink Theme)
   ============================================================================ */

.se-student-dashboard {
    background: linear-gradient(135deg, #f0f9ff 0%, #fce7f3 100%);
    border-radius: 24px;
}

.se-student-dashboard .se-dashboard-title {
    background: linear-gradient(135deg, #06b6d4 0%, #ec4899 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.se-student-dashboard .se-section-title {
    background: linear-gradient(135deg, #06b6d4 0%, #ec4899 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    border-color: #06b6d4;
}

.se-student-dashboard .se-task-card:hover {
    border-color: #06b6d4;
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(6, 182, 212, 0.2);
}

.se-task-completed {
    opacity: 0.8;
}

.se-task-completed .se-task-card-header {
    position: relative;
}

/* Course Sections */
.se-course-section {
    margin-bottom: 48px;
}

.se-course-title {
    font-size: 1.75rem;
    font-weight: 800;
    margin-bottom: 20px;
    color: #1e293b;
}

/* Submissions Section */
.se-submissions-section {
    margin: 48px 0;
}

.se-submissions-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.se-submission-item {
    background: white;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
}

.se-submission-item:hover {
    transform: translateX(8px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

.se-submission-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.se-submission-header h4 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: #1e293b;
}

.se-submission-date {
    color: #64748b;
    font-size: 0.875rem;
    font-weight: 600;
}

.se-submission-meta {
    display: flex;
    gap: 16px;
}

/* ============================================================================
   MY SUBMISSIONS PAGE
   ============================================================================ */

.se-my-submissions-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

.se-submissions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 24px;
}

.se-submission-card {
    background: white;
    border-radius: 20px;
    padding: 28px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    border: 3px solid transparent;
    transition: all 0.3s ease;
}

.se-submission-card:hover {
    border-color: #06b6d4;
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(6, 182, 212, 0.2);
}

.se-submission-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
    gap: 12px;
}

.se-submission-card-header h3 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 800;
    color: #1e293b;
}

.se-submission-card-meta {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid #e2e8f0;
}

.se-submission-card-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.se-stat-item {
    text-align: center;
    padding: 16px;
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.1), rgba(236, 72, 153, 0.1));
    border-radius: 12px;
}

.se-stat-item .se-stat-value {
    font-size: 2rem;
    font-weight: 900;
    background: linear-gradient(135deg, #06b6d4, #ec4899);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.se-stat-item .se-stat-label {
    font-size: 0.875rem;
    color: #64748b;
    font-weight: 600;
    margin-top: 4px;
}

.se-submission-feedback {
    background: rgba(6, 182, 212, 0.05);
    border-left: 4px solid #06b6d4;
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 16px;
}

.se-submission-feedback h4 {
    margin: 0 0 12px 0;
    font-size: 1.125rem;
    font-weight: 700;
    color: #0e7490;
}

.se-submission-feedback p {
    margin: 0;
    line-height: 1.6;
    color: #334155;
}

.se-submission-badges {
    margin-top: 16px;
}

.se-submission-badges h4 {
    margin: 0 0 12px 0;
    font-size: 1.125rem;
    font-weight: 700;
    color: #1e293b;
}

/* ============================================================================
   LEADERBOARD
   ============================================================================ */

.se-leaderboard-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 40px 20px;
}

.se-leaderboard-wrapper {
    background: white;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.se-leaderboard {
    width: 100%;
    border-collapse: collapse;
}

.se-leaderboard thead {
    background: linear-gradient(135deg, #06b6d4 0%, #ec4899 100%);
}

.se-leaderboard thead th {
    color: white;
    font-weight: 800;
    padding: 20px;
    text-align: left;
    font-size: 1.125rem;
}

.se-leaderboard tbody tr {
    border-bottom: 2px solid #e2e8f0;
    transition: all 0.2s ease;
}

.se-leaderboard tbody tr:hover {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.05), rgba(236, 72, 153, 0.05));
}

.se-leaderboard tbody td {
    padding: 20px;
    font-size: 1rem;
}

/* ============================================================================
   RESPONSIVE DESIGN
   ============================================================================ */

@media (max-width: 768px) {
    .se-frontend-dashboard {
        padding: 24px 16px;
    }
    
    .se-dashboard-title {
        font-size: 2rem;
    }
    
    .se-section-title {
        font-size: 1.5rem;
    }
    
    .se-tasks-grid,
    .se-submissions-grid {
        grid-template-columns: 1fr;
    }
    
    .se-frontend-form .se-form-row {
        grid-template-columns: 1fr;
    }
    
    .se-task-card-actions {
        flex-direction: column;
    }
    
    .se-task-card-actions .se-btn {
        width: 100%;
    }
    
    .se-submission-header {
        flex-direction: column;
        gap: 8px;
    }
    
    .se-leaderboard {
        font-size: 0.875rem;
    }
    
    .se-leaderboard th,
    .se-leaderboard td {
        padding: 12px 8px;
    }
}

/* ============================================================================
   UTILITY CLASSES
   ============================================================================ */

.se-btn-block {
    width: 100%;
    text-align: center;
}

.se-badge-success {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(5, 150, 105, 0.2));
    color: #065f46;
    border: 2px solid #10b981;
}

/* ============================================================================
   COMPREHENSIVE FORM STYLES
   ============================================================================ */

/* Form Sections */
.se-form-section {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border: 2px solid #e2e8f0;
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
    transition: all 0.3s ease;
}

.se-form-section:hover {
    border-color: #667eea;
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.15);
    transform: translateY(-2px);
}

.se-form-section-title {
    font-size: 1.5rem;
    font-weight: 800;
    margin: 0 0 20px 0;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 12px;
    border-bottom: 3px solid #e2e8f0;
}

/* Form Help Text */
.se-form-help {
    display: block;
    font-size: 0.875rem;
    color: #64748b;
    margin-top: 6px;
    font-style: italic;
}

/* Input with Button */
.se-input-with-button {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.se-input-with-button .se-form-input {
    flex: 1;
}

.se-input-with-button .se-btn-small {
    padding: 8px 16px;
    font-size: 0.875rem;
    white-space: nowrap;
}

/* Checkbox Labels */
.se-form-label input[type="checkbox"] {
    margin-right: 8px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* AI Options Nested Section */
#ai-options {
    background: linear-gradient(135deg, #f0f4ff 0%, #ffffff 100%);
    border-radius: 12px;
    padding: 20px;
    margin-top: 16px;
}

#ai-options strong {
    color: #667eea;
    font-size: 1.1rem;
    display: block;
    margin-bottom: 12px;
}

#ai-options label {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    background: white;
    border-radius: 8px;
    margin: 8px 0;
    cursor: pointer;
    transition: all 0.2s ease;
}

#ai-options label:hover {
    background: #f8faff;
    transform: translateX(4px);
}

#ai-options input[type="checkbox"] {
    margin-right: 12px;
    width: 20px;
    height: 20px;
}

/* Rubric Section (conditional) */
#rubric-section {
    margin-top: 16px;
    padding: 16px;
    background: linear-gradient(135deg, #fff7ed 0%, #ffffff 100%);
    border: 2px dashed #fb923c;
    border-radius: 12px;
}

#rubric-section .se-form-label {
    color: #ea580c;
    font-weight: 700;
}

/* Form Actions Enhancement */
.se-form-actions {
    display: flex;
    gap: 12px;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 2px solid #e2e8f0;
}

.se-form-actions .se-btn {
    flex: 1;
    max-width: 200px;
}

/* Form Message Enhancement */
.se-form-message {
    margin-top: 20px;
    padding: 16px 20px;
    border-radius: 12px;
    font-weight: 600;
    text-align: center;
    animation: slideDown 0.3s ease;
}

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

.se-form-message.se-success {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: #065f46;
    border: 2px solid #10b981;
}

.se-form-message.se-error {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #991b1b;
    border: 2px solid #ef4444;
}

/* Responsive Form Sections */
@media (max-width: 768px) {
    .se-form-section {
        padding: 16px;
    }
    
    .se-form-section-title {
        font-size: 1.25rem;
    }
    
    .se-input-with-button {
        flex-direction: column;
    }
    
    .se-input-with-button .se-btn-small {
        width: 100%;
    }
    
    .se-form-actions {
        flex-direction: column;
    }
    
    .se-form-actions .se-btn {
        max-width: 100%;
    }
}

/* Enhanced Button Styles for Form */
.se-btn-small {
    font-size: 0.875rem;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.se-btn-small:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Section Spacing */
.se-form-section + .se-form-section {
    margin-top: 24px;
}

/* Collapsible Sections (for future enhancement) */
.se-form-section.collapsed {
    padding: 16px 24px;
}

.se-form-section.collapsed .se-form-section-title {
    margin-bottom: 0;
    border-bottom: none;
    cursor: pointer;
}

.se-form-section.collapsed .se-form-section-title::after {
    content: "▼";
    margin-left: auto;
    font-size: 0.875rem;
    transition: transform 0.3s ease;
}

.se-form-section.expanded .se-form-section-title::after {
    transform: rotate(180deg);
}

/* ============================================================================
   ONE-TIME CODES PANEL
   ============================================================================ */

.se-codes-panel {
    margin-top: 20px;
    padding: 20px;
    background: linear-gradient(135deg, #fef3c7 0%, #fef9e7 100%);
    border: 2px solid #f59e0b;
    border-radius: 12px;
    animation: slideDown 0.3s ease;
}

.se-codes-panel-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: #92400e;
    margin: 0 0 8px 0;
}

.se-codes-panel-desc {
    font-size: 0.875rem;
    color: #78350f;
    margin: 0 0 16px 0;
}

.se-codes-generate {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding: 16px;
    background: white;
    border-radius: 8px;
    border: 2px solid #fbbf24;
}

.se-codes-generate label {
    font-weight: 600;
    color: #92400e;
    margin: 0;
}

.se-codes-generate input[type="number"] {
    width: 100px;
    padding: 8px 12px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1rem;
}

.se-codes-generate input[type="number"]:focus {
    outline: none;
    border-color: #f59e0b;
}

.se-codes-status {
    font-weight: 600;
    font-size: 0.875rem;
    margin-left: 8px;
}

.se-codes-list {
    background: white;
    border-radius: 8px;
    padding: 16px;
    max-height: 400px;
    overflow-y: auto;
}

/* Codes Table Styling */
.se-codes-list table {
    width: 100%;
    border-collapse: collapse;
}

.se-codes-list th {
    background: linear-gradient(135deg, #f59e0b 0%, #f97316 100%);
    color: white;
    padding: 12px;
    text-align: left;
    font-weight: 700;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.se-codes-list td {
    padding: 12px;
    border-bottom: 1px solid #e5e7eb;
    font-size: 0.875rem;
}

.se-codes-list tr:hover {
    background: #fef9e7;
}

.se-codes-list .code-used {
    color: #16a34a;
    font-weight: 600;
}

.se-codes-list .code-unused {
    color: #3b82f6;
    font-weight: 600;
}

.se-codes-list code {
    background: #f3f4f6;
    padding: 4px 8px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-weight: 700;
    color: #1f2937;
    font-size: 0.9rem;
}

/* Empty state for codes */
.se-codes-empty {
    text-align: center;
    padding: 32px;
    color: #78350f;
    font-style: italic;
}

/* Responsive codes panel */
@media (max-width: 768px) {
    .se-codes-generate {
        flex-direction: column;
        align-items: stretch;
    }
    
    .se-codes-generate input[type="number"],
    .se-codes-generate button {
        width: 100%;
    }
    
    .se-codes-list {
        overflow-x: auto;
    }
    
    .se-codes-list table {
        min-width: 500px;
    }
}

/* Animation for panel appearance */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Delete/Danger Button */
.se-btn-danger {
    background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);
    color: white;
    border: none;
}

.se-btn-danger:hover {
    background: linear-gradient(135deg, #b91c1c 0%, #7f1d1d 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(220, 38, 38, 0.3);
}
