﻿/* =========================================
   1. GLOBAL LAYOUT & TYPOGRAPHY
   ========================================= */
body {
  font-family: Arial, sans-serif;
  max-width: 480px;
  margin: 20px auto;
  font-size: 14px;
}

#nav {
  margin-bottom: 16px;
}

a {
  color: #007bff;
  text-decoration: underline;
  cursor: pointer;
}

h2 {
  margin-top: 0;
  margin-bottom: 20px;
}

label {
  display: block;
  margin-bottom: 4px;
  font-size: 14px;
  font-weight: normal;
}

.bold-label {
    font-weight: bold;
}

/* =========================================
   2. FORM ELEMENTS
   ========================================= */
input,
select {
  display: block;
  margin-bottom: 18px;
  font-size: 14px;
  padding: 6px 8px;
  width: 100%;
  box-sizing: border-box;
}

.dose-input {
  display: inline-block;
  width: 70%;
}

.unit-span {
  display: inline-block;
  margin-left: 8px;
  vertical-align: middle;
}

fieldset {
  border: 1px solid #ccc;
  padding: 12px 15px;
  margin-bottom: 20px;
}

legend {
  font-weight: bold;
  font-size: 16px;
  padding: 0 5px;
}

.fieldset-convert {
  border: 2px solid #007bff;
  background-color: #f8faff;
}

.fieldset-prn {
  border: 2px solid #7fffd4;
}

.legend-blue {
  color: #007bff;
}

.legend-aqua {
  color: #7fffd4;
}

/* =========================================
   3. BUTTONS
   ========================================= */
.btn {
  border: none;
  cursor: pointer;
  width: 100%;
  margin-bottom: 20px;
  border-radius: 8px;
  padding: 14px;
}

.btn-primary {
  font-size: 18px;
  background-color: #007bff;
  color: white;
}

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

.btn-success {
  font-size: 12px;
  background-color: #28a745;
  color: white;
  max-width: 200px;
}

.btn-success:hover {
  background-color: #1e7e34;
}

.btn-danger {
  background-color: #dc3545;
  color: white;
  font-size: 13px;
}

.btn-danger:hover {
  background-color: #b52a37;
}

/* =========================================
   4. RESULTS & ALERTS
   ========================================= */
.result-box {
  margin-top: 20px;
  color: black;
  border: 2px solid red; /* Default Opioid Style */
  padding: 15px;
  background-color: white;
  white-space: pre-wrap;
  font-weight: normal;
  font-size: 14px;
}

/* Benzo Specific: Blue Border Theme */
.result-box.blue-theme {
  border-color: #007bff;
}

.note-title {
  color: red;
  font-weight: bold;
  margin-bottom: 4px;
}

.note {
  margin-top: 2px;
  margin-bottom: 6px;
  font-size: 13px;
  color: #555;
}

/* General Warning Text (Infusion Calc) */
.warning {
    color: #a70000;
    font-weight: bold;
    margin-bottom: 10px;
}

.alert-box {
  background-color: #ffdddd;
  border: 1px solid #ff5c5c;
  color: #a70000;
  font-weight: bold;
  margin-bottom: 12px;
  padding: 10px;
  border-radius: 4px;
}

.inline-warning {
  color: #dc3545;
  font-weight: bold;
  font-size: 13px;
  margin-top: 4px;
  display: none;
}

.bio-warning {
  margin-top: 12px;
  padding: 10px;
  background-color: #fff3cd;
  border: 1px solid #ffecb5;
  color: #856404;
  border-radius: 4px;
  font-size: 13px;
}

.bio-warning strong {
  display: block;
  margin-bottom: 4px;
}

/* =========================================
   5. NAVIGATION & BANNERS
   ========================================= */
.navbar-main {
  background: linear-gradient(135deg, #007bff, #0056b3);
  padding: 15px;
  text-align: center;
  margin-bottom: 20px;
  box-shadow: 0 2px 10px rgba(0, 123, 255, 0.3);
}

.navbar-link {
  color: white;
  text-decoration: none;
  font-weight: bold;
  margin: 0 10px;
  padding: 8px 12px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.2);
  font-size: 13px;
  display: inline-block;
  transition: background 0.3s;
}

