/* Enhanced styles.css - Combined styles for both chat systems */

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    min-height: 100vh;
    color: #212527;
}

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

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #212529;
    margin-bottom: 40px;
    padding: 1rem 0;
    border-bottom: 2px solid #e9ecef;
}

.header-content {
    text-align: center;
    flex-grow: 1;
}

.header h1 {
    font-size: 3rem;
    margin-bottom: 10px;
    font-weight: 600;
    color: #495057;
}

.header p {
    font-size: 1.2rem;
    opacity: 0.8;
    color: #6c757d;
}


/* Enhanced chatbot header */
.chatbot-header {
    text-align: center;
}

.chatbot-header h2 {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.chatbot-header h2 i {
    color: #667eea;
}

/* Upload Loading Indicator Styles */
.upload-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    backdrop-filter: blur(5px);
}

.upload-loading-container {
    background: white;
    border-radius: 15px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    min-width: 350px;
    position: relative;
}

.upload-loading-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #495057;
    margin-bottom: 10px;
}

.upload-loading-subtitle {
    color: #6c757d;
    margin-bottom: 30px;
    font-size: 0.95rem;
}

.upload-progress-bar {
    width: 100%;
    height: 8px;
    background-color: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    margin: 20px 0;
    position: relative;
}

.upload-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #007bff, #0056b3);
    border-radius: 4px;
    transition: width 0.3s ease;
    position: relative;
}

.upload-progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background-image: linear-gradient(
        -45deg,
        rgba(255, 255, 255, 0.2) 25%,
        transparent 25%,
        transparent 50%,
        rgba(255, 255, 255, 0.2) 50%,
        rgba(255, 255, 255, 0.2) 75%,
        transparent 75%,
        transparent
    );
    background-size: 50px 50px;
    animation: move 2s linear infinite;
}

@keyframes move {
    0% {
        background-position: 0 0;
    }
    100% {
        background-position: 50px 50px;
    }
}

.upload-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #e9ecef;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

.upload-status-text {
    color: #495057;
    font-weight: 500;
    margin-bottom: 10px;
}

.upload-substatus-text {
    color: #6c757d;
    font-size: 0.9rem;
    font-style: italic;
}

.logout-btn {
    background: #007bff;
    color: #ffffff !important;
    border: 2px solid #007bff;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0, 123, 255, 0.3);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.logout-btn:hover {
    background: #0056b3;
    border-color: #0056b3;
    box-shadow: 0 4px 8px rgba(0, 123, 255, 0.4);
    transform: translateY(-1px);
}

.logout-icon {
    font-size: 1rem;

}

.auth-container {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.1);
    max-width: 400px;
    margin: 0 auto;
}

.main-container {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.1);
    display: none;
}

.tab-container {
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
    background: #f8f9fa;
    border-radius: 15px;
    padding: 5px;
}

.tab {
    padding: 15px 30px;
    border: none;
    background: none;
    cursor: pointer;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.3s ease;
    color: #666;
}

.tab.active {
    background: #007bff;
    color: white;
    box-shadow: 0 3px 10px rgba(0,123,255,0.2);
}

.option-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
    margin: 30px 0;
}

.option-card {
    background: #ffffff;
    border-radius: 12px;
    padding: 30px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid #dee2e6;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.option-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
    border-color: #007bff;
}

.option-card.active {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
    border-color: #007bff;
}

.option-card h3 {
    font-size: 1.8rem;
    margin-bottom: 15px;
    color: #495057;
    font-weight: 600;
}

.option-card p {
    font-size: 1rem;
    opacity: 0.8;
    line-height: 1.6;
    color: #6c757d;
}

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

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

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0,123,255,0.1);
}

.btn {
    padding: 15px 30px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,123,255,0.3);
    background: linear-gradient(135deg, #0056b3 0%, #004085 100%);
}

.btn-secondary {
    background: #f8f9fa;
    color: #495057;
    border: 1px solid #dee2e6;
}

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

.hidden {
    display: none !important;
}

/* ==================== SIMPLE CHAT STYLES (Legal Assistant) ==================== */
.chat-container {
    height: 500px;
    border: 2px solid #e0e0e0;
    border-radius: 15px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
}

.chat-input-container {
    padding: 20px;
    background: white;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 10px;
}

.chat-input {
    flex: 1;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 25px;
    font-size: 14px;
}

