/**
 * Greenhouse Monitoring Styles
 * @package WebAppBuilder
 * @version 1.0.0
 */

/* ============================================
   Variables / Theme Colors
   ============================================ */
:root {
    --gh-primary: #2e7d32;
    --gh-primary-light: #4caf50;
    --gh-primary-bg: #e8f5e9;
    --gh-success: #28a745;
    --gh-warning: #ffc107;
    --gh-danger: #dc3545;
    --gh-info: #2196f3;
    --gh-text: #333;
    --gh-text-muted: #666;
    --gh-border: #dee2e6;
    --gh-bg-light: #f8f9fa;
    --gh-shadow: 0 2px 8px rgba(0,0,0,0.1);
    --gh-radius: 10px;
    --gh-radius-sm: 6px;
}

/* ============================================
   Body Lock for Modal
   ============================================ */
body.gh-modal-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
}

/* ============================================
   Alerts Widget
   ============================================ */
.gh-alerts-widget {
    background: #fff;
    border-radius: var(--gh-radius);
    padding: 20px;
    margin: 20px 0;
    box-shadow: var(--gh-shadow);
}

.gh-widget-title {
    margin: 0 0 15px;
    color: var(--gh-text);
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.gh-widget-title i {
    color: var(--gh-warning);
}

.gh-no-alerts {
    text-align: center;
    padding: 30px;
    color: var(--gh-success);
}

.gh-no-alerts i {
    font-size: 24px;
    margin-bottom: 10px;
}

.gh-alert-item {
    padding: 12px;
    margin: 8px 0;
    border-radius: 4px;
    position: relative;
}

.gh-alert-critical {
    background: #f8d7da;
    border-left: 4px solid var(--gh-danger);
}

.gh-alert-warning {
    background: #fff3cd;
    border-left: 4px solid var(--gh-warning);
}

.gh-alert-time {
    float: right;
    font-size: 12px;
    color: var(--gh-text-muted);
}

.gh-view-all-link {
    display: block;
    text-align: center;
    margin-top: 15px;
    color: var(--gh-primary);
    text-decoration: none;
}

.gh-view-all-link:hover {
    text-decoration: underline;
}

/* ============================================
   Draft Indicator
   ============================================ */
.gh-draft-indicator {
    padding: 12px 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.gh-draft-new {
    background: #e3f2fd;
    border: 1px solid var(--gh-info);
    color: #1565c0;
}

.gh-draft-progress {
    background: #e3f2fd;
    border: 1px solid var(--gh-info);
    color: #1565c0;
}

.gh-draft-indicator i {
    font-size: 16px;
}

/* ============================================
   Filter Form
   ============================================ */
.gh-filter-form {
    background: var(--gh-bg-light);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 25px;
}

.gh-date-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: flex-end;
}

.gh-filter-label {
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 13px;
    color: var(--gh-text-muted);
}

/* ============================================
   Stats Grid
   ============================================ */
.gh-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.gh-stat-card {
    background: var(--gh-bg-light);
    padding: 20px;
    border-radius: 8px;
    text-align: center;
}

.gh-stat-value {
    font-size: 28px;
    font-weight: 700;
}

.gh-stat-success { color: var(--gh-success); }
.gh-stat-warning { color: var(--gh-warning); }
.gh-stat-danger { color: var(--gh-danger); }

.gh-stat-label {
    font-size: 12px;
    color: var(--gh-text-muted);
    margin-top: 5px;
}

.gh-summary-title {
    margin: 0 0 20px;
    color: var(--gh-text);
}

.gh-section-title {
    margin: 25px 0 15px;
    color: var(--gh-text);
    font-size: 16px;
}

/* ============================================
   Tables
   ============================================ */
.gh-table {
    width: 100%;
    border-collapse: collapse;
}

.gh-table th,
.gh-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.gh-table thead tr {
    background: var(--gh-bg-light);
}

.gh-table thead th {
    border-bottom: 2px solid var(--gh-border);
    font-weight: 600;
}

.gh-table tbody tr:hover {
    background: #fafafa;
}

.gh-table-responsive {
    overflow-x: auto;
}

.gh-actions-col {
    width: 150px;
    text-align: center;
}

.gh-cell-bold {
    font-weight: 600;
}

.gh-cell-center {
    text-align: center;
}

.gh-cell-unit {
    text-align: center;
    color: var(--gh-text-muted);
}

/* Threshold table specific */
.gh-threshold-table {
    min-width: 900px;
}

.gh-th-possible,
.gh-cell-possible {
    background: #e3f2fd;
    text-align: center;
}

.gh-th-desired,
.gh-cell-desired {
    background: #d4edda;
    text-align: center;
}

.gh-th-critical,
.gh-cell-critical {
    background: #f8d7da;
    text-align: center;
}

.gh-edit-row {
    background: #fffbeb !important;
}

/* ============================================
   Buttons
   ============================================ */
.gh-btn {
    padding: 10px 20px;
    border-radius: var(--gh-radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    transition: all 0.2s;
}

.gh-btn-primary {
    background: var(--gh-primary);
    color: #fff;
}

.gh-btn-primary:hover {
    background: var(--gh-primary-light);
}

.gh-btn-success {
    background: var(--gh-success);
    color: #fff;
}

.gh-btn-danger {
    background: var(--gh-danger);
    color: #fff;
}

.gh-btn-outline {
    background: #fff;
    border: 1px solid var(--gh-border);
    color: var(--gh-text-muted);
}

.gh-btn-outline:hover {
    border-color: var(--gh-primary);
    color: var(--gh-primary);
}

.gh-btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.gh-btn-xs {
    padding: 4px 8px;
    font-size: 11px;
}

.gh-link-cancel {
    font-size: 11px;
    color: var(--gh-text-muted);
    text-decoration: none;
}

.gh-link-cancel:hover {
    text-decoration: underline;
}

/* ============================================
   Forms / Inputs
   ============================================ */
.gh-input {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: var(--gh-radius-sm);
    font-size: 14px;
    transition: border-color 0.2s;
}

.gh-input:focus {
    outline: none;
    border-color: var(--gh-primary);
}

.gh-input-sm {
    padding: 8px;
    font-size: 13px;
}

.gh-input-unit {
    width: 50px;
    text-align: center;
}

.gh-input-num {
    width: 60px;
}

.gh-form-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.gh-form-field label {
    font-size: 12px;
    color: var(--gh-text-muted);
}

.gh-inline-form {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.gh-add-form {
    background: var(--gh-bg-light);
    padding: 20px;
    border-radius: 8px;
    margin-top: 20px;
}

.gh-add-form h4 {
    margin: 0 0 15px;
    color: var(--gh-text);
}

.gh-threshold-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 10px;
    margin-bottom: 15px;
}

.gh-form-actions {
    display: flex;
    gap: 20px;
    align-items: center;
}

.gh-checkbox {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    cursor: pointer;
}

.gh-checkbox input {
    width: 16px;
    height: 16px;
}

/* Checkbox Group (for greenhouse assignment) */
.gh-checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 8px;
}

.gh-checkbox-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: #fff;
    border: 1px solid var(--gh-border);
    border-radius: var(--gh-radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 13px;
}

.gh-checkbox-item:hover {
    border-color: var(--gh-primary);
    background: var(--gh-primary-bg);
}

.gh-checkbox-item input:checked + span,
.gh-checkbox-item:has(input:checked) {
    background: var(--gh-primary-bg);
    border-color: var(--gh-primary);
}

.gh-checkbox-item input {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* Edit/Add Form Grids */
.gh-edit-grid,
.gh-add-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 15px;
}

.gh-edit-form {
    padding: 15px;
    background: #fffbeb;
    border-radius: var(--gh-radius-sm);
}

/* Greenhouse Assignment Section */
.gh-greenhouse-assign {
    margin: 15px 0;
}

.gh-greenhouse-assign > label {
    font-weight: 500;
    color: var(--gh-text);
    margin-bottom: 8px;
    display: block;
}

/* Greenhouse Tags Display */
.gh-greenhouse-tags {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 5px;
}

.gh-greenhouse-tag {
    background: var(--gh-primary-bg);
    color: var(--gh-primary);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
}

/* Warning Text */
.gh-warning-text {
    background: #fff3cd;
    color: #856404;
    padding: 10px 15px;
    border-radius: var(--gh-radius-sm);
    font-size: 13px;
    margin: 10px 0;
}

.gh-warning-text i {
    margin-right: 6px;
}

/* Disabled button */
.gh-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ============================================
   Badges
   ============================================ */
.gh-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 500;
}

