/**
 * F2F Store Tools - Customer Water Testing CSS
 * Organized and consolidated stylesheet
 /css/customer-testing.css
 */

/***************************************
 * 1. VARIABLES
 ***************************************/
:root {
  --primary-color: #F38221;
  --primary-hover: #e67012;
  --text-dark: #333;
  --text-medium: #555;
  --text-light: #666;
  --error-color: #ff5252;
  --success-color: #4CAF50;
  --border-light: #ddd;
  --bg-light: #f9f9f9;
  --bg-white: #fff;
  --shadow-light: 0 2px 5px rgba(0, 0, 0, 0.1);
  --shadow-medium: 0 3px 10px rgba(0, 0, 0, 0.1);
  --shadow-heavy: 0 5px 15px rgba(0, 0, 0, 0.3);
  --border-radius: 8px;
  
  /* Button colors */
  --btn-view-color: #4285F4;
  --btn-view-hover: #3367d6;
  --btn-delete-color: #EA4335;
  --btn-delete-hover: #d32f2f;
}

/***************************************
 * 2. GENERAL LAYOUT & CONTAINERS
 ***************************************/
.f2f-customer-testing {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* Header Styles */
.f2f-testing-header {
  margin-bottom: 30px;
  text-align: center;
}

.f2f-testing-header h2 {
  color: var(--primary-color);
  font-size: 32px;
  margin-bottom: 10px;
}

.f2f-testing-intro {
  font-size: 18px;
  color: var(--text-medium);
}

/* Section Headers */
.f2f-customer-testing h3 {
  color: var(--text-dark);
  font-size: 24px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 10px;
}

/***************************************
 * 3. FORM STYLES
 ***************************************/
.f2f-form-field {
  margin-bottom: 20px;
}

.f2f-form-field label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: var(--text-medium);
}

.f2f-form-field input[type="text"],
.f2f-form-field input[type="email"],
.f2f-form-field input[type="number"],
.f2f-form-field select,
.f2f-form-field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius);
  font-size: 16px;
  box-shadow: var(--shadow-light);
}

.f2f-form-field textarea {
  resize: vertical;
  min-height: 100px;
}

.f2f-form-field select {
  appearance: none;
  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='%23333' 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 10px center;
  background-size: 16px;
  padding-right: 35px;
}

.f2f-form-field input.out-of-range {
  border-color: var(--error-color);
  background-color: #fff8f8;
}

.f2f-form-field label.required-field:after {
  content: " *";
  color: var(--error-color);
}

.f2f-form-actions {
  display: flex;
  gap: 15px;
  margin-top: 30px;
}

/* Customer Search */
.f2f-customer-search-section {
  margin-bottom: 30px;
}

.f2f-search-field {
  position: relative;
}

.f2f-search-field input[type="text"] {
  width: 100%;
  max-width: 500px;
  padding: 12px 15px;
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius);
  font-size: 16px;
  box-shadow: var(--shadow-light);
}

/* Conversion Groups */
.f2f-conversion-group {
  background-color: var(--bg-light);
  padding: 15px;
  border-radius: var(--border-radius);
  margin-bottom: 25px;
}

.f2f-conversion-header {
  margin-bottom: 15px;
}

.f2f-conversion-header h4 {
  margin: 0;
  color: var(--text-dark);
  font-size: 18px;
}

.f2f-conversion-inputs {
  display: flex;
  gap: 20px;
}

.f2f-input-group {
  flex: 1;
}

/***************************************
 * 4. BUTTON STYLES
 ***************************************/
.f2f-submit-button, 
.f2f-button, 
.f2f-test-button, 
.f2f-add-button {
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: var(--border-radius);
  padding: 12px 20px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s;
}

.f2f-submit-button:hover, 
.f2f-button:hover, 
.f2f-test-button:hover, 
.f2f-add-button:hover {
  background-color: var(--primary-hover);
}

.f2f-cancel-button {
  background-color: #f5f5f5;
  color: var(--text-dark);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius);
  padding: 12px 20px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s;
}

.f2f-cancel-button:hover {
  background-color: #e9e9e9;
}

.f2f-add-button {
  margin-top: 20px;
}

.f2f-result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 20px;
}

/* Action buttons styling */
.action-buttons-container {
  text-align: center;
}