.chat-send {
    padding: 12px 20px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.chat-send:hover {
    background: #0056b3;
}

.message {
    margin-bottom: 15px;
    padding: 12px 16px;
    border-radius: 15px;
    max-width: 80%;
}

.message.user {
    background: #007bff;
    color: white;
    margin-left: auto;
}

.message.assistant {
    background: white;
    color: #333;
    border: 1px solid #e0e0e0;
}

/* ==================== ENHANCED RAG CHATBOT STYLES ==================== */

.enhanced-chat-container {
    height: 600px;
    border: 2px solid #dee2e6;
    border-radius: 15px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: white;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.enhanced-chat-container .chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #ffffff;
    scroll-behavior: smooth;
}

/* Enhanced message styles for RAG chatbot */
.message.bot-message,
.message.user-message {
    margin-bottom: 20px;
    animation: slideIn 0.3s ease-out;
}

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

.message-content {
    display: flex;
    gap: 15px;
    max-width: 80%;
}

.user-message .message-content {
    margin-left: auto;
    flex-direction: row-reverse;
}

.message-content i {
    font-size: 1.5rem;
    margin-top: 5px;
    min-width: 30px;
}

.bot-message .message-content i {
    color: #667eea;
}

.user-message .message-content i {
    color: #28a745;
}

.text {
    background: #f8f9fa;
    padding: 15px 20px;
    border-radius: 18px;
    line-height: 1.6;
    position: relative;
}

.bot-message .text {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-bottom-left-radius: 5px;
}

.user-message .text {
    background: #28a745;
    color: white;
    border-bottom-right-radius: 5px;
}

.urdu-text {
    background: rgba(255, 255, 255, 0.1);
    padding: 10px;
    border-radius: 10px;
    margin-top: 10px;
    font-family: 'Noto Nastaliq Urdu', Arial, sans-serif;
    direction: rtl;
    text-align: right;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.audio-player {
    margin-top: 10px;
}

.audio-player audio {
    width: 100%;
    height: 35px;
}

.sources {
    margin-top: 15px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.sources h4 {
    margin-bottom: 10px;
    color: #ffd700;
    font-size: 0.9rem;
}

.source-item {
    margin-bottom: 8px;
    font-size: 0.85rem;
    opacity: 0.9;
}

.source-item strong {
    color: #ffd700;
}

/* Enhanced input container for RAG chatbot */
.input-container {
    padding: 20px;
    background: #f8f9fa;
    border-top: 1px solid #dee2e6;
}

.input-wrapper {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

#ragMessageInput {
    flex: 1;
    padding: 15px 20px;
    border: 2px solid #dee2e6;
    border-radius: 25px;
    font-size: 1rem;
    outline: none;
    transition: all 0.3s ease;
}

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

.input-buttons {
    display: flex;
    gap: 10px;
}

.voice-btn, .send-btn {
    width: 50px;
    height: 50px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.voice-btn {
    background: #17a2b8;
    color: white;
}

.voice-btn:hover {
    background: #138496;
    transform: scale(1.05);
}

.voice-btn.recording {
    background: #dc3545;
    animation: pulse 1s infinite;
}

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

.send-btn {
    background: #28a745;
    color: white;
}

.send-btn:hover:not(:disabled) {
    background: #218838;
    transform: scale(1.05);
}

.send-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.recording-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #dc3545;
    font-weight: 500;
    font-size: 0.9rem;
}

.recording-dot {
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0.3; }
}

.status-bar {
    padding: 10px 20px;
    background: #e9ecef;
    text-align: center;
    color: #6c757d;
    font-size: 0.9rem;
    border-top: 1px solid #dee2e6;
}

.status-text {
    opacity: 0.8;
}

.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(108, 117, 125, 0.3);
    border-radius: 50%;
    border-top-color: #6c757d;
    animation: spin 1s ease-in-out infinite;
    margin-right: 10px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Error states */
.error-message {
    background: #dc3545 !important;
    color: white !important;
}

.error-text {
    color: #dc3545;
    font-size: 0.85rem;
    margin-top: 5px;
}

/* RTL support for Urdu text */
.rtl {
    direction: rtl;
    text-align: right;
    font-family: 'Noto Nastaliq Urdu', 'Jameel Noori Nastaleeq', Arial, sans-serif;
}

/* ==================== PRACTICE MODE STYLES ==================== */

.courtroom-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin: 20px 0;
}

.character-panel {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 20px;
    border: 2px solid #e0e0e0;
}

.character-panel h4 {
    margin-bottom: 15px;
    color: #333;
    font-size: 1.1rem;
}

.character-panel.student {
    border-color: #28a745;
    background: #f8fff9;
}

/* ==================== SEARCH AND DOCUMENT MANAGEMENT STYLES ==================== */

.search-results {
    margin-top: 20px;
}

.search-result {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 10px;
    border-left: 4px solid #007bff;
}

.search-result h4 {
    color: #333;
    margin-bottom: 8px;
    font-size: 1rem;
}

.search-result p {
    color: #666;
    font-size: 14px;
    line-height: 1.5;
}

.search-result .date {
    color: #999;
    font-size: 12px;
    margin-top: 8px;
}

/* Search Result Components */
.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.relevance-score {
    background: #e3f2fd;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    color: #1976d2;
    font-weight: 500;
}

.result-snippet {
    background: #f9f9f9;
    padding: 12px;
    border-radius: 6px;
    margin: 10px 0;
    font-style: italic;
    border-left: 3px solid #007bff;
    color: #495057;
}

.result-tags {
    margin: 12px 0;
}

.match-reasons {
    margin-top: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.match-reasons span {
    background: #e8f5e8;
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 11px;
    color: #2e7d32;
    font-weight: 500;
}

.file-upload {
    border: 2px dashed #ccc;
    border-radius: 10px;
    padding: 30px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.file-upload:hover {
    border-color: #007bff;
    background: #f8f9fa;
}

/* Compact Search and Upload Bar */
.search-upload-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #ffffff;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 30px;
    border: 1px solid #dee2e6;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.search-input-group {
    display: flex;
    align-items: center;
    flex: 1;
    margin-right: 20px;
}

.search-input-group input {
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s ease;
    flex: 1;
}

.search-input-group input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0,123,255,0.1);
}

