/*
 * Copyright © 2025 Meir Livneh. All Rights Reserved.
 *
 * This software and associated documentation files (the "Software") are proprietary and confidential.
 * The Software is furnished under a license agreement and may be used or copied only in
 * accordance with the terms of the agreement.
 *
 * Unauthorized copying of this file, via any medium, is strictly prohibited.
 */

/* teacher-dashboard.css - English LTR Version */

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

/* Loading Overlay - Enhanced */
#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: all 0.5s ease;
}

#loading-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    transform: scale(0.95);
}

.loading-content {
    text-align: center;
    color: white;
    max-width: 500px;
    padding: 40px;
}

.loading-logo {
    margin-bottom: 40px;
    animation: fadeInDown 1s ease;
}

.loading-logo .logo-icon {
    font-size: 64px;
    display: block;
    margin-bottom: 15px;
    animation: pulse 2s ease-in-out infinite;
}

.loading-logo .logo-text {
    font-size: 36px;
    font-weight: bold;
    letter-spacing: 2px;
}

.loading-spinner {
    margin: 40px 0;
    position: relative;
    height: 120px;
}

.spinner-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    border: 3px solid transparent;
    border-radius: 50%;
    animation: spin 2s linear infinite;
}

.spinner-ring:nth-child(1) {
    width: 80px;
    height: 80px;
    margin: -40px 0 0 -40px;
    border-top-color: #ffffff;
    animation-delay: 0s;
}

.spinner-ring:nth-child(2) {
    width: 60px;
    height: 60px;
    margin: -30px 0 0 -30px;
    border-top-color: #e8f4fd;
    animation-delay: 0.3s;
}

.spinner-ring:nth-child(3) {
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border-top-color: #b3d9ff;
    animation-delay: 0.6s;
}

.loading-message {
    margin-top: 30px;
    animation: fadeInUp 1s ease 0.5s both;
}

.loading-message h2 {
    font-size: 28px;
    margin-bottom: 15px;
    font-weight: 600;
}

.loading-message p {
    font-size: 18px;
    margin-bottom: 25px;
    opacity: 0.9;
    line-height: 1.5;
}

.loading-progress {
    margin-top: 30px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 15px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #ffffff, #e8f4fd);
    border-radius: 4px;
    width: 0%;
    transition: width 0.5s ease;
    animation: progressFill 30s linear;
}

.progress-text {
    font-size: 16px;
    opacity: 0.8;
    font-weight: 500;
}

/* Loading Animations */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

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