.action-buttons {
  display: flex;
  gap: 5px;
  justify-content: center;
}

.print-btn,
.view-btn,
.delete-btn {
  padding: 8px 12px;
  border: none;
  border-radius: 4px;
  color: white;
  font-weight: 500;
  cursor: pointer;
  min-width: 70px;
  text-align: center;
}

.print-btn {
  background-color: var(--primary-color);
}

.print-btn:hover {
  background-color: var(--primary-hover);
}

.view-btn {
  background-color: var(--btn-view-color);
}

.view-btn:hover {
  background-color: var(--btn-view-hover);
}

.delete-btn {
  background-color: var(--btn-delete-color);
}

.delete-btn:hover {
  background-color: var(--btn-delete-hover);
}

/***************************************
 * 5. AQUARIUM CARDS STYLES
 ***************************************/
.f2f-aquariums-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.f2f-aquarium-card {
  background-color: var(--bg-white);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-medium);
  overflow: hidden;
  transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.f2f-aquarium-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-heavy);
}

.f2f-aquarium-header {
  padding: 15px;
  background-color: #f5f5f5;
  border-bottom: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.f2f-aquarium-header h4 {
  margin: 0;
  font-size: 18px;
  color: var(--text-dark);
}

.f2f-type-badge {
  padding: 5px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.f2f-type-badge.saltwater {
  background-color: #e6f7ff;
  color: #0066cc;
}

.f2f-type-badge.freshwater {
  background-color: #e6ffe6;
  color: #008800;
}

.f2f-aquarium-body {
  padding: 15px;
}

.f2f-aquarium-info {
  margin-bottom: 15px;
}

.f2f-aquarium-info p {
  margin: 5px 0;
  color: var(--text-medium);
}

.f2f-aquarium-description {
  font-style: italic;
  color: var(--text-light);
  font-size: 14px;
  margin-top: 8px;
}

/***************************************
 * 6. TEST HISTORY STYLES
 ***************************************/
.f2f-test-history {
  margin-bottom: 15px;
}

.f2f-test-history h5 {
  margin: 0 0 10px 0;
  font-size: 16px;
  color: var(--text-dark);
}

.f2f-test-date-item {
  padding: 8px 0;
  border-bottom: 1px solid #eee;
  display: flex;
  align-items: center;
}

.f2f-test-date-item:last-child {
  border-bottom: none;
}

.f2f-date-info {
  display: flex;
  align-items: center;
}

.f2f-status-complete {
  color: var(--success-color);
  margin-right: 8px;
}

/* Style for flashing a table row before removal */
tr.f2f-row-deleting td {
  background-color: #ffdddd !important; /* Light red flash */
  transition: background-color 0.2s ease-in-out;
}

/***************************************
 * 7. TABLE STYLES
 ***************************************/
.f2f-test-results-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.f2f-test-results-table th {
  background-color: #f5f5f5;
  padding: 12px 15px;
  text-align: left;
  font-weight: bold;
  border-bottom: 2px solid #ddd;
  color: #333;
}

.f2f-test-results-table td {
  padding: 12px 15px;
  border-bottom: 1px solid #eee;
  vertical-align: middle;
}

/* Special column styles for test parameters tables */
.f2f-test-results-table th:first-child,
.f2f-test-results-table td:first-child {
  width: 25%; /* Parameter column */
}

.f2f-test-results-table th:nth-child(2),
.f2f-test-results-table td:nth-child(2) {
  width: 20%; /* Current Value column */
  text-align: center;
}

.f2f-test-results-table th:nth-child(3),
.f2f-test-results-table td:nth-child(3) {
  width: 20%; /* Previous Value column */
  text-align: center;
}

.f2f-test-results-table th:nth-child(4),
.f2f-test-results-table td:nth-child(4) {
  width: 35%; /* Recommended Range column */
  text-align: center;
}

/* Out of range highlighting */
.f2f-test-results-table td.out-of-range {
  color: #ff0000;
  font-weight: bold;
  background-color: rgba(255, 82, 82, 0.1);
}

/* Zebra striping for better readability */
.f2f-test-results-table tbody tr:nth-child(even) {
  background-color: #f9f9f9;
}

.f2f-test-results-table tbody tr:hover {
  background-color: #f5f5f5;
}

/***************************************
 * 8. TESTING LOG STYLES - IMPROVED
 ***************************************/
.f2f-testing-log-section {
  margin-top: 30px;
  margin-bottom: 30px;
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: var(--shadow-light);
}

#f2f-testing-log-btn{
    /* visual style */
    background:#f38221;
    color:#fff;
    border:1px solid #f38221;
    font-weight:bold;
    font-size:.95rem;
    padding:8px 14px;
    border-radius:6px;

    /* behaviour */
    display:inline-flex;
    align-items:center;
    gap:8px;
    cursor:pointer;
    transition:all .3s ease;

    /* override the 100 % width that comes from the shared rule */
    width:auto;
}

/* keep colour on hover / focus */
#f2f-testing-log-btn:hover,
#f2f-testing-log-btn:focus{
    background:#f38221;
    color:#fff;
    border:1px solid #f38221;
}