.gh-badge-success {
    background: #d4edda;
    color: #155724;
}

.gh-badge-danger {
    background: #f8d7da;
    color: #721c24;
}

.gh-badge-warning {
    background: #fff3cd;
    color: #856404;
}

.gh-badge-info {
    background: #e3f2fd;
    color: #1565c0;
}

/* ============================================
   Messages
   ============================================ */
.gh-message {
    padding: 12px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.gh-message-success {
    background: #d4edda;
    color: #155724;
}

.gh-message-error {
    background: #f8d7da;
    color: #721c24;
}

.gh-message-warning {
    background: #fff3cd;
    color: #856404;
}

/* ============================================
   Settings Page
   ============================================ */
.gh-settings-tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 20px;
    background: #f0f0f0;
    padding: 5px;
    border-radius: var(--gh-radius);
    flex-wrap: wrap;
}

.gh-settings-tab {
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--gh-text-muted);
    font-weight: 500;
    transition: all 0.2s;
}

.gh-settings-tab:hover {
    background: rgba(255,255,255,0.5);
}

.gh-settings-tab.gh-tab-active {
    background: var(--gh-primary);
    color: #fff;
}

.gh-settings-card {
    background: #fff;
    border-radius: var(--gh-radius);
    padding: 20px;
    box-shadow: var(--gh-shadow);
}

