/* ========================================
   Admin Panel CSS - Lesson Generator
   ======================================== */

/* ========================================
   Navigation Layout - Applied to pages with sidebar
   Only activates when body has 'has-admin-nav' class (added by nav.js)
   ======================================== */
body.has-admin-nav {
    padding: 0 !important;
    padding-left: 240px !important;
}

/* Container adjustments for sidebar layout */
body.has-admin-nav .container {
    max-width: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}

/* Hide legacy header (replaced by sidebar) */
body.has-admin-nav header {
    display: none !important;
}

/* Mobile responsive */
@media (max-width: 768px) {
    body.has-admin-nav {
        padding-left: 0 !important;
        padding-bottom: 5rem !important;
    }
}

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #333;
    min-height: 100vh;
    padding: 2rem;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

/* Header */
header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem;
    text-align: center;
    position: relative;
}

header h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

header p {
    opacity: 0.9;
    font-size: 1rem;
}

.btn-back {
    position: absolute;
    top: 2rem;
    left: 2rem;
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    transition: all 0.3s;
}

.btn-back:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateX(-3px);
}

/* Main Content */
main {
    padding: 2rem;
}

/* Card Grid */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.card {
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    transition: all 0.3s;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border-color: #667eea;
}

.card-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.card h2 {
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
    color: #667eea;
}

.card p {
    color: #6b7280;
    margin-bottom: 1rem;
    line-height: 1.5;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #e5e7eb;
    color: #374151;
}

.btn-secondary:hover:not(:disabled) {
    background: #d1d5db;
}

.btn-danger {
    background: #ef4444;
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: #dc2626;
}

.btn-warning {
    background: #f59e0b;
    color: white;
}

.btn-warning:hover:not(:disabled) {
    background: #d97706;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(245, 158, 11, 0.4);
}

.btn-edit {
    background: #667eea;
    color: white;
}

.btn-edit:hover:not(:disabled) {
    background: #5a67d8;
}

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

.btn-small {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
    margin-right: 0.3rem;
}

/* Stats Section */
.stats-section {
    margin-top: 2rem;
    padding: 1.5rem;
    background: #f9fafb;
    border-radius: 12px;
}

.stats-section h3 {
    margin-bottom: 1rem;
    color: #667eea;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.stat-card {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
    border: 2px solid #e5e7eb;
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: #667eea;
}

.stat-label {
    font-size: 0.9rem;
    color: #6b7280;
    margin-top: 0.3rem;
}

/* Upload Section */
.upload-section {
    max-width: 600px;
    margin: 0 auto;
}

/* Compact Upload Layout */
.upload-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    max-width: 800px;
    margin: 0 auto;
}

.upload-left,
.upload-right {
    display: flex;
    flex-direction: column;
}

.drop-zone-compact {
    padding: 1.5rem 1rem;
    margin-bottom: 1rem;
}

.drop-zone-compact .drop-zone-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.drop-zone-compact .drop-zone-icon i {
    color: #667eea;
}

.drop-zone-compact .drop-zone-text {
    font-size: 1rem;
    margin-bottom: 0.3rem;
}

.drop-zone-compact .drop-zone-subtext {
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}

.requirements-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    font-size: 0.7rem;
    color: #6b7280;
    margin-top: 0.75rem;
    justify-content: center;
}

.requirements-inline span {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    background: rgba(102, 126, 234, 0.1);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
}

.requirements-inline i {
    color: #667eea;
    font-size: 0.65rem;
}

/* File Card (replaces drop-zone when file selected) */
.file-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    border: 2px solid #10b981;
    border-radius: 12px;
}

.file-card-icon {
    font-size: 2rem;
    color: #059669;
    flex-shrink: 0;
}

.file-card-info {
    flex: 1;
    min-width: 0;
}