.upload-compact {
    display: flex;
    align-items: center;
}

.upload-btn-compact {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(40,167,69,0.2);
}

.upload-btn-compact:hover {
    background: #218838;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(40,167,69,0.3);
}

.upload-icon {
    font-size: 18px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    margin-right: 6px;
}

.upload-text {
    font-weight: 500;
}

.alert {
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.alert.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    color: #333;
    font-size: 1.25rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: #333;
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #e9ecef;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.upload-modal .file-info {
    background: #f8f9fa;
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.upload-modal .file-info p {
    margin: 8px 0;
    font-size: 14px;
    color: #666;
}

/* Tag Input Styles */
.tag-input-container {
    position: relative;
}

#tagInput {
    width: 100%;
    padding: 12px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 8px;
}

#tagInput:focus {
    outline: none;
    border-color: #007bff;
}

.tag-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    max-height: 150px;
    overflow-y: auto;
    z-index: 100;
}

.tag-suggestion {
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f8f9fa;
    font-size: 14px;
}

.tag-suggestion:hover {
    background: #f8f9fa;
}

.tag-suggestion:last-child {
    border-bottom: none;
}

.selected-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 40px;
    padding: 8px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    background: #f8f9fa;
}

.selected-tag {
    display: inline-flex;
    align-items: center;
    background: #007bff;
    color: white;
    padding: 4px 8px;
    border-radius: 16px;
    font-size: 12px;
    gap: 4px;
}

.selected-tag button {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 0;
    margin-left: 4px;
}

.selected-tag button:hover {
    color: #ccc;
}

/* Enhanced Document Card Styles */
.document-card {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
}

.document-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

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

.document-header h4 {
    margin: 0;
    color: #333;
    font-size: 1.1rem;
    flex: 1;
}

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

.btn-icon {
    background: none;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 6px 12px;
    cursor: pointer;
    font-size: 12px;
    color: #666;
    transition: all 0.2s ease;
}

.btn-icon:hover {
    background: #f8f9fa;
    border-color: #007bff;
    color: #007bff;
}

.document-info {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    font-size: 14px;
    color: #666;
    margin-bottom: 12px;
}

.document-info span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.document-group {
    background: #e7f3ff;
    color: #0066cc;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    margin-bottom: 8px;
    display: inline-block;
}

.document-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tag-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    display: inline-block;
}