.gh-settings-title {
    margin: 0 0 20px;
    color: var(--gh-primary);
}

.gh-settings-desc {
    color: var(--gh-text-muted);
    margin: 0 0 20px;
    font-size: 14px;
}

.gh-empty-text {
    color: var(--gh-text-muted);
    margin-bottom: 20px;
}

/* ============================================
   Filter Tabs (Alerts Page)
   ============================================ */
.gh-filter-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.gh-tab {
    padding: 8px 16px;
    border-radius: 20px;
    text-decoration: none;
    color: var(--gh-text-muted);
    background: var(--gh-bg-light);
    font-size: 14px;
    transition: all 0.2s;
}

.gh-tab:hover {
    background: #e0e0e0;
}

.gh-tab-active {
    background: var(--gh-primary);
    color: #fff;
}

/* ============================================
   Alert Cards (Alerts Page)
   ============================================ */
.gh-alert-card {
    background: #fff;
    border-radius: var(--gh-radius);
    padding: 20px;
    margin-bottom: 15px;
    box-shadow: var(--gh-shadow);
}

.gh-alert-card.gh-alert-critical {
    border-left: 4px solid var(--gh-danger);
}

.gh-alert-card.gh-alert-warning {
    border-left: 4px solid var(--gh-warning);
}

.gh-alert-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.gh-alert-greenhouse {
    background: #e3f2fd;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 12px;
    color: #1565c0;
}