/* toggle (“expanded”) colour swap */
#f2f-testing-log-btn[aria-expanded="true"]{
    background:#fff;
    color:#f38221;
}

/* ▼ arrow */
#f2f-testing-log-btn::after{
    content:"\25BC";
    transition:transform .3s ease;
    font-size:.9em;
}
#f2f-testing-log-btn[aria-expanded="true"]::after{
    transform:rotate(180deg);
}

/* ───────────────
   Container tidy‑up
   ───────────────*/
.f2f-testing-log-section{
    border:none;          /* remove thick grey outline */
    box-shadow:none;      /* remove shadow */
    padding:0;
}


#testing-log-container {
  max-height: 500px;
  overflow-y: auto;
  background-color: var(--bg-white);
  padding: 0;
  border-top: 1px solid var(--border-light);
}

/* Specific table styles for the testing log */
.f2f-testing-log-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0;
  box-shadow: none;
  background-color: white;
}

.f2f-testing-log-table th {
  background-color: #f5f5f5;
  padding: 12px 15px;
  font-weight: 600;
  border-bottom: 2px solid #ddd;
  text-align: left;
  color: #333;
}

.f2f-testing-log-table td {
  padding: 12px 15px;
  text-align: left;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}

.f2f-testing-log-table tr:nth-child(even) {
  background-color: #f9f9f9;
}

.f2f-testing-log-table tr:hover {
  background-color: #f1f1f1;
}

/* Button styling */
.f2f-print-test,
.f2f-view-test,
.f2f-delete-test-result {
  min-width: 70px;
  padding: 8px 12px;
  border: none;
  border-radius: 4px;
  color: white;
  font-weight: 500;
  cursor: pointer;
  text-align: center;
  margin: 2px;
}

.f2f-print-test {
  background-color: var(--primary-color);
}

.f2f-print-test:hover {
  background-color: var(--primary-hover);
}

.f2f-view-test {
  background-color: #4285F4;
}

.f2f-view-test:hover {
  background-color: #3367d6;
}

.f2f-delete-test-result {
  background-color: #EA4335;
}

.f2f-delete-test-result:hover {
  background-color: #d32f2f;
}

/* small helper for centred header cells */
.f2f-center { text-align:center; }

/* keep the header visible while scrolling the log */
.f2f-testing-log-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
}

/* slightly round the first/last header corners */
.f2f-testing-log-table thead th:first-child  { border-top-left-radius: var(--border-radius); }
.f2f-testing-log-table thead th:last-child   { border-top-right-radius: var(--border-radius); }

/* graceful wrapping so we almost never need a horizontal scrollbar */
.f2f-testing-log-table td:nth-child(1),
.f2f-testing-log-table td:nth-child(2) {
    white-space: normal;        /* allow wrapping */
    word-break : break-word;
}

/* always prevent X‑scroll unless the screen is very narrow */
#testing-log-container {
    overflow-x: hidden;
    overflow-y: auto;
    max-height: 550px;          /* adjust to taste */
}
@media (max-width: 600px) {
    #testing-log-container { overflow-x: auto; }   /* let phones scroll sideways */
}


/***************************************
 * 9. MODAL STYLES
 ***************************************/
.f2f-modal {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 9999;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: none;
}

.f2f-modal-content {
  position: relative;
  background-color: var(--bg-white);
  margin: 10% auto;
  padding: 20px;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-heavy);
  max-width: 600px;
  width: 90%;
}