/* Group Management Styles */
.group-tree {
    margin-top: 20px;
}

.group-node {
    margin-left: 20px;
    border-left: 2px solid #e9ecef;
    padding-left: 16px;
    margin-bottom: 8px;
}

.group-node:last-child {
    border-left: none;
}

.group-content {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.group-content:hover {
    background: #f8f9fa;
}

.group-toggle {
    width: 16px;
    height: 16px;
    border: none;
    background: none;
    cursor: pointer;
    color: #666;
    font-size: 12px;
}

.group-name {
    font-weight: 500;
    color: #333;
}

.group-count {
    color: #666;
    font-size: 12px;
    background: #f8f9fa;
    padding: 2px 6px;
    border-radius: 10px;
}

/* Practice Mode Styles */
.case-info-panel {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 1px solid #dee2e6;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 25px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.case-info-panel h4 {
    color: #495057;
    font-weight: 600;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.case-info-panel div {
    margin: 8px 0;
    color: #6c757d;
    line-height: 1.4;
}

.case-info-panel strong {
    color: #495057;
    font-weight: 500;
}

.loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px;
    color: #6c757d;
    font-style: italic;
}

.loading-spinner::before {
    content: "";
    width: 20px;
    height: 20px;
    border: 2px solid #e9ecef;
    border-top: 2px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

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

.character-panel {
    background: #ffffff;
    border-radius: 12px;
    padding: 20px;
    border: 2px solid #e9ecef;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
}

.character-panel:hover {
    box-shadow: 0 6px 20px rgba(0,0,0,0.1);
}

.character-panel h4 {
    margin-bottom: 15px;
    color: #495057;
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.character-panel h4::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #28a745;
}

.character-panel.student {
    border-color: #28a745;
    background: linear-gradient(135deg, #f8fff9 0%, #ffffff 100%);
    position: relative;
    padding-bottom: 35px;
}

.character-panel.student h4::before {
    background: #28a745;
}

.character-panel.student::after {
    content: "💡 Tip: Use Ctrl+Enter to submit quickly";
    position: absolute;
    bottom: 10px;
    right: 15px;
    font-size: 11px;
    color: #6c757d;
    font-style: italic;
}

.character-panel:nth-child(2) h4::before {
    background: #6f42c1;
}

.character-panel:nth-child(3) h4::before {
    background: #dc3545;
}

.character-panel:nth-child(4) h4::before {
    background: #fd7e14;
}

.character-panel div[id$="Response"] {
    min-height: 100px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    font-size: 14px;
    line-height: 1.6;
    color: #495057;
    transition: all 0.3s ease;
}

.character-panel div[id$="Response"]:hover {
    background: #ffffff;
    border-color: #dee2e6;
}

.api-warning {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 25px;
    color: #856404;
    border-left: 4px solid #ffc107;
}

.api-warning strong {
    color: #6c5511;
}

.api-status {
    position: absolute;
    top: 15px;
    right: 100px;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.api-status.ready {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.api-status.required {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.end-session-btn {
    margin-top: 25px;
    width: auto;
    padding: 12px 24px;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.end-session-btn:hover {
    background: #5a6268;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.courtroom-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
    margin: 25px 0;
}

#studentArgument {
    resize: vertical;
    min-height: 120px;
    font-size: 15px;
    line-height: 1.5;
    border-radius: 10px;
    border: 2px solid #e9ecef;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

#studentArgument:focus {
    border-color: #28a745;
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.1);
    outline: none;
}

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

.character-panel {
    animation: fadeInUp 0.6s ease-out;
}

.character-panel:nth-child(2) {
    animation-delay: 0.1s;
}

.character-panel:nth-child(3) {
    animation-delay: 0.2s;
}

.character-panel:nth-child(4) {
    animation-delay: 0.3s;
}

#practice-setup .form-group textarea {
    resize: vertical;
    min-height: 100px;
}

#practice-setup .form-group select {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    appearance: none;
    padding-right: 40px;
}

@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        margin: 20px;
    }
    
    .modal-body {
        padding: 16px;
    }
    
    .selected-tags {
        min-height: 60px;
    }
    
    .document-info {
        flex-direction: column;
        gap: 8px;
    }
    
    .courtroom-container {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .api-status {
        position: relative;
        top: auto;
        right: auto;
        margin-bottom: 15px;
        display: inline-block;
    }
}

.view-tabs {
    display: flex;
    border-bottom: 1px solid #e9ecef;
    margin-bottom: 20px;
}

.view-tab {
    padding: 12px 24px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #666;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
}

.view-tab:hover {
    color: #007bff;
    background: #f8f9fa;
}

.view-tab.active {
    color: #007bff;
    border-bottom-color: #007bff;
}

.content-section {
    display: none;
}

.content-section.active {
    display: block;
}

.section-card {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.section-header {
    margin-bottom: 20px;
}

.modal-content .form-group input[type="password"] {
    font-family: 'Courier New', monospace;
    letter-spacing: 1px;
}

.modal-content small a {
    color: #007bff;
    text-decoration: none;
}

.modal-content small a:hover {
    text-decoration: underline;
}
.section-card {
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #dee2e6;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    overflow: hidden;
    margin-bottom: 20px;
}

.section-header {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 20px 25px;
    border-bottom: 1px solid #dee2e6;
}

.section-header h3 {
    font-size: 1.4rem;
    font-weight: 600;
    color: #495057;
    margin: 0 0 5px 0;
}

.section-header p {
    font-size: 0.9rem;
    color: #6c757d;
    margin: 0;
    font-weight: 400;
}

.section-content {
    padding: 25px;
}

.document-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.document-card {
    background: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
}

.document-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border-color: #007bff;
}

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

.document-header h4 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #495057;
    margin: 0;
    flex: 1;
    margin-right: 10px;
}

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

.btn-icon {
    padding: 6px 12px;
    font-size: 0.85rem;
    border-radius: 6px;
    border: 1px solid #dc3545;
    background: #fff;
    color: #dc3545;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-icon:hover {
    background: #dc3545;
    color: white;
    transform: translateY(-1px);
}

.document-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 0.85rem;
    color: #6c757d;
    margin-bottom: 15px;
}