.gh-alert-severity {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.gh-alert-card.gh-alert-critical .gh-alert-severity {
    color: var(--gh-danger);
}

.gh-alert-card.gh-alert-warning .gh-alert-severity {
    color: #ff8f00;
}

.gh-alert-message {
    margin: 0 0 10px;
    color: var(--gh-text);
}

.gh-alert-actions {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.gh-alert-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.gh-alert-icon {
    font-size: 16px;
}

.gh-alert-card.gh-alert-critical .gh-alert-icon { color: var(--gh-danger); }
.gh-alert-card.gh-alert-warning  .gh-alert-icon { color: #ff8f00; }

.gh-alert-type-badge {
    background: #f3f4f6;
    color: #374151;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .3px;
}

.gh-alert-severity-critical { color: var(--gh-danger); }
.gh-alert-severity-warning  { color: #ff8f00; }

.gh-alert-details {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 8px 0 10px;
    padding: 10px 12px;
    background: #f9fafb;
    border-radius: 6px;
    font-size: 13px;
}

.gh-alert-detail-item { color: var(--gh-text); }

.gh-alert-meta {
    font-size: 12px;
    color: var(--gh-text-muted);
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    align-items: center;
}

.gh-alert-meta i { margin-right: 4px; }

.gh-alert-status-label {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.gh-status-acknowledged { background: #fef3c7; color: #92400e; }
.gh-status-resolved     { background: #d1fae5; color: #065f46; }

.gh-btn-info {
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.gh-btn-info:hover { background: #dbeafe; }

/* ============================================
   Empty State
   ============================================ */
.gh-empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--gh-text-muted);
}

.gh-empty-state i {
    font-size: 48px;
    color: #ddd;
    margin-bottom: 15px;
}

.gh-empty-state p {
    margin: 0;
}

/* ============================================
   Inventory Widget
   ============================================ */
.gh-inventory-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 15px;
}

.gh-inventory-card {
    background: #fff;
    border-radius: var(--gh-radius);
    padding: 20px;
    box-shadow: var(--gh-shadow);
    text-align: center;
}

.gh-inventory-card.gh-stock-low {
    border: 2px solid var(--gh-warning);
}

.gh-inventory-name {
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--gh-text);
}

.gh-inventory-qty {
    font-size: 24px;
    font-weight: 700;
    color: var(--gh-primary);
}

.gh-inventory-warning {
    margin-top: 10px;
    font-size: 12px;
    color: var(--gh-warning);
}

.gh-inventory-warning i {
    margin-right: 4px;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 768px) {
    .gh-daily-form {
        padding: 10px 2px;
    }

    .gh-date-filter {
        flex-direction: column;
        align-items: stretch;
    }

    .gh-inline-form {
        flex-direction: column;
        align-items: stretch;
    }

    .gh-inline-form .gh-btn {
        width: 100%;
        justify-content: center;
    }

    .gh-settings-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
    }

    .gh-settings-tab {
        white-space: nowrap;
    }

    .gh-table-responsive {
        padding: 0 2px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .gh-table {
        min-width: 500px;
    }

    .gh-table th,
    .gh-table td {
        padding: 8px;
        font-size: 13px;
    }

    .gh-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .gh-alert-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .gh-form-actions {
        flex-direction: column;
        align-items: flex-start;
    }

    .gh-settings-card {
        padding: 15px 2px;
    }

    .gh-filter-form {
        padding: 15px 2px;
    }

    .gh-add-form {
        padding: 15px 2px;
    }

    .gh-threshold-form-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .gh-edit-grid,
    .gh-add-form-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .gh-stats-grid {
        grid-template-columns: 1fr;
    }

    .gh-inventory-grid {
        grid-template-columns: 1fr;
    }

    .gh-section-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ============================================
   Daily Monitoring Card-Based Form
   ============================================ */
.gh-daily-form {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

.gh-section-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 15px;
    margin-bottom: 30px;
}

.gh-section-card {
    background: #fff;
    border-radius: var(--gh-radius);
    padding: 20px 15px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: var(--gh-shadow);
    position: relative;
    border: 2px solid transparent;
}

.gh-section-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    border-color: var(--gh-primary-light);
}

.gh-section-card.complete {
    border-color: var(--gh-success);
    background: linear-gradient(135deg, #fff 0%, #e8f5e9 100%);
}

.gh-section-card.incomplete {
    border-color: var(--gh-warning);
    background: linear-gradient(135deg, #fff 0%, #fff8e1 100%);
}

.gh-section-icon {
    font-size: 32px;
    margin-bottom: 8px;
}

.gh-section-number {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 22px;
    height: 22px;
    background: var(--gh-primary);
    color: #fff;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gh-section-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--gh-text);
}

.gh-section-status {
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 18px;
}

.gh-section-card.complete .gh-section-status {
    color: var(--gh-success);
}

.gh-section-card.incomplete .gh-section-status {
    color: var(--gh-warning);
}

.gh-required-badge {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    background: #ffebee;
    color: #c62828;
    font-size: 9px;
    padding: 2px 6px;
    border-radius: 8px;
    font-weight: 500;
}

.gh-repeatable-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--gh-info);
    color: #fff;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gh-section-card.complete .gh-repeatable-badge,
.gh-section-card.incomplete .gh-repeatable-badge {
    right: 32px;
}

.gh-location-badge {
    display: none;
    position: absolute;
    top: 8px;
    left: 8px;
    min-width: 22px;
    height: 22px;
    padding: 0 7px;
    border-radius: 11px;
    font-size: 10px;
    font-weight: 700;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: var(--gh-warning);
    white-space: nowrap;
}

.gh-location-card.complete .gh-location-badge {
    background: var(--gh-success);
}

.gh-location-card.incomplete .gh-location-badge {
    background: var(--gh-warning);
}

/* Submit Area */
.gh-form-submit-area {
    text-align: center;
    padding: 20px;
    background: var(--gh-bg-light);
    border-radius: var(--gh-radius);
}

.gh-btn-lg {
    padding: 15px 40px;
    font-size: 16px;
}

.gh-submit-hint {
    margin-top: 10px;
    font-size: 13px;
    color: var(--gh-text-muted);
}

/* ============================================
   Modal Styles
   ============================================ */
.gh-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    overflow: hidden;
    touch-action: none;
}

.gh-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.gh-modal {
    background: #fff;
    border-radius: var(--gh-radius);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    transform: translateY(-20px);
    transition: transform 0.3s;
    touch-action: auto;
    overflow: hidden;
}

.gh-modal-overlay.active .gh-modal {
    transform: translateY(0);
}

.gh-modal-header {
    padding: 0px 20px;
    border-bottom: 1px solid var(--gh-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.gh-modal-header h3 {
    margin: 0;
    color: var(--gh-text);
    font-size: 18px;
}

.gh-modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: var(--gh-text-muted);
    cursor: pointer;
    line-height: 1;
    padding: 0;
}

.gh-modal-close:hover {
    color: var(--gh-danger);
}

.gh-modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-y;
}

.gh-modal-footer {
    padding: 3px 20px;
    border-top: 1px solid var(--gh-border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Modal Form Fields */
.gh-modal-field {
    margin-bottom: 15px;
}

.gh-modal-field label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--gh-text);
    margin-bottom: 5px;
}

.gh-modal-field label .required {
    color: var(--gh-danger);
}

.gh-modal-field input,
.gh-modal-field select,
.gh-modal-field textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--gh-border);
    border-radius: var(--gh-radius-sm);
    font-size: 14px;
    transition: border-color 0.2s;
}

.gh-modal-field input:focus,
.gh-modal-field select:focus,
.gh-modal-field textarea:focus {
    outline: none;
    border-color: var(--gh-primary);
}

.gh-modal-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.gh-modal-subheading {
    margin: 20px 0 15px;
    padding-top: 15px;
    border-top: 1px solid var(--gh-border);
    font-size: 14px;
    color: var(--gh-text);
}

.gh-checkbox-field label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.gh-checkbox-field input[type="checkbox"] {
    width: 18px;
    height: 18px;
}

/* ============================================
   Repeater Styles
   ============================================ */
.gh-repeater-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 20px 0 15px;
    padding-top: 15px;
    border-top: 1px solid var(--gh-border);
}

.gh-repeater-header h4 {
    margin: 0;
    font-size: 14px;
    color: var(--gh-text);
}

.gh-repeater-item {
    background: var(--gh-bg-light);
    border-radius: var(--gh-radius-sm);
    padding: 15px;
    margin-bottom: 15px;
    border: 1px solid var(--gh-border);
}

.gh-repeater-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--gh-border);
}

