/* Urdu Font Styling */
.urdu-text {
    font-family: 'Arial Unicode MS', 'Tahoma', 'Segoe UI', sans-serif;
    font-size: 1.2em;
    line-height: 1.6;
    direction: rtl;
    text-align: right;
    /* Better visibility for Urdu text */
    color: #2c3e50;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.english-text {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    direction: ltr;
    text-align: left;
}

/* Enhanced Urdu text for better readability */
.urdu-enhanced {
    font-family: 'Arial Unicode MS', 'Tahoma', 'Segoe UI', sans-serif;
    font-size: 1.3em;
    line-height: 1.8;
    direction: rtl;
    text-align: right;
    color: #1a252f;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

/* Ensure body uses reliable fonts */
body {
    font-family: 'Arial Unicode MS', 'Tahoma', 'Segoe UI', sans-serif;
}

/* Main container for both upload section and chat window */
.main-container {
    display: flex;
    gap: 30px;
    width: 80%;
    max-width: 1200px;
}

/* File upload section */
.upload-section {
    width: 250px;
    background-color: #fafafa;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.upload-section h3 {
    font-size: 18px;
    margin-bottom: 10px;
    color: #333;
}

.file-inputs {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.file-input {
    display: flex;
    flex-direction: column;
}

.file-label {
    font-size: 14px;
    margin-bottom: 5px;
    color: #333;
}

input[type="file"] {
    font-size: 14px;
    padding: 8px;
    background-color: #fff;
    border: 1px solid #ccc;
    border-radius: 5px;
    cursor: pointer;
    width: 100%;
}

.upload-btn {
    padding: 10px 20px;
    background-color: #007bff;
    color: #fff;
    font-size: 16px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    width: 100%;
}

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

/* Chatbox section */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: #ffffff;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

header {
    text-align: center;
    margin-bottom: 20px;
}

header h1 {
    font-size: 24px;
    color: #007bff;
}

/* Chatbox content */
.chat-box {
    flex: 1;
    padding: 15px;
    background-color: #f9f9f9;
    border-radius: 8px;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.05);
    overflow-y: auto;
    margin-bottom: 20px;
    max-height: 400px;
}

/* Chat message styles */
.message {
    margin: 10px 0;
    font-size: 16px;
}

.message.user {
    text-align: right;
    color: #007bff;
}

.message.bot {
    text-align: left;
    color: #333;
}

/* User input container */
.input-container {
    display: flex;
    gap: 10px;
    justify-content: space-between;
}

.input-container input {
    flex: 1;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 5px;
    outline: none;
    font-size: 16px;
    color: #333;
}

.input-container button {
    padding: 12px 20px;
    background-color: #007bff;
    color: #fff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

.input-container button:hover {
    background-color: #0056b3;
}

/* Responsive Design */
@media (max-width: 768px) {
    .main-container {
        flex-direction: column;
        gap: 20px;
    }

    .upload-section {
        width: 100%;
        padding: 15px;
    }

    .chat-container {
        width: 100%;
    }

    .input-container {
        flex-direction: column;
        gap: 10px;
    }
}

/* Allowed formats text styling */
.allowed-formats {
    font-size: 12px;
    color: #666;
    margin-top: 5px;
    font-style: italic;
    display: inline-block;
    background-color: #f5f7fa;
    padding: 5px;
    border: 1px dashed #ccc;
    border-radius: 5px;
}

.hilight {
    background-color: #FFF9C4;
    font-weight: bold;
    padding: 0 2px;
    border-radius: 3px;
}

/* Suggested Questions Styling */
#suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

#suggestions button {
    display: inline-block;
    margin: 5px 8px 5px 0;
    padding: 12px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    text-align: center;
    max-width: 200px;
    word-wrap: break-word;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#suggestions button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    background: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
}

#suggestions button:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

/* Token Usage Display */
.token-display {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.8);
    color: #00ff88;
    padding: 12px 16px;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    z-index: 1000;
    backdrop-filter: blur(10px);
    border: 1px solid #00ff88;
    box-shadow: 0 4px 15px rgba(0, 255, 136, 0.3);
}

.token-display .token-count {
    font-weight: bold;
    color: #00ff88;
}

.token-display .model-name {
    color: #ffffff;
    font-size: 10px;
    margin-top: 4px;
}

/* Token Usage Section */
.token-section {
    width: 250px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    display: flex;
    flex-direction: column;
    gap: 15px;
    color: white;
}

/* Suggestions Container */
.suggestions-container {
    margin: 15px 0 25px 0;
    padding: 25px;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 16px;
    border: 2px solid #e2e8f0;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
    position: relative;
}

.suggestions-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #667eea, #764ba2, #f093fb);
    border-radius: 16px 16px 0 0;
}

.suggestions-container h3 {
    margin: 0 0 20px 0;
    color: #2d3748;
    font-size: 20px;
    font-weight: 700;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
}

.suggestions-container h3::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translate(-50%);
    width: 40px;
    height: 3px;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 2px;
}

#token-display {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.token-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.token-label {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.9);
}

.token-count {
    font-size: 16px;
    font-weight: bold;
    color: #00ff88;
    font-family: 'Courier New', monospace;
}

/* File Management Styles */
.file-management {
  margin-top: 20px;
  padding: 20px;
  background: #f8f9fa;
  border-radius: 8px;
  border: 1px solid #dee2e6;
}