@keyframes fadeInDown {
    0% {
        opacity: 0;
        transform: translateY(-30px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    0% {
        opacity: 0;
        transform: translateY(30px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes progressFill {
    0% { width: 0%; }
    100% { width: 100%; }
}

/* Login Bypass Placeholder */
#login-bypass-placeholder {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.placeholder-box {
    background: white;
    padding: 40px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    text-align: center;
    max-width: 400px;
    width: 90%;
}

.placeholder-box h1 {
    color: #2c3e50;
    margin: 20px 0 15px 0;
    font-size: 28px;
}

.placeholder-box .info-text {
    color: #666;
    margin-bottom: 25px;
    line-height: 1.5;
}

.placeholder-box input {
    width: 100%;
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 18px;
    margin-bottom: 15px;
    transition: border-color 0.3s ease;
}

.placeholder-box input[type="email"] {
    text-align: left;
    letter-spacing: normal;
}

.placeholder-box input[type="text"] {
    text-align: center;
    letter-spacing: 0.5em;
}

.placeholder-box input:focus {
    outline: none;
    border-color: #667eea;
}

.placeholder-box .fine-print {
    font-size: 12px;
    color: #999;
    margin-bottom: 20px;
    font-style: italic;
}

.main-button {
    width: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.main-button:hover {
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

/* Activity Group Styling for Hierarchical Display */
.activity-group {
    margin-bottom: 20px;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    background: #f8f9fa;
}

.activity-title {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 16px;
    margin: 0;
    border-radius: 8px 8px 0 0;
    font-size: 16px;
    font-weight: 600;
}

.activity-description {
    color: #666;
    font-size: 14px;
    font-style: italic;
}

.library-item-private,
.library-item-public {
    border-bottom: 1px solid #e1e5e9;
    padding: 12px 16px;
    background: white;
}

.library-item-private:last-child,
.library-item-public:last-child {
    border-bottom: none;
    border-radius: 0 0 8px 8px;
}

.library-item-private:hover,
.library-item-public:hover {
    background: #f0f2f5;
}

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

/* Header & Navigation */
.header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 20px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    height: 70px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 24px;
    font-weight: bold;
    color: #2c3e50;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 0;
}

.nav-item {
    position: relative;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 15px 20px;
    text-decoration: none;
    color: #555;
    font-weight: 500;
    transition: all 0.3s ease;
    border-radius: 8px;
    margin: 0 2px;
}

.nav-link:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    transform: translateY(-2px);
}

.nav-icon {
    font-size: 18px;
}

/* Dropdown Menu */
.dropdown {
    position: absolute;
    top: 100%;
    left: 0; /* Changed from right: 0 for LTR */
    background: white;
    min-width: 280px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    border: 1px solid #e1e5e9;
    overflow: hidden;
}

.nav-item:hover .dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-header {
    padding: 15px 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-bottom: 1px solid #dee2e6;
    font-weight: bold;
    color: #495057;
    font-size: 14px;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    text-decoration: none;
    color: #555;
    transition: all 0.2s ease;
    border-bottom: 1px solid #f8f9fa;
}

.dropdown-item:hover {
    background: #f8f9fa;
    color: #007bff;
    padding-left: 25px; /* Changed from padding-right for LTR */
}

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

.dropdown-icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.dropdown-content {
    flex: 1;
}

.dropdown-title {
    font-weight: 600;
    margin-bottom: 2px;
}

.dropdown-desc {
    font-size: 12px;
    color: #6c757d;
}

/* Status Indicator */
.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: #28a745;
    color: white;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.connected {
    background: #27ae60;
    color: white;
}

.disconnected {
    background: #e74c3c;
    color: white;
}

/* Main Content */
.main-content {
    max-width: 1400px;
    margin: 30px auto;
    padding: 0 20px;
    display: grid;
    grid-template-columns: 1fr 1fr 400px;
    gap: 30px;
}

.section {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 5px 25px rgba(0,0,0,0.1);
    backdrop-filter: blur(10px);
}

.section h2 {
    margin-bottom: 20px;
    color: #2c3e50;
    font-size: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 2px solid #3498db;
    padding-bottom: 10px;
}

/* Students List */
.students-list {
    max-height: 300px;
    overflow-y: auto;
}

.student-item {
    background: white;
    margin: 10px 0;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #27ae60; /* Changed from border-right for LTR */
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.student-name {
    font-weight: bold;
    font-size: 1.2em;
    color: #2c3e50;
}

.student-status {
    font-size: 0.9em;
    color: #27ae60;
    margin-top: 5px;
}

.no-students {
    text-align: center;
    color: #666;
    font-style: italic;
    padding: 20px;
}

/* Messages Area */
.chat-messages, .messages-area {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: white;
    padding: 15px;
    margin-bottom: 15px;
}

.message-item {
    padding: 15px;
    border-bottom: 1px solid #eee;
    animation: slideInMessage 0.3s ease-out;
    text-align: left; /* Explicit LTR alignment */
    direction: ltr;
}

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

.message-sender {
    font-weight: bold;
    color: #3498db;
    margin-bottom: 5px;
}

.message-content {
    color: #555;
    margin-bottom: 5px;
}

.message-time {
    font-size: 0.8em;
    color: #999;
}

.no-messages {
    text-align: center;
    color: #666;
    font-style: italic;
    padding: 20px;
}

/* Chat Input */
.chat-input, .send-message-area {
    background: white;
    padding: 15px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin-top: 15px;
}

.chat-input textarea, .message-input {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 20px;
    resize: none;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.4;
    transition: all 0.3s ease;
    direction: ltr; /* Changed from rtl */
    text-align: left; /* Changed from right */
    min-height: 60px;
}

.chat-input textarea:focus, .message-input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 10px rgba(52, 152, 219, 0.2);
}

.chat-input button, .send-button {
    width: 100%;
    margin-top: 10px;
    padding: 12px;
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    border: none;
    border-radius: 20px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 16px;
}

.chat-input button:hover, .send-button:hover {
    background: linear-gradient(135deg, #2980b9 0%, #1f5f8b 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
}

.chat-input button:active, .send-button:active {
    transform: translateY(0);
}

/* Activity Log */
.activity-log {
    max-height: 300px;
    overflow-y: auto;
    padding: 10px;
}

.activity-item {
    background: white;
    margin: 8px 0;
    padding: 12px;
    border-radius: 6px;
    border-left: 3px solid #e74c3c; /* Changed from border-right for LTR */
    font-size: 0.9em;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    text-align: left; /* Explicit LTR alignment */
    direction: ltr;
}

.activity-time {
    font-size: 0.8em;
    color: #666;
    margin-bottom: 5px;
}

.activity-content {
    color: #333;
}

.no-activity {
    text-align: center;
    color: #666;
    font-style: italic;
    padding: 20px;
}

/* Stats */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.stat-card {
    background: white;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.stat-number {
    font-size: 2em;
    font-weight: bold;
    color: #3498db;
}

.stat-label {
    color: #666;
    margin-top: 5px;
}

/* Special Buttons */
.danger-item:hover {
    background: #fff5f5 !important;
    color: #dc3545 !important;
}

.success-item:hover {
    background: #f0fff4 !important;
    color: #28a745 !important;
}

.warning-item:hover {
    background: #fffbf0 !important;
    color: #ffc107 !important;
}

.tool-button.danger {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
    border: 2px solid #c0392b;
}

.tool-button.danger:hover {
    background: linear-gradient(135deg, #c0392b 0%, #a93226 100%);
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(231, 76, 60, 0.4);
}

.tool-button.danger:active {
    transform: translateY(-1px);
}

.tool-button.danger .tool-icon {
    font-size: 24px;
}

.tool-button.danger .tool-label {
    font-weight: bold;
}

/* Quick Actions */
.quick-actions {
    margin-top: 20px;
}

.action-button {
    display: block;
    width: 100%;
    padding: 10px;
    margin: 8px 0;
    background: #27ae60;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
}

.action-button:hover {
    background: #229954;
}

.action-button.secondary {
    background: #95a5a6;
}

.action-button.secondary:hover {
    background: #7f8c8d;
}

/* Debug Console */
.enhanced-debug-console {
    position: fixed;
    bottom: 10px;
    left: 10px;
    width: 500px;
    height: 200px;
    background: #1a1a1a;
    color: #00ff00;
    font-family: 'Courier New', monospace;
    font-size: 11px;
    padding: 10px;
    border-radius: 8px;
    overflow-y: auto;
    z-index: 9999;
    border: 2px solid #333;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
    display: none;
    direction: ltr; /* Force LTR for debug console */
    text-align: left;
}

/* Animations */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes slideInMessage {
    from {
        transform: translateX(-100%); /* Changed direction for LTR */
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.pulse {
    animation: pulse 2s infinite;
}

/* Scrollbars */
.students-list::-webkit-scrollbar,
.chat-messages::-webkit-scrollbar,
.messages-area::-webkit-scrollbar,
.activity-log::-webkit-scrollbar {
    width: 6px;
}

.students-list::-webkit-scrollbar-track,
.chat-messages::-webkit-scrollbar-track,
.messages-area::-webkit-scrollbar-track,
.activity-log::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.students-list::-webkit-scrollbar-thumb,
.chat-messages::-webkit-scrollbar-thumb,
.messages-area::-webkit-scrollbar-thumb,
.activity-log::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.students-list::-webkit-scrollbar-thumb:hover,
.chat-messages::-webkit-scrollbar-thumb:hover,
.messages-area::-webkit-scrollbar-thumb:hover,
.activity-log::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Responsive Design */
@media (max-width: 768px) {
    .nav-menu {
        display: none;
    }
    
    .main-content {
        grid-template-columns: 1fr;
        gap: 20px;
        margin: 20px auto;
    }
    
    .dropdown {
        position: fixed;
        top: 70px;
        left: 20px;
        right: 20px;
        min-width: auto;
    }
    
    .section {
        padding: 15px;
    }
    
    .nav-container {
        padding: 0 15px;
    }
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9998 !important;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal.show {
    opacity: 1;
    visibility: visible;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999 !important; /* וודא שהוא מעל הכל */
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.visible {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: white;
    border-radius: 15px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal-overlay.visible .modal-content {
    transform: scale(1);
}

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

.modal-header h3 {
    margin: 0;
    font-size: 18px;
}

.modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s ease;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.modal-body {
    padding: 20px;
    text-align: left; /* Explicit LTR */
    direction: ltr;
}

.modal-body p {
    margin-bottom: 15px;
    color: #666;
    font-size: 14px;
}

.modal-body textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    resize: vertical;
    font-family: inherit;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease;
    direction: ltr; /* Explicit LTR */
    text-align: left;
}

.modal-body textarea:focus {
    border-color: #667eea;
}

.modal-footer {
    padding: 20px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    border-top: 1px solid #eee;
}

.modal-footer button {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
}

.modal-footer button:not(.primary) {
    background: #f8f9fa;
    color: #666;
}

.modal-footer button:not(.primary):hover {
    background: #e9ecef;
}

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

.modal-footer button.primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* Content Form Styles */
.content-form {
    padding: 20px;
}

.content-form .form-group {
    margin-bottom: 15px;
}

.content-form .form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
}

.content-form .form-group input,
.content-form .form-group textarea,
.content-form .form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s ease;
}

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

.content-form .form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.content-form .form-actions button {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
}

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

.content-form .form-actions .btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.content-form .form-actions .btn-secondary {
    background: #f8f9fa;
    color: #666;
}

.content-form .form-actions .btn-secondary:hover {
    background: #e9ecef;
}

/* Private Message Button */
.private-message-btn {
    background: linear-gradient(135deg, #43a047 0%, #388e3c 100%);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.private-message-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(67, 160, 71, 0.4);
}

/* Student Item Styles */
.student-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border: 1px solid #eee;
    border-radius: 8px;
    margin-bottom: 8px;
    background: #f8f9fa;
    transition: all 0.2s ease;
}

.student-item:hover {
    background: #e9ecef;
    border-color: #667eea;
}

.student-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.student-name {
    font-weight: 600;
    color: #333;
}

.student-actions {
    display: flex;
    gap: 8px;
}

/* Message Item Styles */
.message-item {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 8px;
    border-left: 4px solid #667eea; /* Changed from border-right for LTR */
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.message-sender {
    font-weight: 600;
    color: #333;
}

.message-time {
    font-size: 12px;
    color: #666;
}

.message-content {
    color: #555;
    line-height: 1.4;
}

/* Room Code Section */
.room-code-section {
    grid-column: 1 / -1;
    margin-bottom: 20px;
}

/* AI Model Button Styles */
.ai-model-btn.active {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%) !important;
    color: white !important;
}

.ai-model-btn.active .dropdown-title,
.ai-model-btn.active .dropdown-desc {
    color: white !important;
}

.current-ai-model {
    font-weight: bold;
    color: #4CAF50;
}

/* Header Room Display */
.header-room-display {
    display: flex;
    align-items: center;
    gap: 12px;
    background-color: rgba(255, 255, 255, 0.1);
    padding: 5px 15px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.room-code-label {
    font-size: 14px;
    font-weight: 500;
    color: #444;
}

.room-code-value {
    font-size: 20px;
    font-weight: bold;
    color: #3f51b5;
    letter-spacing: 2px;
}

.qr-code {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.qr-code:hover {
    transform: scale(3.5);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    border: 2px solid white;
}

/* Loading Overlay - Removed duplicate CSS */

/* ============================================
   MY LIBRARY - MODERN INTERFACE
   ============================================ */

.library-page {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #f8fafc;
    z-index: 2000;
    overflow-y: auto;
}

/* Library Header */
.library-page-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 20px rgba(0,0,0,0.1);
}

.library-title-section {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.library-title {
    font-size: 28px;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.library-icon {
    font-size: 32px;
}

.library-subtitle {
    margin: 0;
    opacity: 0.9;
    font-size: 16px;
}

.library-actions .btn-secondary {
    background: rgba(255,255,255,0.2);
    color: white;
    border: 2px solid rgba(255,255,255,0.3);
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.library-actions .btn-secondary:hover {
    background: rgba(255,255,255,0.3);
    border-color: rgba(255,255,255,0.5);
    transform: translateY(-2px);
}

/* Library Tabs */
.library-tabs {
    background: white;
    padding: 0 30px;
    display: flex;
    border-bottom: 1px solid #e2e8f0;
    gap: 0;
}

.library-tab {
    background: none;
    border: none;
    padding: 15px 25px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
    color: #64748b;
    font-size: 15px;
    font-weight: 500;
}

.library-tab:hover {
    color: #475569;
    background: #f8fafc;
}

.library-tab.active {
    color: #667eea;
    border-bottom-color: #667eea;
    background: #f8fafc;
}

.tab-icon {
    font-size: 18px;
}

/* Library Content */
.library-content {
    padding: 30px;
    max-width: 1400px;
    margin: 0 auto;
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

/* Tab Layout */
.tab-layout {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 30px;
    min-height: 500px;
}

/* Section Headers */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e2e8f0;
}

.section-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #1e293b;
}

.item-count {
    background: #667eea;
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 500;
}

/* Lists Section */
.list-section {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
    border: 1px solid #e2e8f0;
}

.items-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-height: 600px;
    overflow-y: auto;
}

/* Library Items */
.library-item {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 20px;
    transition: all 0.3s ease;
    position: relative;
}

.library-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
    border-color: #cbd5e1;
}

.item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.item-title-section {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    flex: 1;
}

.item-icon {
    font-size: 24px;
    background: white;
    padding: 8px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    flex-shrink: 0;
}

.item-title-group {
    flex: 1;
}

.item-title {
    margin: 0 0 5px 0;
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
    line-height: 1.3;
}

.item-description {
    margin: 0;
    color: #64748b;
    font-size: 14px;
    line-height: 1.4;
}

.context-badge {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.item-url {
    margin: 12px 0;
    padding: 8px 12px;
    background: white;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}

.url-link {
    color: #667eea;
    text-decoration: none;
    font-size: 13px;
    font-family: 'Monaco', 'Menlo', monospace;
    word-break: break-all;
}

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

/* Item Actions */
.item-actions {
    display: flex;
    gap: 8px;
    margin-top: 15px;
}

.item-actions button {
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 4px;
}

.btn-edit {
    background: #f1f5f9;
    color: #475569;
    border-color: #cbd5e1;
}

.btn-edit:hover {
    background: #e2e8f0;
    color: #334155;
}

.btn-send {
    background-color: #28a745; /* Green color for send action */
    color: white;
    border-color: #28a745;
    /* הוספנו את המעבר החלק הזה */
    transition: all 0.2s ease;
}

.btn-send:hover {
    background-color: #218838; /* Darker green on hover */
    /* הוספנו אפקט הרמה קל במעבר עכבר */
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* --- הכלל החדש שנוסף --- */
.btn-send:active {
    /* אפקט לחיצה - הכפתור "נלחץ" פנימה */
    transform: translateY(0);
    box-shadow: none;
}

.btn-apply {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    border-color: #10b981;
}

.btn-apply:hover {
    background: linear-gradient(135deg, #059669, #047857);
    transform: translateY(-1px);
}

.btn-delete {
    background: #fef2f2;
    color: #dc2626;
    border-color: #fecaca;
}

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

/* Form Section */
.form-section {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
    border: 1px solid #e2e8f0;
    height: fit-content;
    position: sticky;
    top: 20px;
}

.library-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

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

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

.form-group label {
    font-weight: 600;
    color: #374151;
    font-size: 14px;
}

.form-group input,
.form-group textarea {
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.2s ease;
    font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-help {
    color: #6b7280;
    font-size: 12px;
    margin-top: 4px;
}

.form-divider {
    display: flex;
    align-items: center;
    margin: 10px 0;
    color: #6b7280;
    font-size: 13px;
    font-weight: 500;
}

.form-divider::before,
.form-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e5e7eb;
}

.form-divider::before {
    margin-right: 15px;
}

.form-divider::after {
    margin-left: 15px;
}

/* Form Actions */
.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    justify-content: center;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.btn-cancel {
    background: #f8fafc;
    color: #64748b;
    border: 1px solid #cbd5e1;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-cancel:hover {
    background: #f1f5f9;
    color: #475569;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #64748b;
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.7;
}

.empty-state p {
    margin: 0 0 5px 0;
    font-size: 16px;
    font-weight: 500;
}

.empty-state small {
    font-size: 14px;
    opacity: 0.8;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .tab-layout {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .form-section {
        position: static;
    }
}

@media (max-width: 768px) {
    .library-page-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
    
    .library-content {
        padding: 20px 15px;
    }
    
    .library-tabs {
        padding: 0 15px;
        flex-wrap: wrap;
}

/* ============================================
   START LESSON MODAL
   ============================================ */

.lesson-context-section {
    margin: 20px 0;
    padding: 20px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.context-label {
    display: block;
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
    font-size: 14px;
}

.context-selector {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    background: white;
    transition: all 0.2s ease;
    margin-bottom: 8px;
}

.context-selector:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.context-help {
    color: #6b7280;
    font-size: 12px;
    line-height: 1.4;
    display: block;
    margin-top: 8px;
}

/* ============================================
   LESSON CONTEXT DISPLAY
   ============================================ */

.context-info {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid #0284c7;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.context-status {
    display: flex;
    align-items: center;
    gap: 12px;
}

.context-label {
    font-weight: 600;
    color: #0369a1;
    font-size: 14px;
}

.context-name {
    background: #0284c7;
    color: white;
    padding: 6px 16px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 14px;
}

.context-actions .btn-secondary {
    background: white;
    color: #0284c7;
    border: 2px solid #0284c7;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.context-actions .btn-secondary:hover {
    background: #0284c7;
    color: white;
    transform: translateY(-1px);
}

/* ============================================
   RESPONSIVE DESIGN UPDATES
   ============================================ */
    
    .library-tab {
        flex: 1;
        min-width: 150px;
        justify-content: center;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .item-actions {
        flex-wrap: wrap;
    }
}

/* Poll Styles */
.poll-type-btn {
    padding: 15px 20px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background: white;
    color: #333;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.poll-type-btn:hover {
    border-color: #42a5f5;
    background: #f0f8ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(66, 165, 245, 0.2);
}

.poll-type-btn:active {
    transform: translateY(0);
}

#poll-results-container {
    margin-top: 20px;
}

#poll-results-container > div {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 10px;
    border-left: 4px solid #42a5f5; /* Changed from border-right for LTR */
}

#stop-poll-btn {
    background: #e74c3c;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    margin-top: 20px;
    font-weight: 500;
    transition: all 0.3s ease;
}

#stop-poll-btn:hover {
    background: #c0392b;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
}

/* Logo Styles */
.logo-icon {
  font-size: 1.3em;
  margin-right: 8px;
  vertical-align: middle;
}

.logo-text {
  vertical-align: middle;
}

/* High Z-index Elements */
#classroom-ai-btn {
    z-index: 10001 !important;
    position: fixed !important;
}

#classroom-ai-container {
    z-index: 10002 !important;
    position: fixed !important;
}

#poll-creation-modal,
#open-question-modal {
    z-index: 9998 !important;
}

/* Enhanced Poll Creation Modal Styles */
.poll-step {
    transition: all 0.3s ease;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.form-input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e1e5e9;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.form-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.poll-actions {
    display: flex;
    gap: 15px;
    justify-content: space-between;
    margin-top: 25px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
    background: #f8f9fa;
    color: #6c757d;
    padding: 12px 24px;
    border: 2px solid #e1e5e9;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

/* Poll Options Styles */
#poll-options-container {
    margin-top: 20px;
}

.option-input {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    align-items: center;
}

.option-text {
    flex: 1;
}

.remove-option-btn {
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.remove-option-btn:hover {
    background: #c82333;
    transform: scale(1.1);
}

#add-option-btn {
    margin-top: 10px;
    width: 100%;
}

/* Enhanced Poll Results Styles */
.result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    margin: 8px 0;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 4px solid #667eea;
}

.option {
    font-weight: 600;
    color: #333;
}

.count {
    background: #667eea;
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.percentage {
    color: #6c757d;
    font-weight: 500;
}

.response-item {
    padding: 12px;
    margin: 8px 0;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 4px solid #28a745;
}

/* AI Analysis Buttons */
#ai-summarize-btn, #ai-keywords-btn {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    margin-right: 10px;
}

#ai-summarize-btn:hover, #ai-keywords-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
}

#classroom-chat-btn {
    z-index: 10000 !important;
}

#classroom-chat-container {
    z-index: 10001 !important;
}

/* ================================================= */
/* ========== NEW HEADER STYLES - OVERHAUL ========= */
/* ================================================= */

/* 1. Fix Header Overflow & Layout */
.nav-container {
    justify-content: normal;
    gap: 15px; /* Reduced gap */
}

.header-left, .header-right {
    display: flex;
    align-items: center;
    gap: 15px; /* Reduced gap */
    flex-shrink: 0;
}

.header-center {
    flex-grow: 1;
    display: flex;
    justify-content: center;
    min-width: 0;
}

.nav-link {
    padding: 12px 15px; /* Reduced padding */
}

/* 2. Redesigned Connection Status Indicator */
.status-indicator {
    display: none;
}

#connectionStatus {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: #f39c12;
    transition: all 0.3s ease;
    cursor: help;
    animation: pulse 2s infinite;
}

#connectionStatus.connected {
    background-color: #27ae60;
    box-shadow: 0 0 10px #27ae60;
}

#connectionStatus.disconnected {
    background-color: #e74c3c;
    box-shadow: 0 0 10px #e74c3c;
}

/* 3. New Action Buttons */
#resetScreensBtn {
    display: none !important;
}

.dropdown-action-btn {
    position: relative;
}

.main-action-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: white;
    border: 2px solid white;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.main-action-icon.green {
    background: #27ae60; /* Green color for logout */
}

.main-action-icon.green:hover {
    background: #229954; /* Darker green */
    transform: scale(1.1);
}

.dropdown-action-btn .main-action-icon {
    background: #e74c3c;
}

.dropdown-action-btn:hover .main-action-icon {
    transform: scale(1.1) rotate(90deg);
    background: #c0392b;
}

.dropdown-action-btn .dropdown {
    left: auto;
    right: 0;
    top: 90%;
}

.dropdown-action-btn:hover .dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* ================================================= */
/* ============ MOCK PHONE AUTHENTICATION SCREEN STYLES ============ */
/* ================================================= */

/* Styles for Mock Phone Authentication Screen */
#login-bypass-placeholder {
    display: none; /* Controlled by JS */
    align-items: center;
    justify-content: center;
    text-align: center;
    width: 100%;
    height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 1rem;
}

.placeholder-box {
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
    max-width: 500px;
    width: 90%;
    border-top: 5px solid #667eea;
}

.info-text {
    font-size: 1.1rem;
    color: #333;
    margin: 20px 0;
    line-height: 1.6;
}

#otp-form {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#otp-input {
    width: 280px;
    padding: 15px;
    font-size: 2.5rem;
    text-align: center;
    letter-spacing: 0.5em; /* Spreads out the digits */
    border-radius: 8px;
    border: 2px solid #ddd;
    margin-bottom: 15px;
    font-family: 'Courier New', monospace;
}