.gh-repeater-item-header span {
    font-weight: 600;
    font-size: 14px;
    color: var(--gh-primary);
}

.gh-btn-remove {
    background: var(--gh-danger);
    color: #fff;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gh-btn-remove:hover {
    background: #c62828;
}

/* Responsive for card grid */
@media (max-width: 768px) {
    .gh-section-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .gh-modal-row {
        grid-template-columns: 1fr;
    }

    .gh-modal {
        width: 95%;
        max-height: 85vh;
    }

    .gh-modal-body {
        max-height: calc(85vh - 140px);
        -webkit-overflow-scrolling: touch;
    }
}

@media (max-width: 480px) {
    .gh-section-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .gh-section-card {
        padding: 15px 10px;
    }

    .gh-section-icon {
        font-size: 24px;
    }

    .gh-section-title {
        font-size: 11px;
    }
}

/* ============================================
   Auto-save Indicator
   ============================================ */
.gh-autosave-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--gh-primary-bg);
    color: var(--gh-primary);
    border-radius: var(--gh-radius-sm);
    font-size: 13px;
    font-weight: 500;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    margin-bottom: 10px;
}

.gh-autosave-indicator.show {
    opacity: 1;
    transform: translateY(0);
}

.gh-autosave-indicator i {
    color: var(--gh-success);
}