.file-card-name {
    font-weight: 600;
    color: #065f46;
    font-size: 0.95rem;
    margin: 0 0 0.25rem 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-card-meta {
    font-size: 0.8rem;
    color: #047857;
    margin: 0;
}

.file-card .btn-small {
    flex-shrink: 0;
}

.settings-compact {
    padding: 1rem;
    margin-bottom: 0;
}

.settings-compact h3 {
    display: none;
}

.form-row-inline {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.settings-compact .form-group {
    margin-bottom: 0.5rem;
}

.settings-compact .form-group label {
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
}

.settings-compact .form-control {
    padding: 0.5rem;
    font-size: 0.9rem;
}

.settings-compact .form-help {
    font-size: 0.75rem;
    margin-bottom: 0.75rem;
}

.checkbox-inline {
    margin-bottom: 0.75rem !important;
}

.checkbox-inline label {
    display: flex !important;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem !important;
    cursor: pointer;
}

.btn-block {
    width: 100%;
    display: block;
}

@media (max-width: 768px) {
    .upload-layout {
        grid-template-columns: 1fr;
    }
}

.drop-zone {
    border: 3px dashed #d1d5db;
    border-radius: 16px;
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    background: #f9fafb;
    margin-bottom: 2rem;
}

.drop-zone:hover,
.drop-zone.dragover {
    border-color: #667eea;
    background: #ede9fe;
}

.drop-zone.has-file {
    border-color: #10b981;
    background: #d1fae5;
}

.drop-zone-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.drop-zone-text {
    font-size: 1.2rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.5rem;
}

.drop-zone-subtext {
    color: #6b7280;
    margin-bottom: 1rem;
}

/* File Info */
.file-info {
    background: #ede9fe;
    border: 2px solid #667eea;
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 2rem;
}

.file-info-item {
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(102, 126, 234, 0.2);
}

.file-info-item:last-child {
    border-bottom: none;
}

/* Settings Panel */
.settings-panel {
    background: #f9fafb;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.settings-panel h3 {
    margin-bottom: 1rem;
    color: #667eea;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #374151;
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: #667eea;
}

input[type="checkbox"] {
    width: auto;
    margin-right: 0.5rem;
}

.form-help {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.85rem;
    color: #6b7280;
    font-style: italic;
}

/* Progress Section */
.progress-section {
    background: #f9fafb;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.progress-section h3 {
    margin-bottom: 1rem;
    color: #667eea;
}

.progress-bar-container {
    background: #e5e7eb;
    border-radius: 12px;
    height: 30px;
    overflow: hidden;
    position: relative;
}

.progress-bar-container.large {
    height: 40px;
    margin-bottom: 1rem;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    transition: width 0.5s ease;
    width: 0%;
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: bold;
    color: white;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.stage-text {
    font-size: 1.1rem;
    font-weight: 600;
    color: #374151;
    margin-top: 0.5rem;
}

.stage-details {
    color: #6b7280;
    margin-top: 0.3rem;
}

/* Progress Overview */
.progress-overview {
    background: #f9fafb;
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    text-align: center;
}

/* Stages Container */
.stages-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stage-item {
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.3s;
}

.stage-item.active {
    border-color: #667eea;
    background: #ede9fe;
    transform: scale(1.05);
}

.stage-item.completed {
    border-color: #10b981;
    background: #d1fae5;
}

.stage-item.failed {
    border-color: #ef4444;
    background: #fee2e2;
}

.stage-icon {
    font-size: 2rem;
}

.stage-info h4 {
    margin-bottom: 0.3rem;
    color: #374151;
}

.stage-info p {
    font-size: 0.85rem;
    color: #6b7280;
}

.stage-status {
    margin-left: auto;
    font-size: 1.5rem;
}

/* Log Container */
.log-container {
    background: #f9fafb;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.log-container h3 {
    margin-bottom: 1rem;
    color: #667eea;
}

.log-entries {
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    padding: 1rem;
    max-height: 300px;
    overflow-y: auto;
}

.log-entry {
    padding: 0.5rem;
    border-bottom: 1px solid #e5e7eb;
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 0.9rem;
    color: #374151;
}

.log-entry:last-child {
    border-bottom: none;
}

/* Result Section */
.result-section {
    background: #d1fae5;
    border: 2px solid #10b981;
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    margin-bottom: 2rem;
}

.result-section h3 {
    color: #065f46;
    margin-bottom: 1rem;
}

.error-section {
    background: #fee2e2;
    border: 2px solid #ef4444;
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    margin-bottom: 2rem;
}

.error-section h3 {
    color: #991b1b;
    margin-bottom: 1rem;
}

/* Actions */
.actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 2rem;
}

/* Requirements */
.requirements {
    background: #fef3c7;
    border: 2px solid #fbbf24;
    border-radius: 12px;
    padding: 1.5rem;
    margin-top: 2rem;
}

.requirements h4 {
    color: #92400e;
    margin-bottom: 0.5rem;
}

.requirements ul {
    list-style-position: inside;
    color: #78350f;
}

.requirements li {
    padding: 0.3rem 0;
}

/* Filters */
.filters {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 0.5rem 1rem;
    border: 2px solid #e5e7eb;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 600;
}

.filter-btn:hover {
    border-color: #667eea;
    background: #ede9fe;
}

.filter-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
}

/* Table */
.table-container {
    overflow-x: auto;
    border-radius: 12px;
    border: 2px solid #e5e7eb;
}

.jobs-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.jobs-table thead {
    background: #f9fafb;
}

.jobs-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: #374151;
    border-bottom: 2px solid #e5e7eb;
}

.jobs-table td {
    padding: 1rem;
    border-bottom: 1px solid #e5e7eb;
}

.jobs-table tr:hover {
    background: #f9fafb;
}

.job-id {
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 0.9rem;
    color: #667eea;
}

