/* IIAP Web App Styles */
:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --info-color: #0dcaf0;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --light-color: #f8f9fa;
    --dark-color: #212529;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

header h1 {
    font-weight: 700;
}

.navbar-nav .nav-link {
    padding: 0.5rem 1rem;
    border-radius: 0.25rem;
    transition: all 0.3s;
}

.navbar-nav .nav-link:hover {
    background-color: rgba(255,255,255,0.1);
    transform: translateY(-2px);
}

.card {
    border: none;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    border-radius: 0.75rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    transition: transform 0.3s, box-shadow 0.3s;
    margin-bottom: 1.5rem;
}
.card:hover {
    /* transform: translateY(-5px); */
    box-shadow: 0 8px 20px rgba(0,0,0,0.1);
}

.card-header {
    border-radius: 0.75rem 0.75rem 0 0 !important;
    font-weight: 600;
}

.card .card-body .indexmb-3 {
    margin-bottom: 1rem !important;
    display: grid;
    grid-template-columns: 0.7fr 2.3fr;
    gap: 1rem;
}

.card .card-body .row-mb-3 {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.card .card-body .row .col-md-4 :hover {
    background: #0dcaf02f;
    cursor: pointer;
    /* scale: 1.05;
    transition: all 0.5s ease-in; */
}

.form-control, .form-select {
    border-radius: 0.5rem;
    border: 1px solid #3b83ca;
    padding: 0.75rem;
    background: rgba(30, 143, 255, 0.342);
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

.form-label {
    font-weight: 500;
    color: #01183b;
}
.btn {
    border-radius: 0.5rem;
    padding: 0.5rem 1.5rem;
    font-weight: 500;
    transition: all 0.3s;
}

.btn-outline-primary:hover {
    background-color: var(--primary-color);
    color: white;
}

.progress {
    height: 1.5rem;
    border-radius: 0.75rem;
}

.progress-bar {
    border-radius: 0.75rem;
}

.list-group-item {
    border-left: none;
    border-right: none;
}

.list-group-item:first-child {
    border-top: none;
}

.list-group-item:last-child {
    border-bottom: none;
}

footer {
    border-top: 1px solid rgba(255,255,255,0.1);
}

/* Custom form styling */
.form-control, .form-select {
    border-radius: 0.5rem;
    border: 1px solid #023b75b0;
    padding: 0.75rem;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Dashboard icons */
.fa-3x {
    margin-bottom: 0.5rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .card-body .row .col-md-4 {
        margin-bottom: 1rem;
    }
    .navbar-nav {
        margin-top: 1rem;
    }
}

/* Table styling */
.table th {
    background-color: var(--primary-color);
    color: white;
    border: none;
}

.table td {
    vertical-align: middle;
}

/* Modal customization */
.modal-content {
    border-radius: 0.75rem;
}

/* Alert customization */
.alert {
    border-radius: 0.75rem;
    border: none;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #0b5ed7;
}

.tooltip {
  position: relative;
  display: inline-block;
  border-bottom: 1px dotted black;
  width: 10px;
  height: 10px;
}

.tooltip .tooltiptext {
  visibility: hidden;
  width: max-content;
  background-color: #555;
  color: #fff;
  text-align: center;
  border-radius: 6px;
  padding: 5px 0;
  position: absolute;
  z-index: 1;
  bottom: 125%;
  left: 50%;
  margin-left: -60px;
  opacity: 0;
  transition: opacity 0.3s;
}

.tooltip .tooltiptext::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -5px;
  border-width: 5px;
  border-style: solid;
  border-color: #555 transparent transparent transparent;
}
.tooltip:hover .tooltiptext {
  visibility: visible;
  opacity: 1;
}

/* Hydrologic assessment form: label and input side-by-side */
#hydrologicAssessmentForm .row .col-md-6 {
    border: #01183b 1px solid;
    background-color: #0dcaf0;
}

/* =========================================================================
   UserForm2 Control Panel Styles
   ========================================================================= */

/* Action cards layout */
#moduleActionsPanel .row.g-3 {
    --bs-gutter-y: 1rem;
}

/* Action card hover effect */
.action-card {
    transition: all 0.25s ease-in-out;
    cursor: pointer;
    border-width: 2px;
}

.action-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.action-card .card-body i.fa-3x {
    transition: transform 0.3s ease;
}

.action-card:hover .card-body i.fa-3x {
    transform: scale(1.15);
}

/* Live Clock stylign */
#liveClock {
    font-family: 'Courier New', Courier, monospace;
    font-size: 1.15rem;
    background: rgba(255, 255, 255, 0.15);
    padding: 0.25rem 1rem;
    border-radius: 0.5rem;
    letter-spacing: 2px;
}

/* MIP Detail Panel - Flex row display */
#mipDetailPanel {
    display: flex;
    flex-wrap: wrap;
}

#mipDetailPanel > .col-md-6 {
    display: flex;
}

#mipDetailPanel > .col-md-6 > .card {
    flex: 1;
}

/* Selected MIP identifier badges */
#dispMIPType {
    font-size: 0.95rem;
    padding: 0.3rem 0.75rem;
}

/* Hydrology status color coding (mirrors VBA ForeColor) */
.status-ok {
    color: #198754 !important;
}

.status-fail {
    color: #dc3545 !important;
}

.status-pending {
    color: #ffc107 !important;
}

/* Tank update modal progress bar */
#tankUpdateProgress {
    transition: width 0.3s ease;
}

/* Gap utility for action buttons */
.gap-2 {
    gap: 0.5rem;
}