#otp-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 8px rgba(102, 126, 234, 0.3);
}

.fine-print {
    font-size: 0.8rem;
    color: #777;
    font-style: italic;
    margin-bottom: 25px;
}

.placeholder-box .main-button {
    width: 100%;
    max-width: 280px;
    padding: 15px 30px;
    font-size: 18px;
    font-weight: 600;
    color: white;
    background: linear-gradient(45deg, #28a745, #218838);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.placeholder-box .main-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.2);
}

/* =========================================================== */
/* ========= CONTENT & PROMPT MANAGER MODAL STYLES V2 ======== */
/* =========================================================== */

/* Main modal body layout */
.modal-body {
    /* Ensure it can grow */
    flex-grow: 1;
    overflow-y: hidden; /* Prevent double scrollbars */
}

/* Tabs */
.tabs {
    display: flex;
    border-bottom: 1px solid #eee;
    background: #f8f9fa;
    flex-shrink: 0; /* Prevent tabs from shrinking */
}
.tab-link {
    padding: 15px 20px;
    cursor: pointer;
    border: none;
    background: none;
    font-size: 16px;
    font-weight: 500;
    color: #555;
    border-bottom: 3px solid transparent;
    transition: all 0.2s ease;
}
.tab-link:hover { background: #e9ecef; }
.tab-link.active {
    color: #007bff;
    border-bottom-color: #007bff;
}

/* Tab Content Layout */
.tab-content {
    display: none;
    height: 100%;
    overflow: hidden;
}
.tab-content.active {
    display: block;
}

/* Two Column Grid Layout */
.two-column-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
    height: 100%;
    padding: 25px;
}

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

.column-left.scrollable {
    overflow-y: auto; /* Enable scrolling only for the left column */
}

.column-right h4, .column-left h4 {
    flex-shrink: 0;
    margin-bottom: 15px;
}

/* List styling */
.content-list {
    border: 1px solid #eee;
    border-radius: 8px;
    flex-grow: 1; /* Make list take up space */
}
.list-item {
    display: flex;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid #eee;
}
.list-item:last-child { border-bottom: none; }
.list-item-icon { font-size: 24px; margin-right: 15px; }
.list-item-details { flex-grow: 1; }
.list-item-title { font-weight: 600; }
.list-item-desc {
    font-size: 13px;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 300px;
}
.list-item-actions button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    margin-left: 10px;
    padding: 5px;
    transition: color 0.2s;
}
.list-item-actions .edit-btn:hover { color: #007bff; }
.list-item-actions .delete-btn:hover { color: #e74c3c; }

/* Form styling */
#personal-content-form, #personal-prompt-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#content-manager-modal input,
#content-manager-modal textarea,
#content-manager-modal select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 14px;
}
#content-manager-modal button {
    padding: 12px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    background: #007bff;
    color: white;
    transition: background 0.2s;
}
#content-manager-modal button:hover { background: #0056b3; }
#content-manager-modal button.secondary { background: #6c757d; }
#content-manager-modal button.secondary:hover { background: #5a6268; }