.status-badge {
    display: inline-block;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.status-processing {
    background: #fef3c7;
    color: #92400e;
}

.status-completed {
    background: #d1fae5;
    color: #065f46;
}

.status-failed {
    background: #fee2e2;
    color: #991b1b;
}

.status-cancelled {
    background: #e5e7eb;
    color: #374151;
}

/* Type badges for job types */
.type-badge {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
}

.type-audio {
    background: #e0e7ff;
    color: #3730a3;
}

.type-translation {
    background: #fef3c7;
    color: #92400e;
}

.loading,
.error {
    text-align: center;
    color: #6b7280;
    padding: 2rem;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem;
}

.empty-icon {
    font-size: 5rem;
    margin-bottom: 1rem;
}

.empty-state h3 {
    color: #374151;
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: #6b7280;
    margin-bottom: 1.5rem;
}

/* Footer */
footer {
    background: #f9fafb;
    padding: 1.5rem;
    text-align: center;
    color: #6b7280;
    font-size: 0.9rem;
}

footer a {
    color: #667eea;
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* Collections-specific styles */
.collections-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.collection-card {
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.3s;
}

.collection-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border-color: #667eea;
}

.collection-card h3 {
    color: #667eea;
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
}

.collection-meta {
    color: #6b7280;
    font-size: 0.9rem;
    margin-bottom: 0.8rem;
}

.collection-description {
    color: #374151;
    line-height: 1.5;
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

.collection-stats {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.collection-stat {
    font-size: 0.85rem;
    color: #6b7280;
}

.collection-stat.visibility {
    font-weight: 600;
}

.collection-stat.visibility.public {
    color: #10b981;
}

.collection-stat.visibility.private {
    color: #ef4444;
}

.collection-stat.visibility.unlisted {
    color: #f59e0b;
}

.collection-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.collection-id {
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 0.85rem;
    color: #9ca3af;
    margin-top: 0.5rem;
}

.collection-creator {
    color: #667eea;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
}

.collection-date {
    color: #9ca3af;
    font-size: 0.8rem;
    margin-bottom: 0.8rem;
}

/* Modal overlays */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

/* Large modal with fixed header/footer */
.modal-large {
    max-width: 800px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
}

/* Modal Header - Fixed */
.modal-header {
    padding: 1.5rem 2rem;
    border-bottom: 2px solid #e5e7eb;
    flex-shrink: 0;
}

.modal-header h3 {
    color: #667eea;
    margin: 0;
    font-size: 1.5rem;
}

/* Modal Body - Scrollable */
.modal-body {
    padding: 2rem;
    overflow-y: auto;
    flex: 1;
}

/* Modal Footer - Fixed */
.modal-footer {
    padding: 1.5rem 2rem;
    border-top: 2px solid #e5e7eb;
    flex-shrink: 0;
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    background: #f9fafb;
}

.modal h3 {
    color: #667eea;
    margin-bottom: 1rem;
}

.modal p {
    color: #374151;
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

/* Form elements for modals */
.form-group input[type="text"],
.form-group input[type="password"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.6rem 0.8rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
}

.form-group textarea {
    min-height: 100px;
    resize: vertical;
    font-family: inherit;
}

/* Tags input */
.tags-input {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.tags-container {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.tag {
    background: #e3f2fd;
    color: #1976d2;
    padding: 0.3rem 0.8rem;
    border-radius: 15px;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.85rem;
}

.tag .remove {
    cursor: pointer;
    font-weight: bold;
    transition: color 0.2s;
}

.tag .remove:hover {
    color: #ef4444;
}

.add-tag-input {
    flex: 1;
    min-width: 100px;
}

/* Lessons selection */
.lessons-selection {
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    margin-top: 0.5rem;
    background: #f9fafb;
    overflow: hidden;
}

.lessons-selection-header {
    padding: 1rem;
    border-bottom: 2px solid #e5e7eb;
    background: white;
    position: sticky;
    top: 0;
    z-index: 10;
}

.lessons-selection-header h4 {
    margin: 0 0 0.8rem 0;
    color: #374151;
    font-size: 1rem;
}

.lesson-search-input {
    width: 100%;
    padding: 0.6rem 0.8rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: border-color 0.2s;
}

.lesson-search-input:focus {
    outline: none;
    border-color: #667eea;
}

/* Scrollable lessons list */
.lessons-list-wrapper {
    max-height: 250px;
    overflow-y: auto;
    padding: 0.5rem;
}

.lesson-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.lesson-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem;
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.lesson-item:hover {
    background: #f9fafb;
    border-color: #667eea;
}

.lesson-item.selected {
    background: #e3f2fd;
    border-color: #667eea;
}

.lesson-item label {
    flex: 1;
    cursor: pointer;
    margin: 0;
}

.lesson-item input[type="checkbox"] {
    cursor: pointer;
}

/* Selected lessons section */
.selected-lessons-section {
    padding: 1rem;
    border-top: 2px solid #e5e7eb;
    background: white;
}

.selected-lessons-section h4 {
    margin: 0 0 0.8rem 0;
    color: #374151;
    font-size: 1rem;
}

.selected-lessons-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    max-height: 150px;
    overflow-y: auto;
}

.selected-lesson-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
}

.lesson-order-badge {
    background: #e3f2fd;
    color: #1976d2;
    padding: 0.2rem 0.6rem;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: bold;
    min-width: 28px;
    text-align: center;
}

.lesson-title {
    flex: 1;
    font-size: 0.9rem;
    color: #374151;
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    display: none;
}

.alert.success {
    background: #d1fae5;
    color: #065f46;
    border: 2px solid #10b981;
}

.alert.error {
    background: #fee2e2;
    color: #991b1b;
    border: 2px solid #ef4444;
}

.alert.info {
    background: #dbeafe;
    color: #1e40af;
    border: 2px solid #3b82f6;
}

.alert.active {
    display: block;
}

/* Filters section */
.filters-section {
    background: #f9fafb;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.filters-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

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

.filter-group label {
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-group input,
.filter-group select {
    padding: 0.6rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: border-color 0.2s;
}

.filter-group input:focus,
.filter-group select:focus {
    outline: none;
    border-color: #667eea;
}

.filter-stats {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    color: #6b7280;
    font-size: 0.9rem;
}

.filter-stat {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-stat i {
    color: #667eea;
}

.filter-stat strong {
    color: #374151;
}

/* Main actions */
.main-actions {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

/* User management specific */
.users-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.user-card {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.3s;
}

.user-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border-color: #667eea;
}

.user-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.user-name {
    font-size: 1.2rem;
    font-weight: 600;
    color: #2d3748;
}

.user-role {
    background: #ede9fe;
    color: #667eea;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.user-details {
    color: #718096;
    /* margin-bottom: 1rem; */
}

.user-meta {
    font-size: 0.85rem;
}

.user-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.btn-user {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s;
}

.btn-edit {
    background: #dbeafe;
    color: #2563eb;
}

.btn-edit:hover {
    background: #bfdbfe;
}

.btn-delete {
    background: #fee2e2;
    color: #dc2626;
}

.btn-delete:hover {
    background: #fecaca;
}

.user-form {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    display: none;
}

.form-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.form-row .form-group {
    flex: 1;
    margin-bottom: 0;
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-start;
}

.no-users {
    text-align: center;
    padding: 3rem;
    color: #718096;
}

.no-users i {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: #cbd5e0;
}

/* Admin-only elements */
.admin-only {
    display: none;
}

.admin-only.show {
    display: block;
}

/* ========================================
   Admin Navigation - Sidebar & Bottom Nav
   ======================================== */

/* Hide navigation until JS marks it ready - prevents flash */
.admin-sidebar,
.admin-bottom-nav,
.mobile-user-bar {
    visibility: hidden;
}

body.nav-ready .admin-sidebar,
body.nav-ready .admin-bottom-nav,
body.nav-ready .mobile-user-bar {
    visibility: visible;
}

/* Sidebar - Desktop */
.admin-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 240px;
    background: linear-gradient(180deg, #1e1e2e 0%, #2d2d44 100%);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
}

.admin-sidebar.collapsed {
    width: 70px;
}

.sidebar-brand {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: white;
    font-size: 1.3rem;
    font-weight: 700;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-brand i {
    font-size: 1.5rem;
    color: #667eea;
}

.admin-sidebar.collapsed .sidebar-brand span {
    display: none;
}

.sidebar-nav {
    list-style: none;
    padding: 1rem 0;
    margin: 0;
    flex: 1;
    overflow-y: auto;
}

.sidebar-nav li {
    margin: 0.25rem 0.75rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    border-radius: 10px;
    transition: all 0.2s ease;
    font-size: 0.95rem;
    font-weight: 500;
}

.sidebar-link:hover {
    background: rgba(102, 126, 234, 0.15);
    color: white;
}

.sidebar-link.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.sidebar-link i {
    width: 22px;
    text-align: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.admin-sidebar.collapsed .sidebar-link {
    justify-content: center;
    padding: 0.85rem;
}

.admin-sidebar.collapsed .sidebar-link span {
    display: none;
}

.sidebar-toggle {
    position: absolute;
    right: -12px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    background: #667eea;
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.sidebar-toggle:hover {
    background: #764ba2;
    transform: translateY(-50%) scale(1.1);
}

.admin-sidebar.collapsed .sidebar-toggle i {
    transform: rotate(180deg);
}

/* Body with sidebar */
body.has-admin-nav {
    padding: 0;
    padding-left: 240px;
    min-height: 100vh;
}

body.has-admin-nav.sidebar-collapsed {
    padding-left: 70px;
}

/* Sidebar User Section */
.sidebar-user {
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: auto;
    flex-shrink: 0;
}

.user-avatar {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.user-avatar i {
    font-size: 2rem;
    color: rgba(255, 255, 255, 0.8);
}

.user-details {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.user-name {
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 0.75rem;
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    width: fit-content;
}

.user-role.role-admin {
    background: rgba(102, 126, 234, 0.3);
    color: #a5b4fc;
}

.user-role.role-user {
    background: rgba(16, 185, 129, 0.3);
    color: #6ee7b7;
}

.user-logout {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: rgba(255, 255, 255, 0.7);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.user-logout:hover {
    background: rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

/* Collapsed sidebar user section */
.admin-sidebar.collapsed .sidebar-user {
    flex-direction: column;
    padding: 0.75rem 0.5rem;
    gap: 0.5rem;
}

.admin-sidebar.collapsed .user-details {
    display: none;
}

.admin-sidebar.collapsed .user-logout {
    width: 100%;
    height: 28px;
}

/* Bottom Navigation - Mobile */
.admin-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid #e5e7eb;
    z-index: 1000;
    padding: 0.5rem 0.25rem;
    padding-bottom: calc(0.5rem + env(safe-area-inset-bottom));
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
}

.bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 0.25rem;
    color: #6b7280;
    text-decoration: none;
    font-size: 0.7rem;
    font-weight: 500;
    transition: all 0.2s;
    border-radius: 8px;
    margin: 0 0.15rem;
}

.bottom-nav-item i {
    font-size: 1.25rem;
    margin-bottom: 0.25rem;
}

.bottom-nav-item:hover {
    color: #667eea;
    background: rgba(102, 126, 234, 0.1);
}

.bottom-nav-item.active {
    color: #667eea;
}

.bottom-nav-item.active i {
    transform: scale(1.1);
}

/* Responsive */
@media (max-width: 768px) {
    body {
        padding: 0;
        padding-bottom: 5rem; /* Space for bottom nav */
    }

    body.has-admin-nav {
        padding-left: 0;
        padding-bottom: 5rem;
    }

    .admin-sidebar {
        display: none;
    }

    .admin-bottom-nav {
        display: flex;
    }

    .container {
        border-radius: 0;
        box-shadow: none;
    }

    header h1 {
        font-size: 1.5rem;
    }

    .btn-back {
        position: static;
        display: block;
        margin-bottom: 1rem;
        text-align: center;
    }

    .card-grid {
        grid-template-columns: 1fr;
    }

    .stages-container {
        grid-template-columns: 1fr;
    }

    .jobs-table {
        font-size: 0.85rem;
    }

    .jobs-table th,
    .jobs-table td {
        padding: 0.5rem;
    }

    .collections-grid,
    .users-grid {
        grid-template-columns: 1fr;
    }

    .filters-row {
        grid-template-columns: 1fr;
    }

    .main-actions {
        flex-direction: column;
    }

    .form-row {
        flex-direction: column;
    }

    /* Mobile user bar */
    .mobile-user-bar {
        display: flex;
    }
}

/* Large screens - wider sidebar */
@media (min-width: 1400px) {
    .admin-sidebar {
        width: 260px;
    }

    body.has-admin-nav {
        padding-left: 260px;
    }
}

/* Hide back button and header when nav is present */
body.has-admin-nav .btn-back {
    display: none;
}

body.has-admin-nav header {
    display: none;
}

body.has-admin-nav .container {
    max-width: none;
    border-radius: 0;
    box-shadow: none;
    min-height: 100vh;
}

/* Mobile user bar (at top of page) */
.mobile-user-bar {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, #1e1e2e 0%, #2d2d44 100%);
    color: white;
}

.mobile-user-bar .user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.mobile-user-bar .user-info i {
    font-size: 1.25rem;
    color: rgba(255, 255, 255, 0.8);
}

.mobile-user-bar .user-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.mobile-user-bar .user-role {
    font-size: 0.7rem;
    padding: 0.1rem 0.4rem;
    border-radius: 8px;
    margin-left: 0.5rem;
}

.mobile-user-bar .user-role.role-admin {
    background: rgba(102, 126, 234, 0.3);
    color: #a5b4fc;
}

.mobile-user-bar .user-role.role-user {
    background: rgba(16, 185, 129, 0.3);
    color: #6ee7b7;
}

.mobile-user-bar .logout-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: rgba(255, 255, 255, 0.8);
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.mobile-user-bar .logout-btn:hover {
    background: rgba(239, 68, 68, 0.3);
}

/* Logs Modal - specific styles for job-detail page */
#logs-modal.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
}

.logs-modal {
    background: var(--card-bg);
    border-radius: 12px;
    width: 90%;
    max-width: 1000px;
    max-height: 80%;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.logs-modal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.logs-modal .modal-header h3 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--primary-color);
}

.logs-modal .close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    transition: color 0.2s;
}

.logs-modal .close-btn:hover {
    color: var(--primary-color);
}

.logs-modal .modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.logs-content {
    background: #1a1a1a;
    border-radius: 8px;
    padding: 1rem;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    line-height: 1.6;
    max-height: 500px;
    overflow-y: auto;
}

.log-line {
    margin-bottom: 0.5rem;
    display: flex;
    gap: 1rem;
}

.log-source {
    color: #888;
    min-width: 180px;
    flex-shrink: 0;
}

.log-text {
    color: #e0e0e0;
    word-break: break-word;
}

.logs-content .loading,
.logs-content .no-logs,
.logs-content .error {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
}

.logs-content .error {
    color: var(--error-color);
}

/* ========================================
   IMPROVED LOGS MODAL
   ======================================== */

/* Logs modal overlay - specific for job-detail logs */
#logs-modal-overlay.modal-overlay {
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    z-index: 9999;
    padding: 1rem;
}

.logs-modal-container {
    background: #1e1e2e;
    border-radius: 16px;
    width: 100%;
    max-width: 1000px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

/* Header */
.logs-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.logs-modal-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: 600;
}

.logs-modal-title i {
    font-size: 1.5rem;
}

.logs-count-badge {
    font-size: 0.75rem;
    background: rgba(255, 255, 255, 0.2);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-weight: 500;
}

.logs-close-btn {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.logs-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

/* Toolbar */
.logs-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 1rem 1.5rem;
    background: #2a2a3e;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.logs-search-box {
    display: flex;
    align-items: center;
    background: #1e1e2e;
    border-radius: 8px;
    padding: 0 1rem;
    flex: 1;
    min-width: 200px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: border-color 0.2s ease;
}

.logs-search-box:focus-within {
    border-color: #667eea;
}

.logs-search-box i {
    color: #6b7280;
    margin-right: 0.5rem;
}

.logs-search-box input {
    background: transparent;
    border: none;
    color: white;
    padding: 0.75rem 0;
    width: 100%;
    font-size: 0.875rem;
    outline: none;
}

.logs-search-box input::placeholder {
    color: #6b7280;
}

.logs-filters {
    display: flex;
    gap: 0.5rem;
}

.logs-filter-btn {
    background: #1e1e2e;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #9ca3af;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.logs-filter-btn:hover {
    background: #2a2a3e;
    color: white;
}

.logs-filter-btn.active {
    background: #667eea;
    border-color: #667eea;
    color: white;
}

.logs-filter-btn[data-level="info"].active {
    background: #3b82f6;
    border-color: #3b82f6;
}

.logs-filter-btn[data-level="warning"].active {
    background: #f59e0b;
    border-color: #f59e0b;
}

.logs-filter-btn[data-level="error"].active {
    background: #ef4444;
    border-color: #ef4444;
}

.logs-actions {
    display: flex;
    gap: 0.5rem;
}

.logs-action-btn {
    background: #1e1e2e;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #9ca3af;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.logs-action-btn:hover {
    background: #667eea;
    border-color: #667eea;
    color: white;
}

.logs-action-btn.copied {
    background: #10b981;
    border-color: #10b981;
    color: white;
}

/* Content Area */
.logs-content-area {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    background: #0d0d14;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.8rem;
    line-height: 1.6;
    min-height: 300px;
    max-height: 60vh;
}

.logs-content-area::-webkit-scrollbar {
    width: 8px;
}

.logs-content-area::-webkit-scrollbar-track {
    background: #1e1e2e;
}

.logs-content-area::-webkit-scrollbar-thumb {
    background: #4a4a6a;
    border-radius: 4px;
}

.logs-content-area::-webkit-scrollbar-thumb:hover {
    background: #667eea;
}

.logs-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 3rem;
    color: #6b7280;
}

.logs-loading i {
    font-size: 1.5rem;
    color: #667eea;
}

.log-entry {
    display: flex;
    padding: 0.35rem 0.5rem;
    border-radius: 4px;
    margin-bottom: 2px;
    transition: background-color 0.15s ease;
}

.log-entry:hover {
    background: rgba(255, 255, 255, 0.05);
}

.log-entry.hidden {
    display: none;
}

.log-line-num {
    color: #4a4a6a;
    min-width: 45px;
    text-align: right;
    padding-right: 1rem;
    user-select: none;
    font-size: 0.75rem;
}

.log-timestamp {
    color: #6b7280;
    min-width: 90px;
    padding-right: 1rem;
    font-size: 0.75rem;
}

.log-level {
    min-width: 70px;
    padding-right: 1rem;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.7rem;
}

.log-level.info {
    color: #3b82f6;
}

.log-level.warning {
    color: #f59e0b;
}

.log-level.error {
    color: #ef4444;
}

.log-level.debug {
    color: #8b5cf6;
}

.log-source {
    color: #10b981;
    min-width: 120px;
    padding-right: 1rem;
    font-size: 0.75rem;
}

.log-message {
    color: #e5e7eb;
    flex: 1;
    word-break: break-word;
}

.log-entry.level-error {
    background: rgba(239, 68, 68, 0.1);
    border-left: 3px solid #ef4444;
}

.log-entry.level-warning {
    background: rgba(245, 158, 11, 0.1);
    border-left: 3px solid #f59e0b;
}

.log-entry.level-error .log-message {
    color: #fca5a5;
}

.log-entry.level-warning .log-message {
    color: #fcd34d;
}

.log-highlight {
    background: #fbbf24;
    color: #000;
    padding: 0 2px;
    border-radius: 2px;
}

.logs-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: #6b7280;
    text-align: center;
}

.logs-empty i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.logs-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: #ef4444;
    text-align: center;
}

.logs-error i {
    font-size: 3rem;
    margin-bottom: 1rem;
}

/* Footer */
.logs-modal-footer {
    padding: 0.75rem 1.5rem;
    background: #2a2a3e;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    color: #6b7280;
    font-size: 0.8rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Responsive */
@media (max-width: 768px) {
    .logs-toolbar {
        flex-direction: column;
    }

    .logs-search-box {
        order: -1;
        width: 100%;
    }

    .logs-filters {
        flex-wrap: wrap;
        justify-content: center;
    }

    .logs-filter-btn {
        flex: 1;
        min-width: 80px;
        justify-content: center;
    }

    .logs-modal-container {
        max-height: 95vh;
    }

    .logs-content-area {
        max-height: 50vh;
    }

    .log-timestamp,
    .log-source {
        display: none;
    }
}

.btn-info {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
}

.btn-info:hover {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
}

/* ========================================
   Jobs Page - Compact table styles
   ======================================== */

/* Compact table */
.jobs-table {
    font-size: 0.85rem;
}

.jobs-table th,
.jobs-table td {
    padding: 0.6rem 0.8rem;
    white-space: nowrap;
}

.jobs-table th {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6b7280;
    font-weight: 600;
}

/* Compact type badges */
.type-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
}

.type-icon.audio {
    background: #e0e7ff;
    color: #4f46e5;
}

.type-icon.translation {
    background: #fef3c7;
    color: #d97706;
}

/* Compact status badges (override existing) */
.status-badge {
    padding: 0.2rem 0.5rem;
    font-size: 0.75rem;
    border-radius: 4px;
}

/* Job ID monospace */
.job-id-cell {
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 0.8rem;
}

.job-id-link {
    color: #4f46e5;
    text-decoration: none;
}

.job-id-link:hover {
    text-decoration: underline;
}

/* Compact action buttons */
.actions-cell {
    display: flex;
    gap: 4px;
}

.btn-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    transition: opacity 0.2s;
    text-decoration: none;
}

.btn-icon:hover {
    opacity: 0.8;
}

.btn-icon.view {
    background: #e0e7ff;
    color: #4f46e5;
}

.btn-icon.lesson {
    background: #d1fae5;
    color: #059669;
}

.btn-icon.delete {
    background: #fee2e2;
    color: #dc2626;
}

/* Language badge */
.lang-badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    background: #f3f4f6;
    color: #374151;
}

/* Stage text */
.stage-text {
    font-size: 0.8rem;
    color: #6b7280;
}

/* Compact date */
.date-cell {
    font-size: 0.8rem;
    color: #6b7280;
}

/* Compact filters */
.filters {
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.filter-btn {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
}

/* Empty state icon */
.empty-state .empty-icon {
    font-size: 3rem;
    color: #d1d5db;
}

/* ========================================
   Manage Lessons Page - Card styles
   ======================================== */

/* Lessons grid */
.lessons-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.lesson-card {
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.3s;
    position: relative;
}

.lesson-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border-color: #667eea;
}

.lesson-card h3 {
    color: #667eea;
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
}

.lesson-meta {
    color: #6b7280;
    font-size: 0.9rem;
    margin-bottom: 0.8rem;
}

.lesson-description {
    color: #374151;
    line-height: 1.5;
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

.lesson-stats {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.lesson-stat {
    font-size: 0.85rem;
    color: #6b7280;
}

.lesson-languages {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.language-badge {
    background: #ede9fe;
    color: #667eea;
    padding: 0.3rem 0.6rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.lesson-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.lesson-id {
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 0.85rem;
    color: #9ca3af;
    margin-top: 0.5rem;
}

/* Modal overrides for manage-lessons */
#delete-modal,
#translate-modal {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(0, 0, 0, 0.5) !important;
    z-index: 10000 !important;
    display: none;
    align-items: center !important;
    justify-content: center !important;
}

#delete-modal .modal,
#translate-modal .modal {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    width: auto !important;
    height: auto !important;
    background: white !important;
    border-radius: 12px !important;
    padding: 1.5rem !important;
    max-width: 420px !important;
    min-width: 320px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3) !important;
    display: block !important;
}

/* Translation Modal - clean design */
.languages-grid {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin: 1rem 0;
}

.language-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    background: white;
}

.language-item:hover:not(.disabled) {
    border-color: #667eea;
    background: #f9fafb;
}

.language-item.selected:not(.disabled) {
    border-color: #667eea;
    background: #eef2ff;
}

.language-item.disabled {
    background: #f3f4f6;
    cursor: default;
    opacity: 0.7;
}

.language-item input[type="checkbox"] {
    margin-right: 0.75rem;
}

.language-item .lang-name {
    flex: 1;
    font-weight: 500;
}

.lang-badge.done {
    background: #d1fae5;
    color: #065f46;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Lesson creator and date */
.lesson-creator {
    color: #667eea;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
}

.lesson-date {
    color: #9ca3af;
    font-size: 0.8rem;
    margin-bottom: 0.8rem;
}

/* Modal text styles */
.modal h3 {
    color: #ef4444;
    margin-bottom: 1rem;
}

.modal p {
    color: #374151;
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

/* Filters section */
.filters-section {
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.filters-row {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.filter-group {
    flex: 1;
    min-width: 200px;
}

.filter-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #374151;
    font-weight: 600;
    font-size: 0.9rem;
}

.filter-group input,
.filter-group select {
    width: 100%;
    padding: 0.6rem 0.8rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: border-color 0.2s;
}

.filter-group input:focus,
.filter-group select:focus {
    outline: none;
    border-color: #667eea;
}

.filter-stats {
    color: #6b7280;
    font-size: 0.9rem;
    margin-top: 1rem;
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.filter-stat {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-stat i {
    color: #667eea;
}

/* ========================================
   View Mode Toggle (Cards vs Compact)
   ======================================== */

.view-mode-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
}

.view-mode-toggle-label {
    font-size: 0.85rem;
    color: #6b7280;
    white-space: nowrap;
}

.view-mode-buttons {
    display: flex;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
}

.view-mode-btn {
    padding: 0.5rem 0.75rem;
    border: none;
    background: white;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
}

.view-mode-btn:first-child {
    border-right: 1px solid #e5e7eb;
}

.view-mode-btn:hover {
    background: #f9fafb;
    color: #374151;
}

.view-mode-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.view-mode-btn i {
    font-size: 0.9rem;
}

/* ========================================
   Compact View Mode - Two-row layout
   ======================================== */

/* Container - clean table look */
.lessons-grid.compact-view {
    display: flex;
    flex-direction: column;
    gap: 0;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
}

/* Each item - two-row internal layout */
.lessons-grid.compact-view .lesson-card {
    padding: 0.5rem 0.75rem;
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    gap: 0.25rem 0.5rem;
    border: none;
    border-radius: 0;
    border-bottom: 1px solid #f0f0f0;
    background: transparent;
}

.lessons-grid.compact-view .lesson-card:last-child {
    border-bottom: none;
}

.lessons-grid.compact-view .lesson-card:hover {
    transform: none;
    box-shadow: none;
    background: #fafafa;
}

/* Hide in compact mode */
.lessons-grid.compact-view .collection-badge,
.lessons-grid.compact-view .lesson-description,
.lessons-grid.compact-view .lesson-meta,
.lessons-grid.compact-view .lesson-id,
.lessons-grid.compact-view .lesson-stats,
.lessons-grid.compact-view .lesson-languages {
    display: none;
}

/* Row 1: Title (spans if needed) */
.lessons-grid.compact-view .lesson-card h3 {
    grid-column: 1;
    grid-row: 1;
    font-size: 0.9rem;
    margin: 0;
    font-weight: 500;
    color: #374151;
    line-height: 1.3;
    /* Allow 2 lines max */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Row 1: Actions (icon buttons) - top right */
.lessons-grid.compact-view .lesson-actions {
    grid-column: 2;
    grid-row: 1;
    margin: 0;
    gap: 0.25rem;
    display: flex;
    align-items: flex-start;
}

.lessons-grid.compact-view .lesson-actions .btn-small {
    padding: 0.3rem 0.5rem;
    font-size: 0.75rem;
    white-space: nowrap;
}

/* Icon-only on smaller screens handled via media query below */

/* Row 2: Meta row - creator, date, collection */
.lessons-grid.compact-view .lesson-meta-row {
    grid-column: 1 / -1;
    grid-row: 2;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    font-size: 0.75rem;
    margin: 0;
    color: #6b7280;
}

.lessons-grid.compact-view .lesson-creator {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    color: #6b7280;
}

.lessons-grid.compact-view .lesson-creator i {
    font-size: 0.65rem;
    color: #9ca3af;
}

/* Hide full date, show short date in compact */
.lessons-grid.compact-view .lesson-date-full {
    display: none !important;
}

.lessons-grid.compact-view .lesson-date-short {
    display: inline;
    font-size: 0.75rem;
    color: #9ca3af;
}

/* Normal mode: show full date, hide short */
.lesson-date-short {
    display: none;
}

/* Collection selector inline in compact */
.lessons-grid.compact-view .lesson-collection-selector {
    display: inline-flex;
    align-items: center;
    margin: 0 !important;
}

.lessons-grid.compact-view .lesson-collection-selector label {
    display: none !important;
}

.lessons-grid.compact-view .lesson-collection-selector select {
    padding: 0.2rem 0.4rem;
    font-size: 0.7rem;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    background: #f9fafb;
    max-width: 150px;
}

/* Compact mode: icon-only buttons (hide text span) */
.lessons-grid.compact-view .lesson-actions .btn-small span {
    display: none;
}

.lessons-grid.compact-view .lesson-actions .btn-small i {
    margin: 0;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .view-mode-toggle {
        margin-left: 0;
        margin-top: 0.5rem;
        width: 100%;
        justify-content: flex-end;
    }

    .lessons-grid.compact-view .lesson-card {
        padding: 0.4rem 0.5rem;
    }

    .lessons-grid.compact-view .lesson-card h3 {
        font-size: 0.85rem;
    }

    .lessons-grid.compact-view .lesson-actions .btn-small {
        padding: 0.25rem 0.35rem;
    }

    .lessons-grid.compact-view .lesson-actions .btn-small i {
        font-size: 0.8rem;
    }

    .lessons-grid.compact-view .lesson-meta-row {
        gap: 0.5rem;
        font-size: 0.7rem;
    }

    .lessons-grid.compact-view .lesson-collection-selector select {
        max-width: 110px;
        font-size: 0.65rem;
    }
}