.f2f-modal-close {
  position: absolute;
  top: 10px;
  right: 15px;
  font-size: 24px;
  font-weight: bold;
  color: #999;
  cursor: pointer;
}

.f2f-modal-close:hover {
  color: #333;
}

/* Modal styles for test details */
#testDetailsModal.f2f-modal {
  z-index: 9999;
}

#testDetailsModal .f2f-modal-content {
  max-width: 900px;
  width: 90%;
}

#testDetailsModal .f2f-result-actions {
  margin-top: 20px;
  text-align: center;
}

#testDetailsModal .out-of-range {
  color: var(--error-color);
  font-weight: bold;
  background-color: rgba(255, 82, 82, 0.1);
}

/***************************************
 * 10. STATUS AND MESSAGE STYLES
 ***************************************/
/* Success Message */
.f2f-test-result-message {
  text-align: center;
  padding: 50px 0;
}

.f2f-result-content {
  background-color: var(--bg-white);
  padding: 30px;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-heavy);
  max-width: 500px;
  margin: 0 auto;
}

.f2f-result-icon {
  display: block;
  font-size: 48px;
  color: var(--success-color);
  margin-bottom: 20px;
}

.f2f-result-content h3 {
  color: var(--text-dark);
  border-bottom: none;
  margin-top: 0;
  margin-bottom: 10px;
}

#out-of-range-message {
  background-color: #ffebee;
  padding: 10px;
  border-radius: 4px;
  margin-bottom: 20px;
}

/* Loading and Messages */
.f2f-loading {
  text-align: center;
  padding: 20px;
  color: var(--text-light);
}

.f2f-error {
  background-color: #ffebee;
  color: var(--error-color);
  padding: 15px;
  border-radius: var(--border-radius);
  margin-bottom: 20px;
}

.f2f-message {
  background-color: var(--bg-light);
  padding: 15px;
  border-radius: var(--border-radius);
  color: var(--text-medium);
  text-align: center;
  font-style: italic;
}

/* Test notes */
.f2f-test-notes {
  margin-top: 15px;
  background-color: #eef;
  padding: 10px;
  border-radius: 6px;
}

/***************************************
 * 11. AUTOCOMPLETE/UI WIDGET STYLES
 ***************************************/
/* Autocomplete Customization */
.ui-autocomplete {
  max-height: 300px;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 9999;
  border: 1px solid var(--border-light);
  border-radius: 0 0 var(--border-radius) var(--border-radius);
  background: var(--bg-white);
  box-shadow: var(--shadow-medium);
  width: auto !important;
  max-width: 500px;
  min-width: 500px;
  box-sizing: border-box;
}

.ui-autocomplete .ui-menu-item {
  padding: 8px 15px 8px 30px;
  position: relative;
  border-bottom: 1px solid #eee;
  list-style: none;
  cursor: pointer;
}

.ui-autocomplete .ui-menu-item:before {
  content: "•";
  position: absolute;
  left: 15px;
  color: var(--primary-color);
}

.ui-autocomplete .ui-menu-item:last-child {
  border-bottom: none;
}

.ui-autocomplete .ui-menu-item div {
  padding: 5px 0;
  font-size: 14px;
}

.ui-autocomplete .ui-menu-item:hover,
.ui-autocomplete .ui-menu-item.ui-state-focus {
  background-color: var(--bg-light);
}

.ui-autocomplete .create-new-item {
  background-color: #f5f5f5;
}

/* Ensure the autocomplete menu is aligned with the input */
.f2f-search-field .ui-autocomplete {
  width: 100% !important;
}

/***************************************
 * 12. RESPONSIVE STYLES
 ***************************************/
@media (max-width: 768px) {
  .f2f-aquariums-grid {
    grid-template-columns: 1fr;
  }
  
  .f2f-conversion-inputs {
    flex-direction: column;
    gap: 15px;
  }
  
  .f2f-form-actions {
    flex-direction: column;
  }
  
  .f2f-submit-button, 
  .f2f-cancel-button, 
  .f2f-button {
    width: 100%;
  }
  
  .f2f-result-actions {
    flex-direction: column;
  }
  
  .f2f-result-actions .f2f-button {
    width: 100%;
  }
  
  .ui-autocomplete {
    max-width: 100% !important;
  }
}