/* ===== UserForm1 - Beneficiary Water Allocation Detail ===== */
.ua-field {
    margin-bottom: 0.25rem;
}

.ua-label {
    display: block;
    font-size: 0.72rem;
    font-weight: 600;
    color: #555;
    margin-bottom: 0.15rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ua-field.highlight .ua-label {
    color: #0d6efd;
    font-size: 0.78rem;
}

.ua-field input.form-control-sm[readonly] {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    font-size: 0.8rem;
    cursor: default;
}

.ua-field.highlight input.form-control-sm[readonly] {
    background-color: #e7f1ff;
    border-color: #0d6efd;
    font-size: 0.85rem;
}

/* Excess water negative indicator (red, mirrors VBA ForeColor = &HFF&) */
#txtExcessWater.text-danger {
    background-color: #fff5f5 !important;
    border-color: #dc3545 !important;
}

/* Member name badge */
#lblMemberName {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

/* MIP context readonly rows */
#txtDistrict,
#txtBlock,
#txtMIPName,
#txtMIPID {
    font-size: 0.82rem;
    cursor: default;
}

/* Detail panel animation */
#detailPanel {
    animation: fadeSlideIn 0.3s ease;
}

@keyframes fadeSlideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== UserForm3 - Beneficiary Add/Edit ===== */
.uf3-field {
    margin-bottom: 0.25rem;
}

.uf3-label {
    display: block;
    font-size: 0.72rem;
    font-weight: 600;
    color: #555;
    margin-bottom: 0.15rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.uf3-field.highlight-area .uf3-label {
    color: #0d6efd;
    font-size: 0.78rem;
}

.uf3-field.highlight-total .uf3-label {
    color: #198754;
    font-size: 0.78rem;
}

.uf3-field.highlight-cca .uf3-label {
    color: #dc3545;
    font-size: 0.78rem;
}

.uf3-field input.form-control-sm,
.uf3-field select.form-select-sm {
    font-size: 0.82rem;
}

.uf3-field input.form-control-sm[readonly] {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    cursor: default;
}

/* CCA comparison badges */
#ccaComparisonBadge {
    font-size: 0.85rem;
    padding: 0.4rem 0.75rem;
}

/* Total land & CCA fields color states */
#textBox22TotalLand.text-success {
    color: #198754 !important;
    border-color: #198754;
}

#textBox22TotalLand.text-danger {
    color: #dc3545 !important;
    border-color: #dc3545;
    background-color: #fff5f5 !important;
}

#textBox23CCADisplay.text-danger {
    color: #dc3545 !important;
    border-color: #dc3545;
    font-weight: bold;
}

/* Label133 data status badge */
#label133DataStatus {
    font-size: 0.85rem;
    padding: 0.5rem 0.75rem;
    transition: all 0.3s ease;
}

/* ===== UserForm5 - Crop Planning & Water Allocation ===== */

/* Deficit field red when deficit > 0 (mirrors VBA ForeColor = &HFF&) */
.deficit-field.text-danger {
    background-color: #fff5f5 !important;
    border-color: #dc3545 !important;
}

/* Deficit field green when deficit = 0 (mirrors VBA ForeColor = &H4000&) */
.deficit-field.text-success {
    border-color: #198754 !important;
}

/* Reach irrigated fields: zero values shown in pale blue (mirrors VBA ForeColor = &HC0E0FF) */
.reach-zero {
    color: #C0E0FF !important;
    font-weight: 500;
}

/* Reach irrigated fields: non-zero shown in dark green (mirrors VBA ForeColor = &H4000&) */
.reach-nonzero {
    color: #004000 !important;
    font-weight: 500;
}

/* UF5 "ua-field" compact label+input pairs */
.ua-field {
    margin-bottom: 2px;
}

.ua-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: #666;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* UF5 crop allocation table compact styling */
#tblCropAllocation td {
    vertical-align: middle;
    font-size: 0.85rem;
}

#tblCropAllocation th {
    font-size: 0.8rem;
    white-space: nowrap;
}

/* UF5 reach card checkbox header */
.card-header .form-check {
    margin-bottom: 0;
}

/* UF5 reach checkbox highlight: bright yellow background (mirrors VBA BackColor change) */
.uf5-reach-highlight {
    background-color: #FFFFC0 !important;
}

/* UF5 member detail panel fade-in */
#memberDetailPanel {
    animation: fadeSlideIn 0.3s ease;
}

/* UF5 save indicator badge */
#lblSaveStatus {
    font-size: 0.82rem;
    padding: 0.35rem 0.7rem;
    transition: all 0.3s ease;
}

/* UF5 loading overlay */
#loadingIndicatorUF5 {
    padding: 2rem;
}

/* UF5 print: hide nav, buttons, controls (mirrors VBA print behavior) */
@media print {
    .navbar, .btn, #memberCard, #seasonCard, #liveClock,
    #cboMemberID, #cboFarmerCrop, #cmdLoadData, #cmdSave,
    #cmdCancel, #cmdHome, #cmdReportP {
        display: none !important;
    }
    .card {
        break-inside: avoid;
        border: 1px solid #ddd !important;
        box-shadow: none !important;
    }
    body {
        font-size: 10pt;
    }
    #tblCropAllocation {
        font-size: 9pt;
    }
}

/* Responsive: stack MIP detail columns on small screens */
@media (max-width: 768px) {
    #mipDetailPanel {
        flex-direction: column;
    }
    .action-card {
        margin-bottom: 0.75rem;
    }
    .ua-label {
        font-size: 0.68rem;
    }
    .uf3-label {
        font-size: 0.68rem;
    }
}