.document-group {
    color: #6c757d;
    font-size: 0.85rem;
    margin: 10px 0;
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 3px solid #007bff;
}

.document-tags {
    margin-top: 15px;
}

.tag-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    margin-right: 6px;
    margin-bottom: 6px;
    color: white;
}

.search-results {
    max-height: 400px;
    overflow-y: auto;
}

.search-result {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 10px;
    border-left: 4px solid #007bff;
    transition: all 0.3s ease;
}

.search-result:hover {
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.search-result h4 {
    color: #333;
    margin-bottom: 8px;
    font-size: 1rem;
}

.search-result p {
    color: #666;
    font-size: 14px;
    line-height: 1.5;
}

.search-result .date {
    color: #999;
    font-size: 12px;
    margin-top: 8px;
}

/* Enhanced Practice Mode Styles */
.case-info-panel {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 1px solid #dee2e6;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 25px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.case-info-panel h4 {
    color: #495057;
    font-weight: 600;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.case-info-panel div {
    margin: 8px 0;
    color: #6c757d;
    line-height: 1.4;
}

.case-info-panel strong {
    color: #495057;
    font-weight: 500;
}

.loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px;
    color: #6c757d;
    font-style: italic;
}

.loading-spinner::before {
    content: "";
    width: 20px;
    height: 20px;
    border: 2px solid #e9ecef;
    border-top: 2px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

.character-panel {
    background: #ffffff;
    border-radius: 12px;
    padding: 20px;
    border: 2px solid #e9ecef;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
}

.character-panel:hover {
    box-shadow: 0 6px 20px rgba(0,0,0,0.1);
}

.character-panel h4 {
    margin-bottom: 15px;
    color: #495057;
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.character-panel h4::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #28a745;
}

.character-panel.student {
    border-color: #28a745;
    background: linear-gradient(135deg, #f8fff9 0%, #ffffff 100%);
}

.character-panel.student h4::before {
    background: #28a745;
}

.character-panel:nth-child(2) h4::before {
    background: #6f42c1; /* Judge - purple */
}

.character-panel:nth-child(3) h4::before {
    background: #dc3545; /* Opponent - red */
}

.character-panel:nth-child(4) h4::before {
    background: #fd7e14; /* Narrator - orange */
}

.character-panel div[id$="Response"] {
    min-height: 100px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    font-size: 14px;
    line-height: 1.6;
    color: #495057;
    transition: all 0.3s ease;
}

.character-panel div[id$="Response"]:hover {
    background: #ffffff;
    border-color: #dee2e6;
}

.api-warning {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 25px;
    color: #856404;
    border-left: 4px solid #ffc107;
}

.api-warning strong {
    color: #6c5511;
}

.api-status {
    position: absolute;
    top: 15px;
    right: 100px;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.api-status.ready {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.api-status.required {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.end-session-btn {
    margin-top: 25px;
    width: auto;
    padding: 12px 24px;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.end-session-btn:hover {
    background: #5a6268;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* Enhanced courtroom layout for better responsiveness */
.courtroom-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
    margin: 25px 0;
}

/* Student argument area enhancements */
#studentArgument {
    resize: vertical;
    min-height: 120px;
    font-size: 15px;
    line-height: 1.5;
    border-radius: 10px;
    border: 2px solid #e9ecef;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

#studentArgument:focus {
    border-color: #28a745;
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.1);
    outline: none;
}

/* Practice mode animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.character-panel {
    animation: fadeInUp 0.6s ease-out;
}

.character-panel:nth-child(2) {
    animation-delay: 0.1s;
}

.character-panel:nth-child(3) {
    animation-delay: 0.2s;
}

.character-panel:nth-child(4) {
    animation-delay: 0.3s;
}

/* Enhanced form styling for practice setup */
#practice-setup .form-group textarea {
    resize: vertical;
    min-height: 100px;
}

#practice-setup .form-group select {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    appearance: none;
    padding-right: 40px;
}

/* Scrollbar styling for both chat systems */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .header p {
        font-size: 1rem;
    }
    
    .message-content {
        max-width: 95%;
    }
    
    .controls {
        justify-content: center;
    }
    
    .input-wrapper {
        flex-direction: column;
        gap: 15px;
    }
    
    .input-buttons {
        justify-content: center;
    }
    
    .search-upload-bar {
        flex-direction: column;
        gap: 15px;
    }
    
    .search-input-group {
        margin-right: 0;
        width: 100%;
    }
    
    .search-input-group input {
        margin-bottom: 10px;
    }
    
    .courtroom-container {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .api-status {
        position: relative;
        top: auto;
        right: auto;
        margin-bottom: 15px;
        display: inline-block;
    }
    
    .option-cards {
        grid-template-columns: 1fr;
    }
}

/* Dark mode support (if needed later) */
@media (prefers-color-scheme: dark) {
    .enhanced-chat-container .chat-messages {
        background: #2d3748;
    }
    
    .text {
        background: #4a5568;
        color: white;
    }
    
    #ragMessageInput {
        background: #4a5568;
        color: white;
        border-color: #718096;
    }
}

/* View Tabs */
.view-tabs {
    display: flex;
    border-bottom: 1px solid #e9ecef;
    margin-bottom: 20px;
}

.view-tab {
    padding: 12px 24px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #666;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
}

.view-tab:hover {
    color: #007bff;
    background: #f8f9fa;
}

.view-tab.active {
    color: #007bff;
    border-bottom-color: #007bff;
}

.content-section {
    display: none;
}

/* Chat Toggle Tabs */
.chat-toggle-container {
    display: flex;
    justify-content: center;
    align-items: center;
}

.toggle-tabs {
    display: flex;
    background: #f8f9fa;
    border-radius: 12px;
    padding: 4px;
    border: 1px solid #dee2e6;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.toggle-tab {
    padding: 12px 24px;
    border: none;
    background: none;
    cursor: pointer;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    color: #6c757d;
    white-space: nowrap;
}

.toggle-tab:hover {
    color: #495057;
    background: rgba(0, 123, 255, 0.1);
}

.toggle-tab.active {
    background: #007bff;
    color: white;
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.3);
}

.chat-interface {
    transition: opacity 0.3s ease;
}

.chat-interface.hidden {
    display: none;
}

.character-panel.student {
    position: relative;
    padding-bottom: 35px;
}
/* Search Results Styles */
.search-results {
    display: none;
}

.search-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 2px solid #007bff;
    padding-bottom: 10px;
}

