/* ../styles/quotations.css */

/* ---
==========================================================================
  1. GENERAL PAGE & TABLE STYLES
==========================================================================
--- */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.page-header h1 {
  margin: 0;
  font-size: 1.8em;
}

.page-header .btn-primary {
  padding: 12px 20px;
  font-size: 1em;
  font-weight: 500;
  border-radius: 6px;
  box-shadow: 0 2px 5px rgba(0, 123, 255, 0.2);
  transition: all 0.3s ease;
  border: 1px solid transparent;
}

.page-header .btn-primary:hover {
  background-color: #0069d9; /* A slightly darker blue */
  box-shadow: 0 4px 10px rgba(0, 123, 255, 0.3);
  transform: translateY(-2px); /* Subtle lift effect */
}

.page-header .btn-primary:active {
  transform: translateY(0); /* Button goes back down on click */
  box-shadow: 0 2px 5px rgba(0, 123, 255, 0.2);
}
.card {
  background-color: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  margin-bottom: 20px;
}
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  border-bottom: 1px solid #e9ecef;
}
.card-header h2 {
  margin: 0;
  font-size: 1.2em;
  font-weight: 600;
}
.card-actions {
  display: flex;
  gap: 10px;
}
#month-filter {
  padding: 8px 12px;
  border: 1px solid #ced4da;
  border-radius: 4px;
  background-color: #fff;
  font-size: 0.9em;
  min-width: 150px;
}
.card-body {
  padding: 20px;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9em;
}
.data-table th,
.data-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid #e9ecef;
  vertical-align: middle;
}
.data-table th {
  background-color: #f8f9fa;
  font-weight: 600;
  text-transform: uppercase;
  color: #495057;
}
.data-table tbody tr:hover {
  background-color: #f1f3f5;
}

/* ---
==========================================================================
  2. ACTION BUTTONS & PAGINATION
==========================================================================
--- */
.action-buttons {
  display: flex;
  gap: 8px;
}
.btn-icon {
  background: none;
  border: none;
  color: #6c757d;
  cursor: pointer;
  padding: 5px;
  font-size: 1.1em;
  transition: color 0.2s ease;
}
.btn-icon:hover {
  color: #007bff;
}
.btn-icon.delete:hover {
  color: #dc3545;
}
.btn-icon.download:hover {
  color: #198754;
}

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 20px;
  gap: 5px;
}
.pagination-btn {
  background-color: #fff;
  border: 1px solid #dee2e6;
  color: #007bff;
  padding: 8px 12px;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.3s;
  text-decoration: none;
}
.pagination-btn:hover:not([disabled]) {
  background-color: #e9ecef;
}
.pagination-btn.active {
  background-color: #007bff;
  color: white;
  border-color: #007bff;
}
.pagination-btn:disabled {
  color: #6c757d;
  cursor: not-allowed;
  background-color: #f8f9fa;
}

/* ---
==========================================================================
  3. STATUS BADGES (TABLE WIDGET)
==========================================================================
--- */
.status-badge-widget {
  padding: 5px 10px;
  border-radius: 15px;
  font-size: 0.85em;
  font-weight: 500;
  text-transform: capitalize;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-block;
  border: 1px solid transparent;
  min-width: 120px;
  text-align: center;
}
.status-badge-widget:hover {
  transform: translateY(-1px);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}
.status-badge-widget[data-status-id="1"] {
  background-color: #d1e7dd;
  color: #0f5132;
  border-color: #a3cfbb;
} /* Complete */
.status-badge-widget[data-status-id="2"],
.status-badge-widget[data-status-id="3"] {
  background-color: #cff4fc;
  color: #055160;
  border-color: #9eeaf9;
} /* Follow Up */
.status-badge-widget[data-status-id="4"] {
  background-color: #f8d7da;
  color: #842029;
  border-color: #f1aeb5;
} /* Fail */
.status-badge-widget[data-status-id="5"] {
  background-color: #fff3cd;
  color: #664d03;
  border-color: #ffe69c;
} /* Pending */
.status-badge-widget[data-status-id="6"] {
  background-color: #e9ecef;
  color: #495057;
  border-color: #d3d9df;
} /* Other */

