/* =========================
   Common/Shared Components
   ========================= */

/* Modal Overlay */
.modal {
  display: none;
  /* Hidden by default */
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  /* Slightly darker for contrast */
  backdrop-filter: blur(4px);
  /* Blur background for elegance */
}

.modal.show {
  /* Flexbox for centering */
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease-out;
}

/* Modal Content Box */
.modal-content {
  background-color: #ffffff;
  padding: 25px;
  border-radius: 12px;
  width: 80%;
  max-width: 450px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  /* Depth effect */
  transform: translateY(-10px);
  animation: slideIn 0.3s ease-out;
}

/* Modal Actions */
.modal-actions {
  display: flex;
  justify-content: space-between;
  margin-top: 20px;
}

#confirm-yes {
  background: linear-gradient(135deg, #007bff, #0056b3);
  /* Gradient */
  color: white;
}

#confirm-no {
  background: linear-gradient(135deg, #6c757d, #495057);
  color: white;
}

/* Button hover effects */
.modal-actions button:hover {
  transform: scale(1.05);
  /* Slightly bigger */
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
  /* Add shadow */
  opacity: 0.95;
}

/* Button focus styles for accessibility */
.modal-actions button:focus {
  outline: 3px solid #80bdff;
}


.modal-header {
  padding: 1rem 1.5rem;
  /* Comfortable padding around the header */
  border-bottom: 1px solid #e9ecef;
  /* A light grey border for separation */
  background-color: #f2f2f2;
  /* Slightly off-white for the header background */
  border-top-left-radius: calc(0.3rem - 1px);
  border-top-right-radius: calc(0.3rem - 1px);
}

.modal-title {
  font-weight: 600;
  /* Semi-bold font for the title */
  color: #495057;
  /* Dark grey for text for better readability */
  font-size: 1.25rem;
  /* Slightly larger font size for titles */
}

.modal-description {
  margin-top: 16px;
  margin-bottom: 0px;
}

.modal-footer {
  padding: 1rem 1.5rem;
  /* Comfortable padding around the footer */
  border-bottom-left-radius: calc(0.3rem - 1px);
  border-bottom-right-radius: calc(0.3rem - 1px);
}

.close {
  font-size: 1.5rem;
  /* Larger close button */
  color: #000;
  outline: none !important;  
}

.close:hover {
  color: #6c757d;
  /* A subtle hover effect for the close button */
}

.chart-container {
  display: flex;
  justify-content: space-around;
  margin-top: 20px;
  flex-direction: column;
  width: 400px;
  height: fit-content;
  margin-left: 5%;
  margin-right: 5%;
}

.chart-container canvas {
  width: 100%;
  margin-bottom: 60px;
}

.modal-actions button {
  margin-left: 10px;
  padding: 10px 20px;
  border: none;
  cursor: pointer;
  border-radius: 6px;
  font-weight: bold;
  font-size: 16px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.modal-backdrop {
  width: auto !important;
}

.modal-dialog.modal-xl {
  max-width: 90vw !important;
}


/* Adjust modal width */
@media (min-width: 576px) {
    .custom-size {
        max-width: 80%;
        /* Preferred width of the modal */
    }
}

.csv-modal-content {
  background-color: #ffffff;
  padding: 25px;
  width: 100% !important;
  max-width: none !important;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  /* Depth effect */
  transform: translateY(-10px);
  animation: slideIn 0.3s ease-out;
  overflow-x: auto;
}

/* Loading Indicator Overlay within Modal Body */
#csvModalBody .modal-loading-overlay {
  position: absolute;
  /* Position relative to modal body */
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.8);
  /* Semi-transparent background */
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1051;
  /* Higher than Bootstrap modal content (z-index: 1050) */
  display: none;
  /* Hidden by default */
}

/* Spinner Styling */
#csvModalBody .modal-spinner {
  border-width: 0.25rem;
  border: solid #f3f3f3;
  border-top: solid #deba5ca6;
  border-right: solid #deba5ca6;
  border-bottom: solid #deba5ca6;
  border-radius: 50%;
  width: 2rem;
  height: 2rem;
  animation: spin 1s linear infinite;
}


/* ─── Align labels + inputs exactly like editCallerModal ───────────── */
#json-modal .modal-body .form-group {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: 1rem;
}

#json-modal .modal-body .form-group>label {
  width: 140px;
  margin: 0;
  font-weight: 500;
  flex-shrink: 0;
}

#json-modal .modal-body .form-group>.form-control {
  flex: 1;
  margin: 0;
}

/* buttons – match Caller look */
#json-modal .btn-secondary {
  background-color: #5a6672;
  color: #fff;
}

#json-modal .btn-primary {
  background-color: #d4b25a;
  color: #fff;
}

/* ───── Create-Report modal look-and-feel ───────── */
#json-modal .modal-dialog {
  width: max-content;
  /* shrink-to-fit until title stops wrapping   */
  max-width: 90vw;
  /* never exceed viewport                      */
  min-width: 560px;
  /* but don’t get narrower than the form needs */
  margin: 1.75rem auto;
  /* keep Bootstrap’s horizontal centring       */
  /* let .modal-dialog-centered keep it vertically centred (display:flex) */
}


#json-modal .modal-title {
  white-space: nowrap;
  text-wrap: wrap;
}

#json-modal .modal-body .form-control {
  flex: 1;
  margin: 0;
}

/* ─── Footer layout & colours (no IDs needed) ───────────────────── */
#json-modal .modal-footer {
  display: flex;
  align-items: center;
  background: transparent;
  border-top: none !important;
  /* kill grey strip */
  padding-left: 1.5rem;
  padding-right: 1.5rem;
  width: 100%;
}

/* first button = Cancel → flush left */
#json-modal .modal-footer .btn:first-child {
  margin-left: 0;
  margin-right: auto;
  background: #5a6672;
  color: #fff;
  border: none;
}

/* last button = Create → right  */
#json-modal .modal-footer .btn:last-child {
  margin-right: .75rem;
  background: #d4b25a;
  color: #fff;
  border: none;
}

#json-modal .modal-content {
  padding: unset;
  border-radius: 10px;
  /* no border radius */
  width: 900px;
  max-width: 900px;
  min-width: 560px;
  align-items: center;
}

#json-modal .modal-body {
  padding: 1.5rem 1.5rem 1.25rem;
  width: 900px;
}

/* JSON modal styled like VS Code Light+ theme */
.renderjson {
  font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
  font-size: 0.95rem;
  line-height: 1.4;
  background-color: #ffffff;
  color: #333333;
  padding: 1em;
  border-radius: 4px;
}

.renderjson a {
  text-decoration: none;
  color: #0252a9;
  /* blue links */
}

.renderjson .disclosure {
  color: #555555;
  cursor: pointer;
}

.renderjson .syntax {
  color: #333333;
  /* braces and brackets in green */
}

.renderjson .object.syntax {
  color: #333333;
}

.renderjson .array.syntax {
  color: #333333;
}

.renderjson .key {
  color: #333333;
  /* dark blue keys */
}

.renderjson .string {
  color: #1a8b62;
  /* red strings */
}

.renderjson .number {
  color: #1685fc;
  /* green numbers */
}

.renderjson .boolean {
  color: #f14f5f;
  /* blue booleans */
}

.renderjson .keyword {
  color: #f14f5f;
  /* brown keywords */
}