.search-header h3 {
    color: #333;
    margin: 0;
}

.loading-message {
    text-align: center;
    padding: 40px;
    color: #007bff;
    font-style: italic;
}

.results-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.search-result-item {
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    background: #f8f9fa;
    transition: box-shadow 0.2s ease;
}

.search-result-item:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

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

.result-header h4 {
    margin: 0;
    color: #007bff;
    font-size: 1.1em;
}

.relevance-score {
    background: #28a745;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8em;
    font-weight: bold;
}

.content-snippet {
    color: #666;
    line-height: 1.5;
    margin-bottom: 15px;
    font-style: italic;
}

.result-meta {
    display: flex;
    gap: 15px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.result-meta span {
    background: #e9ecef;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.85em;
    color: #495057;
}

.file-type {
    background: #17a2b8 !important;
    color: white !important;
}

.group-name {
    background: #6f42c1 !important;
    color: white !important;
}

.result-tags {
    margin-bottom: 10px;
}

.result-tags .tag {
    display: inline-block;
    padding: 4px 8px;
    margin-right: 8px;
    border-radius: 4px;
    color: white;
    font-size: 0.8em;
    font-weight: bold;
}

.match-reasons {
    border-top: 1px solid #dee2e6;
    padding-top: 10px;
    margin-top: 10px;
}

.match-reasons small {
    color: #6c757d;
    font-style: italic;
}

.no-results {
    text-align: center;
    padding: 40px;
    color: #6c757d;
}

.no-results h3 {
    color: #495057;
    margin-bottom: 15px;
}

.no-results p {
    margin-bottom: 20px;
    font-style: italic;
}

.error-message {
    background: #f8d7da;
    color: #721c24;
    padding: 15px;
    border-radius: 4px;
    border: 1px solid #f5c6cb;

}
/* Modal Styles */
.modal {
    position: fixed !important;
    z-index: 9999 !important;
    left: 0 !important;
    top: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background-color: rgba(0, 0, 0, 0.5) !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    padding: 20px !important;
    box-sizing: border-box !important;
}

.modal-content {
    background-color: white !important;
    border-radius: 8px !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15) !important;
    width: 100% !important;
    max-width: 500px !important;
    max-height: 80vh !important;
    overflow-y: auto !important;
    position: relative !important;
    transform: translateY(0) !important;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e9ecef;
}