/* ---
==========================================================================
  4. GENERAL MODAL STYLES
==========================================================================
--- */
.modal {
  display: none;
  position: fixed;
  z-index: 1050;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: rgba(0, 0, 0, 0.5);
}
.modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-content {
  background-color: #fefefe;
  margin: auto;
  padding: 0;
  border: 1px solid #888;
  width: 60%;
  max-width: 600px;
  border-radius: 8px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
  animation: slideIn 0.3s ease-out;
  display: flex;
  flex-direction: column;
  max-height: 90vh;
}
@keyframes slideIn {
  from {
    transform: translateY(-30px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}
.modal-header {
  padding: 15px 20px;
  background-color: #007bff;
  color: white;
  border-bottom: 1px solid #dee2e6;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top-left-radius: 8px;
  border-top-right-radius: 8px;
  flex-shrink: 0;
}
.modal-header h2 {
  margin: 0;
  font-size: 1.3em;
}
.close-modal {
  color: white;
  font-size: 28px;
  font-weight: bold;
  background: none;
  border: none;
  cursor: pointer;
  line-height: 1;
}
.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex-grow: 1;
}
.modal-footer {
  padding: 15px 20px;
  border-top: 1px solid #e9ecef;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background-color: #f8f9fa;
  border-bottom-left-radius: 8px;
  border-bottom-right-radius: 8px;
  flex-shrink: 0;
}

/* ---
==========================================================================
  5. SPECIFIC MODAL STYLES (PREVIEW & UPDATE STATUS)
==========================================================================
--- */

/* Preview Modal */
.modal.large .modal-content {
  width: 85%;
  max-width: 1000px;
}
#quotation-preview-content iframe {
  width: 100%;
  height: 60vh;
  border: none;
}

/* Update Status Modal */
#update-status-modal .modal-content {
  max-width: 550px;
}
#update-status-modal .modal-body {
  padding: 20px 30px 30px 30px;
}
#update-status-modal .modal-header h2 {
  font-size: 1.4em;
}

#update-status-modal .status-update-info {
  text-align: center;
  padding: 15px;
  background-color: #f8f9fa;
  border-radius: 8px;
  margin-bottom: 30px;
  font-size: 1.05em;
  color: #6c757d;
}
#update-status-modal .status-update-info p {
  margin: 0;
  line-height: 1.5;
}
#update-status-modal #status-quotation-ref {
  display: inline-block;
  margin-left: 8px;
  font-family: monospace;
  font-weight: 600;
  font-size: 1.1em;
  color: #0d6efd;
  background-color: #e7f1ff;
  padding: 5px 12px;
  border-radius: 6px;
  border: 1px solid #cce0ff;
}
#update-status-modal .form-group {
  margin-bottom: 25px;
}
#update-status-modal .form-group label {
  display: block;
  font-size: 0.9em;
  font-weight: 600;
  color: #495057;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
#update-status-modal .form-actions {
  padding-top: 10px;
  margin-top: 10px;
}
#update-status-modal .btn {
  padding: 12px 20px;
  font-size: 1em;
  font-weight: 500;
}

/* ---
==========================================================================
  6. CUSTOM DROPDOWN & REASON INPUTS (FOR UPDATE STATUS MODAL)
==========================================================================
--- */
.custom-select-wrapper {
  position: relative;
}
.custom-select-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 15px;
  background-color: #fff;
  border: 1px solid #ced4da;
  border-radius: 6px;
  font-size: 1em;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.custom-select-wrapper.open .custom-select-trigger {
  border-color: #86b7fe;
  box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}
.custom-select-trigger::after {
  content: "\f078";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  transition: transform 0.3s;
}
.custom-select-wrapper.open .custom-select-trigger::after {
  transform: rotate(180deg);
}
.custom-options {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background-color: #fff;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  z-index: 1060;
  list-style: none;
  padding: 8px 0;
  margin-top: 5px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s ease-out;
}
.custom-select-wrapper.open .custom-options {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.custom-option {
  display: flex;
  align-items: center;
  padding: 12px 15px;
  cursor: pointer;
  transition: background-color 0.2s;
}
.custom-option:hover {
  background-color: #f8f9fa;
}
.custom-option.selected {
  background-color: #0d6efd;
  color: white;
}
.custom-option::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 12px;
  flex-shrink: 0;
}
.custom-option[data-value="1"]::before {
  background-color: #198754;
}
.custom-option[data-value="2"]::before,
.custom-option[data-value="3"]::before {
  background-color: #0dcaf0;
}
.custom-option[data-value="4"]::before {
  background-color: #dc3545;
}
.custom-option[data-value="5"]::before {
  background-color: #ffc107;
}
.custom-option[data-value="6"]::before {
  background-color: #6c757d;
}