/* ============================================
   Restore Notification
   ============================================ */
.gh-restore-notification {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    border: 1px solid #90caf9;
    border-radius: var(--gh-radius);
    margin-bottom: 20px;
    font-size: 14px;
    color: #1565c0;
}

.gh-restore-notification i {
    font-size: 18px;
    color: #1976d2;
}

.gh-restore-notification .gh-btn-sm {
    margin-left: auto;
    padding: 4px 12px;
    font-size: 12px;
    background: #fff;
    color: #1565c0;
    border: 1px solid #90caf9;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.gh-restore-notification .gh-btn-sm:hover {
    background: #1565c0;
    color: #fff;
}

/* Modal hint text */
.gh-modal-hint {
    font-size: 13px;
    color: var(--gh-text-muted);
    margin: 0 0 15px;
    padding: 10px;
    background: var(--gh-bg-light);
    border-radius: var(--gh-radius-sm);
}

/* ============================================
   Photo Capture Component
   ============================================ */
.gh-photo-capture {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.gh-photo-capture .gh-photo-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.gh-photo-capture .gh-photo-btn {
    flex: 1;
    min-width: 120px;
    padding: 12px 16px;
    border: 2px dashed var(--gh-border);
    border-radius: var(--gh-radius-sm);
    background: var(--gh-bg-light);
    color: var(--gh-text);
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.gh-photo-capture .gh-photo-btn:hover {
    border-color: var(--gh-primary);
    background: var(--gh-primary-bg);
    color: var(--gh-primary);
}

.gh-photo-capture .gh-photo-btn i {
    font-size: 18px;
}

.gh-photo-capture .gh-photo-btn-camera {
    border-color: var(--gh-primary-light);
}

.gh-photo-capture .gh-photo-btn-camera:hover {
    background: var(--gh-primary);
    color: #fff;
    border-color: var(--gh-primary);
}

.gh-photo-capture input[type="file"] {
    display: none;
}

.gh-photo-capture .gh-photo-preview {
    display: none;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.gh-photo-capture .gh-photo-preview.has-photos {
    display: flex;
}

.gh-photo-capture .gh-photo-thumb {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: var(--gh-radius-sm);
    overflow: hidden;
    border: 1px solid var(--gh-border);
}

.gh-photo-capture .gh-photo-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gh-photo-capture .gh-photo-thumb .gh-photo-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 20px;
    height: 20px;
    background: rgba(220, 53, 69, 0.9);
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
}

.gh-photo-capture .gh-photo-thumb:hover .gh-photo-remove {
    opacity: 1;
}

.gh-photo-capture .gh-photo-count {
    font-size: 12px;
    color: var(--gh-text-muted);
    margin-top: 5px;
}

@media (max-width: 480px) {
    .gh-photo-capture .gh-photo-buttons {
        flex-direction: column;
    }

    .gh-photo-capture .gh-photo-btn {
        min-width: 100%;
    }
}

/* ============================================
   Report Detail Modal Overlay
   ============================================ */
.gh-rd-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9990;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(3px);
    overflow-y: auto;
    padding: 20px 12px 40px;
    animation: ghFadeIn 0.2s ease;
}
.gh-rd-overlay.gh-rd-visible {
    display: block;
}

.gh-rd-modal {
    background: #fff;
    max-width: 880px;
    margin: 0 auto;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
    animation: ghSlideUp 0.25s ease;
}

.gh-rd-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    background: linear-gradient(135deg, var(--gh-primary) 0%, #1b5e20 100%);
    color: #fff;
}

.gh-rd-modal-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.gh-rd-modal-title i {
    font-size: 1.1rem;
    opacity: 0.9;
}

.gh-rd-close-btn {
    background: rgba(255,255,255,0.15);
    border: none;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 1.3rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}
.gh-rd-close-btn:hover { background: rgba(255,255,255,0.3); }

.gh-rd-modal-body {
    padding: 24px;
    min-height: 200px;
    max-height: 80vh;
    overflow-y: auto;
}

.gh-rd-loading {
    text-align: center;
    padding: 50px 20px;
    color: var(--gh-text-muted);
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.gh-rd-error {
    text-align: center;
    padding: 30px;
    color: var(--gh-danger);
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* ============================================
   Report Detail Content Sections
   ============================================ */
.gh-report-detail {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.gh-report-detail-section {
    background: #fff;
    border: 1px solid #e8edf2;
    border-radius: 10px;
    overflow: hidden;
}

.gh-report-detail-section > h4 {
    margin: 0;
    padding: 11px 16px;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--gh-primary);
    background: #f0f7f0;
    border-bottom: 1px solid #d4e8d4;
    display: flex;
    align-items: center;
    gap: 7px;
}

.gh-report-detail-section > h4 i {
    font-size: 13px;
    opacity: 0.85;
}

.gh-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0;
    padding: 4px 0;
}

.gh-detail-item {
    padding: 10px 16px;
    border-bottom: 1px solid #f0f2f5;
}
.gh-detail-item:last-child { border-bottom: none; }

.gh-detail-item-full {
    grid-column: 1 / -1;
}

.gh-detail-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--gh-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 3px;
}

.gh-detail-value {
    font-size: 14px;
    color: var(--gh-text);
    font-weight: 500;
}

.gh-detail-value.gh-val-good    { color: var(--gh-success); font-weight: 600; }
.gh-detail-value.gh-val-warning { color: #e67e00; font-weight: 600; }
.gh-detail-value.gh-val-critical { color: var(--gh-danger); font-weight: 600; }

/* Sub-headings inside sections (Event #1, Plant #2, etc.) */
.gh-report-detail-section h5 {
    margin: 0 !important;
    padding: 8px 16px 4px;
    font-size: 12px;
    font-weight: 700;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: #fafafa;
    border-top: 1px solid #f0f2f5;
    border-bottom: 1px solid #f0f2f5;
}

/* Notes section */
.gh-report-detail-section .gh-notes-block {
    padding: 12px 16px;
}
.gh-report-detail-section .gh-notes-block .gh-detail-label {
    margin-bottom: 6px;
}
.gh-notes-text {
    background: var(--gh-bg-light);
    border-radius: 6px;
    padding: 10px 12px;
    font-size: 14px;
    color: var(--gh-text);
    line-height: 1.5;
    white-space: pre-wrap;
}

/* ============================================
   Photo Thumbnails in Report Detail
   ============================================ */
.gh-rd-photo-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 4px;
}

.gh-rd-photo-thumb {
    width: 90px;
    height: 90px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid var(--gh-border);
    cursor: pointer;
    transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.gh-rd-photo-thumb:hover {
    transform: scale(1.06);
    border-color: var(--gh-primary);
    box-shadow: 0 4px 14px rgba(46,125,50,0.25);
}

/* ============================================
   Photo Lightbox
   ============================================ */
.gh-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.92);
    align-items: center;
    justify-content: center;
    cursor: zoom-out;
    animation: ghFadeIn 0.15s ease;
}
.gh-lightbox.gh-lightbox-visible {
    display: flex;
}

.gh-lightbox-img {
    max-width: 92vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 6px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.6);
    cursor: default;
}

.gh-lightbox-close {
    position: fixed;
    top: 16px;
    right: 20px;
    background: rgba(255,255,255,0.15);
    border: none;
    color: #fff;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    z-index: 10001;
}
.gh-lightbox-close:hover { background: rgba(255,255,255,0.3); }

/* ============================================
   Animations
   ============================================ */
@keyframes ghFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes ghSlideUp {
    from { transform: translateY(30px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

/* ============================================
   Report Modal — Responsive
   ============================================ */
@media (max-width: 600px) {
    .gh-rd-modal-body { padding: 14px; max-height: 85vh; }
    .gh-detail-grid { grid-template-columns: 1fr 1fr; }
    .gh-rd-photo-thumb { width: 70px; height: 70px; }
}