/* Prompt Wizard Specifics */
.prompt-wizard p {
    margin: 0 0 5px 0;
    font-weight: 500;
}

/* =========================================================== */
/* ========= ENHANCED CONTENT MANAGEMENT MODAL STYLES ======= */
/* =========================================================== */

/* Enhanced Modal Base Styles */
.enhanced-modal-content {
    background: white;
    border-radius: 16px;
    width: 90%;
    max-width: 1200px;
    height: 85vh;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.enhanced-modal-header {
    background: linear-gradient(135deg, #4285f4 0%, #34a853 100%);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.enhanced-modal-header h3 {
    font-size: 24px;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.enhanced-modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s;
}

.enhanced-modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Enhanced Tab Navigation */
.enhanced-tabs {
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    padding: 0 20px;
}

.enhanced-tab-link {
    padding: 15px 25px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    color: #6c757d;
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
}

.enhanced-tab-link.active {
    color: #4285f4;
    border-bottom-color: #4285f4;
}

/* Enhanced Two Column Layout */
.enhanced-two-column-grid {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.enhanced-column-left {
    width: 350px;
    background: #f8f9fa;
    border-right: 1px solid #e9ecef;
    display: flex;
    flex-direction: column;
}

.enhanced-column-left h4 {
    padding: 20px;
    margin: 0;
    background: #e9ecef;
    font-size: 18px;
    color: #495057;
    border-bottom: 1px solid #dee2e6;
}

.enhanced-content-list {
    flex: 1;
    overflow-y: auto;
}

/* Enhanced Content Items */
.enhanced-content-item {
    padding: 15px 20px;
    border-bottom: 1px solid #e9ecef;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
}

.enhanced-content-item:hover {
    background: #e3f2fd;
}

.enhanced-content-item.selected {
    background: #bbdefb;
    border-right: 4px solid #4285f4;
}

.enhanced-content-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
    background: linear-gradient(135deg, #4285f4, #34a853);
    color: white;
}

.enhanced-content-info {
    flex: 1;
    min-width: 0;
}

.enhanced-content-title {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.enhanced-content-description {
    font-size: 12px;
    color: #6c757d;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.enhanced-content-context-badge {
    font-size: 10px;
    background: #e8f5e8;
    color: #2e7d32;
    padding: 2px 6px;
    border-radius: 8px;
    margin-top: 2px;
    display: inline-block;
}

/* Enhanced Small Action Buttons */
.enhanced-content-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.3s;
}

.enhanced-content-item:hover .enhanced-content-actions {
    opacity: 1;
}

.enhanced-action-btn {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: all 0.3s;
}

.enhanced-edit-btn {
    background: #fff3cd;
    color: #856404;
}

.enhanced-edit-btn:hover {
    background: #ffc107;
    color: white;
}

.enhanced-delete-btn {
    background: #f8d7da;
    color: #721c24;
}

.enhanced-delete-btn:hover {
    background: #dc3545;
    color: white;
}

/* Enhanced Right Column */
.enhanced-column-right {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: white;
}

.enhanced-column-right h4 {
    margin-bottom: 20px;
    font-size: 18px;
    color: #2c3e50;
}

.enhanced-detail-section {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid #f0f2f5;
}

.enhanced-detail-section:last-child {
    border-bottom: none;
}

.enhanced-detail-title {
    font-size: 16px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Enhanced Form Styles */
.enhanced-form-group {
    margin-bottom: 15px;
}

.enhanced-form-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #495057;
    font-size: 14px;
}

.enhanced-form-input, .enhanced-form-select, .enhanced-form-textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ced4da;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s;
    font-family: inherit;
}

.enhanced-form-input:focus, .enhanced-form-select:focus, .enhanced-form-textarea:focus {
    outline: none;
    border-color: #4285f4;
    box-shadow: 0 0 0 2px rgba(66, 133, 244, 0.2);
}

.enhanced-form-textarea {
    min-height: 80px;
    resize: vertical;
}

/* Enhanced Context Selector */
.enhanced-context-selector-group {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.enhanced-context-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.enhanced-context-tag {
    background: #e3f2fd;
    color: #1976d2;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
}

/* Enhanced Buttons */
.enhanced-btn-group {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.enhanced-save-btn, .enhanced-new-context-btn {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.enhanced-save-btn {
    background: linear-gradient(135deg, #4285f4, #34a853);
    color: white;
}

.enhanced-save-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(66, 133, 244, 0.3);
}

.enhanced-new-context-btn {
    background: #fff;
    color: #4285f4;
    border: 2px solid #4285f4;
}

.enhanced-new-context-btn:hover {
    background: #4285f4;
    color: white;
}

/* Enhanced Add Content Button */
.enhanced-add-content-btn {
    margin: 15px 20px;
    padding: 12px;
    background: linear-gradient(135deg, #4285f4, #34a853);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: transform 0.3s;
    width: calc(100% - 40px);
}

.enhanced-add-content-btn:hover {
    transform: translateY(-2px);
}

/* Enhanced Empty State */
.enhanced-no-selection {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #6c757d;
    font-size: 16px;
    height: 100%;
}

.enhanced-no-selection-icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.3;
}

/* Enhanced Tab Content */
.enhanced-tab-content {
    display: none;
    flex: 1;
}

.enhanced-tab-content.active {
    display: flex;
}

/* Enhanced AI Prompts Specific Styles */
.enhanced-prompt-item {
    padding: 15px 20px;
    border-bottom: 1px solid #e9ecef;
    cursor: pointer;
    transition: background 0.3s;
}

.enhanced-prompt-item:hover {
    background: #e8f5e8;
}

.enhanced-prompt-item.selected {
    background: #c8e6c9;
    border-right: 4px solid #4caf50;
}

.enhanced-prompt-subject {
    font-weight: 600;
    color: #2e7d32;
    margin-bottom: 4px;
}

.enhanced-prompt-topic {
    font-size: 14px;
    color: #666;
    margin-bottom: 8px;
}

.enhanced-prompt-keywords {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.enhanced-keyword-tag {
    background: #e8f5e8;
    color: #2e7d32;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
}

#reports-container {
    animation: fadeIn 0.5s ease-in-out;
}

.report-header {
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e0e0e0;
}

.report-header h2 {
    font-size: 24px;
    color: #333;
    margin: 0;
}

.report-header p {
    font-size: 16px;
    color: #666;
    margin-top: 5px;
}

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

.report-card {
    background-color: #ffffff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
    border-left: 4px solid #42a5f5;
}

.report-card h4 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #1976d2;
    font-size: 18px;
}

.report-card p {
    margin: 8px 0;
    font-size: 15px;
}

.stat-number {
    font-weight: bold;
    font-size: 22px;
    color: #333;
    background-color: #f0f4f8;
    padding: 2px 8px;
    border-radius: 4px;
    margin-left: 5px;
}

.report-footer {
    margin-top: 30px;
    text-align: center;
    color: #888;
    font-style: italic;
}

.spinner-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #42a5f5;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ============ NEW LIBRARY LAYOUT STYLES ============ */

/* Main Library Container */
.library-page-new {
    display: flex;
    height: calc(100vh - 70px); /* Subtract header height */
    background: #f8f9fa;
    position: relative;
}

/* Sidebar */
.library-sidebar {
    width: 280px;
    background: white;
    border-right: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
}

.library-sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.library-sidebar-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

/* Navigation */
.library-nav {
    flex: 1;
    padding: 20px 0;
}

.library-nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px 20px;
    color: #555;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.library-nav-link:hover {
    background: #f8f9fa;
    color: #667eea;
    border-left-color: #667eea;
}

.library-nav-link.active {
    background: #e8f4fd;
    color: #1976d2;
    border-left-color: #1976d2;
}

.library-nav-link span {
    font-size: 18px;
}

/* Main Content Area */
.library-main-content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

/* Split View Layout */
.library-split-view {
    display: flex;
    gap: 20px;
    height: 100%;
}

.library-pane {
    flex: 1;
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
}

.library-pane h2 {
    margin: 0 0 20px 0;
    font-size: 18px;
    color: #333;
    padding-bottom: 10px;
    border-bottom: 2px solid #e0e0e0;
}

/* Transfer Actions */
.transfer-actions {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 10px;
    padding: 20px;
}

.transfer-actions button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

.transfer-actions button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.transfer-actions button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Items Lists */
.items-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Private Library Items */
.library-item-private {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 4px solid #28a745;
    transition: all 0.3s ease;
}

.library-item-private:hover {
    background: #e9ecef;
    transform: translateX(2px);
}

.item-details {
    flex: 1;
}

.item-details strong {
    display: block;
    color: #333;
    font-size: 14px;
    margin-bottom: 4px;
}

.item-details small {
    color: #666;
    font-size: 12px;
}

.item-actions {
    display: flex;
    gap: 8px;
}

.item-actions button {
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-edit {
    background: #007bff;
    color: white;
}

.btn-edit:hover {
    background: #0056b3;
}

.btn-send {
    background-color: #28a745; /* Green color for send action */
    color: white;
    border-color: #28a745;
    /* הוספנו את המעבר החלק הזה */
    transition: all 0.2s ease;
}

.btn-send:hover {
    background-color: #218838; /* Darker green on hover */
    /* הוספנו אפקט הרמה קל במעבר עכבר */
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* --- הכלל החדש שנוסף --- */
.btn-send:active {
    /* אפקט לחיצה - הכפתור "נלחץ" פנימה */
    transform: translateY(0);
    box-shadow: none;
}

.btn-delete {
    background: #dc3545;
    color: white;
}

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

/* Public Library Items */
.library-item-public {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.library-item-public:hover {
    background: #f8f9fa;
    border-color: #667eea;
}

.item-checkbox {
    width: 18px;
    height: 18px;
    accent-color: #667eea;
}

.library-item-public label {
    flex: 1;
    cursor: pointer;
    font-size: 14px;
    color: #333;
    margin: 0;
}

/* Empty States */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.empty-state p {
    margin: 0;
    font-size: 14px;
}

/* Back Button */
#back-to-classroom-btn {
    margin: 20px;
    background: #6c757d;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

#back-to-classroom-btn:hover {
    background: #5a6268;
    transform: translateY(-1px);
}

/* Create New Button */
.btn-create-new {
    margin-top: 15px;
    background: #28a745;
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

.btn-create-new:hover {
    background: #218838;
    transform: translateY(-1px);
}

/* Responsive Design */
@media (max-width: 1200px) {
    .library-sidebar {
        width: 240px;
    }
    
    .library-split-view {
        gap: 15px;
    }
    
    .library-pane {
        padding: 15px;
    }
}

@media (max-width: 768px) {
    .library-page-new {
        flex-direction: column;
        height: auto;
    }
    
    .library-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
    }
    
    .library-split-view {
        flex-direction: column;
        gap: 15px;
    }
    
    .transfer-actions {
        flex-direction: row;
        justify-content: center;
    }
}

/* Admin-specific view enhancements */
.library-split-view.admin-view {
    display: flex;
    flex-direction: column;
}

.library-split-view.admin-view .library-pane.full-width {
    width: 100%;
    border-right: none; /* Remove separator border */
}

.library-split-view.admin-view h2 {
    color: #2c3e50;
    font-size: 1.5em;
    margin-bottom: 20px;
    text-align: center;
}

.library-split-view.admin-view .btn-create-new {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: bold;
    margin-top: 20px;
    transition: all 0.3s ease;
}

.library-split-view.admin-view .btn-create-new:hover {
    background: #0056b3;
    transform: translateY(-1px);
}

/* Hide admin-only elements for non-admins */
.library-nav-link.admin-only {
    display: none;
}

/* Show for admins */
.admin-user .library-nav-link.admin-only {
    display: flex;
}

/* ================================================= */
/* ========== POP-UP NOTIFICATION STYLES ========== */
/* ================================================= */

.note-container {
    background-color: #fff8e1;
    border-left: 5px solid #ffeb3b;
    padding: 15px;
    margin-top: 20px;
    border-radius: 4px;
    font-size: 0.9rem;
    line-height: 1.4;
}

.note-container p {
    margin: 0;
    color: #333;
}

/* ================================================= */
/* ========== POLL MODAL BUTTON STYLES ============ */
/* ================================================= */

.poll-type-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px 20px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    width: 100%;
}

.poll-type-btn:hover {
    background: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.2);
}

.poll-type-btn:active {
    transform: translateY(0);
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}