.prostate-volume-calculator {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f9f9f9;
    border-radius: 12px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
    padding: 30px;
    max-width: 600px;
    margin: 30px auto;
    color: #333;
    box-sizing: border-box;
}

.prostate-volume-calculator h2 {
    text-align: center;
    color: #007bff;
    margin-bottom: 30px;
    font-size: 1.8em;
    font-weight: 600;
}

.prostate-volume-calculator h3 {
    color: #555;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
    margin-top: 25px;
    margin-bottom: 20px;
    font-size: 1.2em;
}

.input-group {
    margin-bottom: 25px;
}

.form-field {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    position: relative;
    flex-wrap: wrap; /* Allows wrapping on smaller screens */
}

.form-field label {
    flex: 0 0 180px; /* Fixed width for labels */
    margin-right: 15px;
    font-weight: 500;
    color: #444;
    white-space: nowrap;
}

.form-field input[type="number"],
.form-field select {
    flex: 1; /* Takes up remaining space */
    padding: 12px 15px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 1em;
    transition: all 0.3s ease;
    min-width: 150px; /* Ensures input fields are not too small */
}

.form-field input[type="number"]:focus,
.form-field select:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.2);
    outline: none;
}

.tooltip {
    margin-left: 10px;
    background-color: #007bff;
    color: #fff;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9em;
    font-weight: bold;
    cursor: help;
    position: relative;
}

.tooltip::before {
    content: attr(title);
    position: absolute;
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 8px 12px;
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    font-size: 0.8em;
    z-index: 10;
}

.tooltip:hover::before {
    opacity: 1;
    visibility: visible;
}

button#calculate-btn {
    display: block;
    width: 100%;
    padding: 15px;
    background-color: #28a745;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
    margin-top: 30px;
}

button#calculate-btn:hover {
    background-color: #218838;
    transform: translateY(-2px);
}

.results-section {
    margin-top: 40px;
    border-top: 1px solid #eee;
    padding-top: 20px;
}

.result-box {
    background-color: #eaf6ff;
    border: 1px solid #b3e0ff;
    border-left: 5px solid #007bff;
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.result-box h4 {
    margin: 0;
    color: #0056b3;
    font-size: 1.1em;
    font-weight: 600;
}

.result-box p {
    margin: 0;
    font-size: 1.2em;
    font-weight: 700;
    color: #333;
}

.result-box .tooltip {
    background-color: #0056b3;
}

.chart-container {
    margin-top: 30px;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
}

.chart-container h4 {
    text-align: center;
    color: #555;
    margin-bottom: 20px;
    font-size: 1.1em;
}

.volume-bar-chart {
    display: flex;
    width: 100%;
    height: 30px;
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 15px;
    position: relative;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}

.bar-segment {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.8em;
    font-weight: 500;
    padding: 0 5px;
    box-sizing: border-box;
}

.bar-segment.normal {
    background-color: #28a745; /* Green */
}

.bar-segment.enlarged {
    background-color: #ffc107; /* Yellow */
}

.bar-segment.very-enlarged {
    background-color: #dc3545; /* Red */
}

.current-volume-indicator {
    position: absolute;
    top: -5px;
    width: 2px;
    height: calc(100% + 10px);
    background-color: #000;
    border-left: 2px dashed #000; /* Use dashed line for indicator */
    z-index: 5;
    transition: left 0.5s ease-out;
}

.current-volume-indicator::after {
    content: '';
    position: absolute;
    top: -8px;
    left: -5px;
    width: 12px;
    height: 12px;
    background-color: #000;
    border-radius: 50%;
}

.chart-label {
    text-align: center;
    font-style: italic;
    color: #666;
    font-size: 0.95em;
}

.error-message {
    color: #dc3545;
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    padding: 10px 15px;
    border-radius: 8px;
    margin-top: 20px;
    text-align: center;
    font-weight: 500;
    display: none; /* Hidden by default */
}

/* Responsive adjustments */
@media (max-width: 500px) {
    .prostate-volume-calculator {
        padding: 20px;
        margin: 15px auto;
    }

    .form-field label {
        flex: 1 1 100%; /* Labels take full width */
        margin-bottom: 5px;
        margin-right: 0;
    }

    .form-field input[type="number"],
    .form-field select {
        flex: 1 1 100%; /* Inputs take full width */
    }

    .tooltip {
        position: absolute;
        top: 0;
        right: 0;
    }
}


/* ---- Card wrapper (optional) ---- */
.table-wrap{
  max-width: 720px;
  margin: 16px auto;
  padding: 12px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  box-shadow: 0 2px 10px rgba(0,0,0,.04);
  overflow: hidden;
}

/* scroll on small screens */
.table-wrap .scroll{
  width: 100%;
  overflow-x: auto;
}

/* ---- Table base ---- */
table{
  width: 100%;
  border-collapse: collapse;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

/* center all text */
th, td{
  padding: 10px 12px;
  text-align: center;
  white-space: nowrap; /* keeps cc and ng/mL tidy */
  border-bottom: 1px solid #f0f2f5;
}

/* header */
thead th{
  position: sticky;
  top: 0;
  background: #f8fafc;
  font-weight: 600;
  letter-spacing: .2px;
  border-bottom: 1px solid #e5e7eb;
  z-index: 1;
}

/* rows */
tbody tr:nth-child(even){
  background: #fafafa;
}

tbody tr:hover{
  background: #f1f5f9;
}

/* rounded corners */
table{
  border-radius: 10px;
  overflow: hidden;
}

/* caption (if you add one) */
caption{
  caption-side: top;
  padding: 8px 0 12px;
  font-weight: 600;
}

/* compact mode for very small screens */
@media (max-width: 420px){
  th, td{ padding: 8px 10px; font-size: 13px; }
}

/* dark mode */
@media (prefers-color-scheme: dark){
  .table-wrap{ background: #0b0e12; border-color: #1f2937; box-shadow: none; }
  table{ color: #e5e7eb; }
  thead th{ background: #0f172a; border-bottom-color: #243041; }
  th, td{ border-bottom-color: #1f2937; }
  tbody tr:nth-child(even){ background: #0e141d; }
  tbody tr:hover{ background: #111827; }
}