.file-management h4 {
  margin: 0 0 15px 0;
  color: #495057;
  font-size: 16px;
}

.file-list {
  margin-bottom: 15px;
}

.file-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  margin: 8px 0;
  background: white;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.file-item:hover {
  border-color: #007bff;
  box-shadow: 0 2px 4px rgba(0,123,255,0.1);
}

.file-info {
  display: flex;
  align-items: center;
  gap: 15px;
  flex-wrap: wrap;
}

.file-name {
  font-weight: 600;
  color: #212529;
  min-width: 150px;
}

.file-type {
  background: #e9ecef;
  color: #495057;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

.file-size {
  color: #6c757d;
  font-size: 14px;
  min-width: 60px;
}

.chunk-count {
  color: #28a745;
  font-size: 14px;
  font-weight: 500;
  min-width: 80px;
}

.upload-date {
  color: #6c757d;
  font-size: 12px;
  min-width: 120px;
}

.delete-btn {
  background: #dc3545;
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  transition: background 0.2s ease;
}

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

.danger-btn {
  background: #dc3545;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  margin-left: 10px;
  transition: background 0.2s ease;
}

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

/* Enhanced upload section */
.upload-section {
  background: white;
  padding: 25px;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  margin-bottom: 25px;
}

.upload-section h3 {
  margin: 0 0 20px 0;
  color: #2c3e50;
  font-size: 20px;
}

.file-inputs {
  margin-bottom: 20px;
  padding: 15px;
  background: #f8f9fa;
  border-radius: 6px;
  border: 1px solid #dee2e6;
}

.file-input {
  margin-bottom: 15px;
}

.file-input label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: #495057;
}

.file-input input[type="file"] {
  width: 100%;
  padding: 8px;
  border: 2px dashed #dee2e6;
  border-radius: 6px;
  background: white;
  cursor: pointer;
}

.file-input input[type="file"]:hover {
  border-color: #007bff;
}

.upload-section button {
  background: #007bff;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  margin-right: 10px;
  transition: background 0.2s ease;
}

.upload-section button:hover {
  background: #0056b3;
}

/* Admin UI Styling - Simplified */
.admin-header {
  background: #2c3e50;
  color: white;
  padding: 20px;
  text-align: center;
  margin-bottom: 20px;
}

.admin-header h1 {
  margin: 0 0 10px 0;
  font-size: 2em;
  font-weight: 600;
}

.admin-header p {
  margin: 0;
  font-size: 1em;
  opacity: 0.9;
}

.admin-section {
  background: white;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 20px;
  margin-bottom: 20px;
}

.admin-section h2 {
  margin: 0 0 20px 0;
  color: #2c3e50;
  font-size: 1.5em;
  font-weight: 600;
  border-bottom: 2px solid #3498db;
  padding-bottom: 8px;
}

.admin-section h3 {
  margin: 0 0 15px 0;
  color: #34495e;
  font-size: 1.2em;
  font-weight: 600;
}

.admin-section h4 {
  margin: 0 0 15px 0;
  color: #34495e;
  font-size: 1.1em;
  font-weight: 600;
}

/* Upload Controls */
.upload-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 25px;
}

.upload-group {
  background: #f8f9fa;
  padding: 15px;
  border: 1px solid #e1e8ed;
  border-radius: 6px;
}

.upload-group input[type="file"] {
  margin-bottom: 10px;
  width: 100%;
}

/* File Management */
.file-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

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

/* Token Display */
.token-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 15px;
  margin-bottom: 20px;
}

.token-item {
  background: #f8f9fa;
  padding: 12px;
  border-radius: 4px;
  border: 1px solid #e1e8ed;
}

.token-label {
  display: block;
  font-weight: 600;
  color: #555;
  margin-bottom: 5px;
}

.token-count {
  font-size: 1.1em;
  color: #2c3e50;
  font-weight: 600;
}

/* Chat Section */
.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.suggestions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
  margin-bottom: 15px;
}

/* Button Styling - Simple */
.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.btn-primary {
  background: #3498db;
  color: white;
}

.btn-primary:hover {
  background: #2980b9;
}

.btn-secondary {
  background: #95a5a6;
  color: white;
}

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

.btn-success {
  background: #27ae60;
  color: white;
}

.btn-success:hover {
  background: #229954;
}

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

.btn-danger:hover {
  background: #c0392b;
}

/* Responsive Design */
@media (max-width: 768px) {
  .upload-controls {
    grid-template-columns: 1fr;
  }
  
  .file-header {
    flex-direction: column;
    gap: 10px;
    align-items: flex-start;
  }
  
  .chat-header {
    flex-direction: column;
    gap: 10px;
    align-items: flex-start;
  }
  
  .admin-header h1 {
    font-size: 1.6em;
  }
}

/* Prompt Management */
.prompt-upload {
  background: #f8f9fa;
  padding: 15px;
  border: 1px solid #e1e8ed;
  border-radius: 6px;
  margin-bottom: 20px;
}

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

.prompt-input-wrapper input[type="file"] {
  margin-bottom: 10px;
  width: 100%;
}

.prompt-info {
  margin: 0;
  color: #666;
  font-size: 0.9em;
  font-style: italic;
}

.current-prompt {
  background: #f8f9fa;
  padding: 15px;
  border: 1px solid #e1e8ed;
  border-radius: 6px;
}

.prompt-preview {
  text-align: center;
}

.prompt-preview p {
  margin: 0 0 15px 0;
  color: #666;
}