/**
 * Document System CSS
 * 
 * This file contains the styles for the document upload system.
 */

/* Upload area styles */
.upload-area {
  border: 2px dashed #ccc;
  border-radius: 5px;
  padding: 20px;
  text-align: center;
  cursor: pointer;
  margin-bottom: 20px;
  transition: border-color 0.3s ease;
}

.upload-area:hover {
  border-color: #007bff;
}

/* File list styles */
.file-list {
  margin-top: 20px;
}

.file-item {
  padding: 15px;
  margin-bottom: 10px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 0.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 250ms;
  background-color: #ffffff;
}

.file-item:hover {
  border-color: rgba(0, 0, 0, 0.15);
  box-shadow: rgba(0, 0, 0, 0.1) 0 4px 12px;
  transform: translateY(-1px);
}

.file-info {
  flex: 1;
}

/* Button styles - following the template */
.btn {
  align-items: center;
  background-color: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 0.25rem;
  box-shadow: rgba(0, 0, 0, 0.02) 0 1px 3px 0;
  box-sizing: border-box;
  color: rgba(0, 0, 0, 0.85);
  cursor: pointer;
  display: inline-flex;
  font-family: system-ui, -apple-system, system-ui, "Helvetica Neue", Helvetica,
    Arial, sans-serif;
  font-size: 14px;
  font-weight: 600;
  justify-content: center;
  line-height: 1.25;
  min-height: 2.5rem;
  padding: calc(0.5rem - 1px) calc(1rem - 1px);
  text-decoration: none !important;
  transition: all 250ms;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  vertical-align: baseline;
  width: auto;
}

.btn:hover,
.btn:focus {
  border-color: rgba(0, 0, 0, 0.15);
  box-shadow: rgba(0, 0, 0, 0.1) 0 4px 12px;
  color: rgba(0, 0, 0, 0.65);
  transform: translateY(-1px);
}

.btn:active {
  background-color: #f0f0f1;
  border-color: rgba(0, 0, 0, 0.15);
  box-shadow: rgba(0, 0, 0, 0.06) 0 2px 4px;
  color: rgba(0, 0, 0, 0.65);
  transform: translateY(0);
}

/* Button color variants */
.btn-primary {
  background-color: #0d6efd;
  color: white !important;
}

.btn-primary:hover,
.btn-primary:focus {
  background-color: #0b5ed7;
  color: white !important;
}

/* Custom DOCX button style */
.btn-docx {
  background-color: #154dae;
  color: white !important;
}

.btn-docx:hover,
.btn-docx:focus {
  background-color: #1243a0;
  color: white !important;
}

.btn-success {
  background-color: #198754;
  color: white !important;
}

.btn-success:hover,
.btn-success:focus {
  background-color: #157347;
  color: white !important;
}

.btn-info {
  background-color: #0dcaf0;
  color: white !important;
}

.btn-info:hover,
.btn-info:focus {
  background-color: #31d2f2;
  color: white !important;
}

.btn-danger {
  background-color: #dc3545;
  color: white !important;
}

.btn-danger:hover,
.btn-danger:focus {
  background-color: #bb2d3b;
  color: white !important;
}

.btn-secondary {
  background-color: #6c757d;
  color: white !important;
}

.btn-secondary:hover,
.btn-secondary:focus {
  background-color: #5c636a;
  color: white !important;
}

.btn-warning {
  background-color: #ffc107;
  color: #212529 !important;
}

.btn-warning:hover,
.btn-warning:focus {
  background-color: #ffca2c;
  color: #212529 !important;
}

/* Smaller buttons */
.btn-sm {
  min-height: 2rem;
  padding: calc(0.25rem - 1px) calc(0.75rem - 1px);
  font-size: 12px;
}

/* Progress bar styles */
.progress {
  margin-top: 15px;
  display: none;
  height: 10px;
  border-radius: 5px;
  overflow: hidden;
  background-color: #e9ecef;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

.progress-bar {
  height: 100%;
  background-color: #0d6efd;
  transition: width 0.3s ease;
}

/* Q&A container styles */
.qa-container {
  margin-top: 30px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 0.25rem;
  display: none;
  box-shadow: rgba(0, 0, 0, 0.02) 0 1px 3px 0;
  background-color: #ffffff;
}

.qa-item {
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  padding: 20px;
}

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

.question {
  font-weight: 600;
  background-color: #f8f9fa;
  padding: 15px;
  border-radius: 5px;
  margin-bottom: 15px;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.answer {
  padding: 0 15px;
}

/* Card styling */
.card {
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 0.25rem;
  box-shadow: rgba(0, 0, 0, 0.02) 0 1px 3px 0;
  background-color: #ffffff;
  transition: all 250ms;
}

.card:hover {
  box-shadow: rgba(0, 0, 0, 0.1) 0 4px 12px;
}

.card-header {
  padding: 15px 20px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.card-body {
  padding: 8px;
}

/* List group styling */
.list-group {
  border-radius: 0.25rem;
  overflow: hidden;
}

.list-group-item {
  border: 1px solid rgba(0, 0, 0, 0.1);
  padding: 15px;
  transition: all 250ms;
}

.list-group-item:hover {
  background-color: #f8f9fa;
  border-color: rgba(0, 0, 0, 0.15);
}

/* Markdown editor */
#markdown-editor {
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 0.25rem;
  padding: 15px;
  font-family: monospace;
  transition: all 250ms;
}

#markdown-editor:focus {
  border-color: rgba(0, 0, 0, 0.15);
  box-shadow: rgba(0, 0, 0, 0.1) 0 4px 12px;
  outline: none;
}

/* Markdown display */
#markdown-display {
  padding: 15px;
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: 0.25rem;
  background-color: #f8f9fa;
  height: 600px;
  overflow-y: auto;
  overflow-x: auto;
}

/* LaTeX formula styling */
#markdown-display .katex-display {
  overflow-x: visible !important;
  max-width: none !important;
  overflow-y: hidden;
  margin: 1em 0;
  text-align: center;
}

/* Ensure inline LaTeX doesn't break */
#markdown-display .katex {
  white-space: nowrap !important;
  max-width: none;
}

/* Keep formula alignment */
#markdown-display .katex-html {
  text-align: center;
  white-space: nowrap;
}

/* PDF and Markdown containers */
#pdf-container .card,
#markdown-container .card {
  height: 100%;
}

#pdf-container .card-body,
#markdown-container .card-body {
  height: calc(100% - 56px);
}

/* Ensure the editor has the same height */
#markdown-edit-area {
  height: 600px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .document-system-container .col-md-8.offset-md-2 {
    width: 100%;
    margin-left: 0;
  }

  .file-item {
    flex-direction: column;
    align-items: flex-start;
  }

  .file-item .btn {
    margin-top: 10px;
    align-self: flex-end;
  }

  .btn {
    font-size: 12px;
    min-height: 2.2rem;
    padding: calc(0.4rem - 1px) calc(0.8rem - 1px);
  }

  .btn-sm {
    min-height: 1.8rem;
    padding: calc(0.2rem - 1px) calc(0.5rem - 1px);
  }
}

/* You can also target specific rows */
.document-system-container .row {
  padding-right: 0px;
}