.modal-header h3 {
    margin: 0;
    color: #495057;
}

.modal-body {
    padding: 20px;
}

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

.close {
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    color: #aaa;
    transition: color 0.2s;
}

.close:hover {
    color: #000;
}

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

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #495057;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
    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: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.form-text {
    font-size: 12px;
    color: #6c757d;
    margin-top: 5px;
    display: block;
}
/* Thinking Indicator */
.thinking-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #666;
    font-style: italic;
}

.thinking-dots {
    display: flex;
    gap: 4px;
}

.thinking-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #007bff;
    animation: thinking-pulse 1.4s infinite ease-in-out;
}

.thinking-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.thinking-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

.thinking-dots span:nth-child(3) {
    animation-delay: 0s;
}

@keyframes thinking-pulse {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

.message.thinking {
    opacity: 0.8;
}

/* In styles.css */
.admin-btn {
    background: #007bff;
    color: #ffffff;
    border: 2px solid #007bff;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(111, 66, 193, 0.3);
    margin-left: 10px;
}

.admin-btn:hover {
    background: #0056b3;
    border-color: #0056b3;
    box-shadow: 0 4px 8px rgba(111, 66, 193, 0.4);
    transform: translateY(-1px);
}

.admin-btn.hidden {
    display: none;
}

/* Multi-Document Selector Styles */
.multi-doc-selector {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 15px;
}

.multi-doc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e9ecef;
}

.multi-doc-header h4 {
    margin: 0;
    color: #495057;
    font-size: 1rem;
}

.multi-doc-actions {
    display: flex;
    gap: 10px;
}

.btn-link {
    background: none;
    border: none;
    color: #007bff;
    cursor: pointer;
    font-size: 0.9rem;
    text-decoration: underline;
    padding: 0;
}

.btn-link:hover {
    color: #0056b3;
}

.multi-doc-list {
    max-height: 400px;
    overflow-y: auto;
    margin-bottom: 15px;
}