.navbar-link:hover {
  background: rgba(255, 255, 255, 0.3);
}

.ratio-banner {
  background-color: #e9ecef;
  border: 1px solid #ced4da;
  border-radius: 6px;
  padding: 10px;
  margin-bottom: 15px;
  text-align: center;
  font-size: 13px;
  color: #495057;
  display: none;
}

.demo-banner {
  background-color: #fff3cd;
  border: 1px solid #ffeeba;
  color: #856404;
  padding: 15px;
  margin-bottom: 20px;
  text-align: center;
  font-size: 14px;
  border-radius: 6px;
}

.demo-banner strong {
  display: block;
  font-size: 16px;
  margin-bottom: 4px;
}

/* =========================================
   6. TABLES (EDIT PAGE & RESULTS)
   ========================================= */
/* Comparison Table (Benzo Results) */
.comparison-table { 
  width: 100%; 
  border-collapse: collapse; 
  margin-top: 10px; 
  font-size: 13px; 
}

.comparison-table th, 
.comparison-table td { 
  border: 1px solid #ddd; 
  padding: 8px; 
  text-align: left; 
}

.comparison-table th { 
  background-color: #f2f2f2; 
  font-weight: bold; 
}

/* General Tables (Infusion / Opioid) */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 12px;
    font-size: 14px;
}

th, td {
    border: 1px solid #ccc;
    padding: 8px;
    text-align: left;
    vertical-align: middle;
}

th {
    background-color: #f2f2f2;
    font-weight: bold;
}

/* Edit Table Container (Benzo Mobile Optimization) */
.table-container {
  max-height: 60vh;
  overflow-y: auto;
  overflow-x: auto;
  border: 1px solid #ddd;
  margin-bottom: 15px;
  border-radius: 4px;
}

/* General Edit Table Styles */
#editPage table {
  width: 100%;
  border-collapse: separate; /* Required for sticky */
  border-spacing: 0;
  font-size: 11px;
}

#editPage thead th {
  position: sticky;
  top: 0;
  background-color: #f2f2f2;
  z-index: 10;
  box-shadow: 0 2px 2px -1px rgba(0, 0, 0, 0.1);
  border-bottom: 2px solid #ccc;
  padding: 6px 4px;
}

#editPage td {
  border-bottom: 1px solid #eee;
  padding: 4px 2px;
  background-color: white;
}

#editPage input, 
#editPage select {
  margin-bottom: 0;
  padding: 4px;
  height: 30px;
  font-size: 11px;
  width: 100%;
  border: 1px solid #ccc;
  border-radius: 4px;
}

#editPage .success { color: green; font-size: 13px; }
#editPage .fail { color: red; font-size: 13px; }

/* Column Sizing */
.select-col { width: 30px; text-align: center; }
.route-col { min-width: 60px; }
.name-col { min-width: 90px; }
.equiv-col { min-width: 50px; }
.data-col { min-width: 65px; } /* Benzo Specific */
.opioid-name-col { min-width: 110px; } /* Opioid Specific */
.ratio-col { min-width: 70px; } /* Opioid Specific */
.unit-col { min-width: 50px; } /* Opioid Specific */

/* Icons */
.info-icon {
  font-size: 1em;
  color: #007bff;
  text-decoration: none;
  padding: 2px 4px;
  border-radius: 4px;
  margin-left: 4px;
  vertical-align: baseline;
  display: inline-flex;
  align-items: center;
  line-height: 1;
  position: relative;
  top: -1px;
  transition: all 0.2s ease;
}

.info-icon i {
  font-size: 1.1em;
}

.info-icon:hover {
  background-color: #e3f2fd;
  transform: scale(1.05);
}

.prn-icon {
  color: #dc3545 !important;
}

.prn-icon i {
  font-size: 1.1em;
}

.prn-icon:hover {
  background-color: #f8d7da !important;
}

.info-icon::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  color: white;
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 12px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  z-index: 1001;
  margin-bottom: 5px;
}

.info-icon:hover::after {
  opacity: 1;
}