.reason-group {
  position: relative; /* This is correct, keep it. */
  /* Animation styles (no change here) */
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: all 0.4s ease-in-out;
  visibility: hidden;
}
.reason-group.visible {
  max-height: 200px;
  opacity: 1;
  margin-top: 25px;
  visibility: visible;
}
.reason-input-wrapper {
  position: relative;
}
.reason-group .input-icon {
  position: absolute;
  top: 15px; /* Position from the top of the wrapper */
  left: 15px; /* Indent from the left */
  color: #ced4da;
  transition: color 0.2s;
  pointer-events: none;
}
.reason-textarea {
  width: 100%; /* CRITICAL: Ensure it takes full width */
  box-sizing: border-box; /* Ensures padding is included in the width */
  padding-left: 45px !important; /* Make space for the icon */
  min-height: 120px;
  border-radius: 6px;
  resize: vertical;
  border: 1px solid #ced4da; /* Add border for consistency */
}
.reason-textarea:focus {
  border-color: #86b7fe;
  box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
  outline: none;
}
.reason-textarea:focus ~ .input-icon {
  color: #0d6efd;
}

/* A small tweak to the label */
#update-status-modal .reason-group label {
  font-style: italic;
  color: #6c757d;
}

/* In ../styles/quotations.css */

/* ---
==========================================================================
  7. ENHANCED HEADER & FILTER STYLES (REPLACEMENT BLOCK)
==========================================================================
--- */

/* --- Page Header & Create Button --- */

.page-header {
  padding-bottom: 15px;
  border-bottom: 1px solid #e9ecef;
}

.page-header h1 {
  color: #343a40;
}

.btn.btn-lg {
  padding: 12px 24px;
  font-size: 1em;
  font-weight: 500;
  border-radius: 50px; /* Pill shape */
  box-shadow: 0 4px 12px rgba(0, 123, 255, 0.2);
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  border: none;
}
.btn.btn-lg i {
  margin-right: 8px;
  font-size: 0.9em;
}
.btn.btn-lg:hover {
  background-color: #0069d9;
  box-shadow: 0 6px 16px rgba(0, 123, 255, 0.3);
  transform: translateY(-2px);
}
.btn.btn-lg:active {
  transform: translateY(0);
  box-shadow: 0 4px 12px rgba(0, 123, 255, 0.2);
}

/* --- Card Header & Filter Actions --- */

.card-header {
  align-items: center;
}
.card-title {
  margin: 0;
  font-size: 1.2em;
  font-weight: 600;
}
.card-actions {
  display: flex;
  gap: 15px;
}

/* The container for each filter (icon + select/input) */
.filter-group {
  position: relative;
}

/* Style for the icons inside the filter groups */
.filter-icon {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: #adb5bd; /* Subtle grey color */
  font-size: 0.9em;
  pointer-events: none; /* Allows clicks to go through to the input */
  transition: color 0.2s ease-in-out;
}

/* Style for the select and input elements */
.filter-control {
  appearance: none; /* Remove default browser styling */
  -webkit-appearance: none;
  -moz-appearance: none;
  background-color: #f8f9fa; /* Light background */
  border: 1px solid #e9ecef;
  border-radius: 50px; /* Pill shape */
  padding: 8px 15px 8px 40px; /* Top, Right, Bottom, Left (to make space for icon) */
  font-size: 0.9em;
  color: #495057;
  transition: all 0.2s ease-in-out;
  cursor: pointer;
}

/* Add custom arrow for select element */
#status-filter.filter-control {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 16px 12px;
  padding-right: 35px; /* Extra space for the custom arrow */
}