.multi-doc-item {
    display: flex;
    align-items: flex-start;
    padding: 12px;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.multi-doc-item:hover {
    background: #f8f9fa;
    border-color: #007bff;
}

.multi-doc-item.selected {
    background: #e7f3ff;
    border-color: #007bff;
    box-shadow: 0 2px 4px rgba(0, 123, 255, 0.1);
}

.multi-doc-item input[type="checkbox"] {
    margin-right: 12px;
    margin-top: 2px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.doc-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.doc-title {
    font-weight: 500;
    color: #333;
    font-size: 0.95rem;
}

.doc-meta {
    font-size: 0.85rem;
    color: #6c757d;
}

.embedding-status {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.75rem;
    background: #e9ecef;
}

.multi-doc-footer {
    padding-top: 10px;
    border-top: 1px solid #e9ecef;
    text-align: right;
}

.selection-count {
    font-size: 0.9rem;
    color: #495057;
    font-weight: 500;
}

/* Scrollbar styling for document list */
.multi-doc-list::-webkit-scrollbar {
    width: 8px;
}

.multi-doc-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.multi-doc-list::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.multi-doc-list::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Responsive design */
@media (max-width: 768px) {
    .multi-doc-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .multi-doc-list {
        max-height: 300px;
    }
}

.formatted-content {
    white-space: pre-wrap !important;
    font-family: 'Courier New', Courier, monospace;
    line-height: 1.6;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 4px solid #007bff;
    overflow-x: auto;
    margin-bottom: 10px;
}

/* ============ NEW TEMPLATE GENERATOR STYLES ============ */

.template-interface {
    max-width: 900px;
    margin: 0 auto;
}

.template-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

.template-step {
    padding: 30px;
    animation: fadeIn 0.3s ease-in;
}

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

.step-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e9ecef;
}

.step-number {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: bold;
    flex-shrink: 0;
}

.step-header h3 {
    margin: 0;
    color: #212529;
    font-size: 24px;
    font-weight: 600;
}

.step-header p {
    margin: 5px 0 0 0;
    color: #6c757d;
    font-size: 14px;
}

.form-section {
    max-width: 700px;
}

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

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

.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.2s;
    font-family: inherit;
}

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

.document-selection-box {
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 15px;
    max-height: 400px;
    overflow-y: auto;
    background: #f8f9fa;
}

.checkbox-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.checkbox-list label {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: normal;
}

.checkbox-list label:hover {
    border-color: #667eea;
    background: #f0f2ff;
}

.checkbox-list input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-right: 12px;
    cursor: pointer;
    accent-color: #667eea;
}

.checkbox-list label.checked {
    border-color: #667eea;
    background: #f0f2ff;
}

.help-text {
    margin-top: 8px;
    font-size: 13px;
    color: #6c757d;
}

.btn-large {
    padding: 14px 30px;
    font-size: 16px;
    font-weight: 600;
}

.template-form-wrapper {
    max-width: 700px;
}

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

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

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

.form-field .field-description {
    font-size: 12px;
    color: #6c757d;
    margin-top: 4px;
}

.form-field input[type="text"],
.form-field input[type="date"],
.form-field input[type="number"],
.form-field textarea,
.form-field select {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
}

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

.form-actions {
    display: flex;
    gap: 15px;
    padding-top: 20px;
    border-top: 2px solid #e9ecef;
}

.preview-container {
    max-width: 800px;
}

.document-preview {
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 30px;
    margin-bottom: 30px;
    min-height: 400px;
    max-height: 600px;
    overflow-y: auto;
    font-family: 'Georgia', serif;
    line-height: 1.8;
}

.document-preview h1, .document-preview h2, .document-preview h3 {
    color: #212529;
    margin-top: 20px;
    margin-bottom: 10px;
}

.document-preview p {
    margin-bottom: 15px;
    color: #495057;
}

.refinement-section {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 8px;
    margin-bottom: 30px;
    border-left: 4px solid #667eea;
}

.refinement-section h4 {
    margin: 0 0 10px 0;
    color: #212529;
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.refinement-section h4 i {
    color: #667eea;
}

.refinement-help {
    margin: 0 0 15px 0;
    font-size: 13px;
    color: #6c757d;
}

.refinement-section textarea {
    margin-bottom: 15px;
}

.btn-success {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-success:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

.loading-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: #6c757d;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

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

.loading-indicator p {
    margin: 0;
    font-size: 16px;
    color: #495057;
}

/* Responsive adjustments for template generator */
@media (max-width: 768px) {
    .template-step {
        padding: 20px 15px;
    }
    
    .step-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .step-number {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .form-actions button {
        width: 100%;
    }
    
    .document-preview {
        padding: 20px;
    }
}