/* Focus and Hover states for the filters */
.filter-control:focus,
.filter-control:hover {
  background-color: #fff;
  border-color: #007bff;
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

/* Make the icon change color on focus/hover */
.filter-group:has(:focus) .filter-icon,
.filter-group:has(:hover) .filter-icon {
  color: #007bff;
}

.btn-icon.status-history:hover {
  color: #6f42c1; /* A nice purple for history/auditing */
}

/* Title inside the history modal */
.history-modal-title {
  font-size: 1.2em;
  font-weight: 600;
  color: #343a40;
  margin-top: 0;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid #e9ecef;
}
.history-modal-title strong {
  font-family: monospace;
  color: #0d6efd;
}

/* The timeline list container */
.status-history-list {
  list-style: none;
  padding: 0;
  margin: 0;
  position: relative;
  max-height: 50vh; /* Make the list scrollable if it's long */
  overflow-y: auto;
  padding: 10px;
}

/* The vertical timeline bar */
.status-history-list::before {
  content: "";
  position: absolute;
  top: 5px;
  left: 17px;
  bottom: 5px;
  width: 4px;
  background: #e9ecef;
  border-radius: 2px;
}

/* Individual history items */
.history-item {
  position: relative;
  padding-left: 50px; /* Space for the icon */
  margin-bottom: 25px;
}
.history-item:last-child {
  margin-bottom: 10px;
}

/* The icon circle on the timeline */
.history-item-icon {
  position: absolute;
  left: 0;
  top: 0;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background-color: #fff;
  border: 3px solid #e9ecef;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1em;
}
.history-item-icon i {
  color: #6c757d;
}

/* Color coding for the icons based on status */
.history-item[data-status-id="1"] .history-item-icon {
  border-color: #198754;
} /* Complete */
.history-item[data-status-id="1"] .history-item-icon i {
  color: #198754;
}
.history-item[data-status-id="2"] .history-item-icon,
.history-item[data-status-id="3"] .history-item-icon {
  border-color: #0dcaf0;
} /* Follow up */
.history-item[data-status-id="2"] .history-item-icon i,
.history-item[data-status-id="3"] .history-item-icon i {
  color: #0dcaf0;
}
.history-item[data-status-id="4"] .history-item-icon {
  border-color: #dc3545;
} /* Fail */
.history-item[data-status-id="4"] .history-item-icon i {
  color: #dc3545;
}
.history-item[data-status-id="0"] .history-item-icon {
  border-color: #ffc107;
} /* Pending */
.history-item[data-status-id="0"] .history-item-icon i {
  color: #ffc107;
}
.history-item[data-status-id="6"] .history-item-icon {
  border-color: #6c757d;
} /* Other */
.history-item[data-status-id="6"] .history-item-icon i {
  color: #6c757d;
}

/* The main content of a history item */
.history-item-content p {
  margin: 0;
  font-weight: 600;
  color: #343a40;
  font-size: 1.05em;
}
.history-item-content .history-remark {
  font-style: italic;
  color: #6c757d;
  font-weight: 400;
  margin-top: 4px;
  font-size: 0.9em;
  padding-left: 15px;
  border-left: 2px solid #e9ecef;
}
.history-item-content .history-meta {
  font-size: 0.8em;
  color: #6c757d;
  margin-top: 5px;
}

.modal-footer .btn {
  padding: 10px 24px; /* More horizontal padding for a wider look */
  font-size: 0.95em;
  font-weight: 500;
  border-radius: 6px;
  border: 1px solid transparent; /* Prepare for border transitions */
  transition: all 0.2s ease-in-out;
  cursor: pointer;
}

/* Specific style for the SECONDARY (Close/Cancel) button */
.modal-footer .btn-secondary {
  background-color: #fff; /* White background */
  color: #6c757d; /* Grey text */
  border-color: #ced4da; /* Grey border */
}

/* Hover effect for the secondary button */
.modal-footer .btn-secondary:hover {
  background-color: #f8f9fa; /* Very light grey background */
  border-color: #adb5bd; /* Darker grey border */
  color: #212529; /* Darker text */
  transform: translateY(-1px); /* Subtle lift */
}

/* Specific style for the PRIMARY (Update/Save/Download) button */
.modal-footer .btn-primary {
  background-color: #0d6efd; /* A modern, vibrant blue */
  box-shadow: 0 2px 8px rgba(13, 110, 253, 0.2);
}

/* Hover effect for the primary button */
.modal-footer .btn-primary:hover {
  background-color: #0b5ed7; /* Darker blue */
  box-shadow: 0 4px 12px rgba(13, 110, 253, 0.3);
  transform: translateY(-1px); /* Subtle lift */
}

/* Active (on-click) effect for all modal buttons */
.modal-footer .btn:active {
  transform: translateY(0);
  box-shadow: none;
}
