/**
 * 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;
}

/* ============================================
   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;
}

/* ============================================
   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-meta {
    font-size: 12px;
    color: var(--gh-text-muted);
}

.gh-alert-actions {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 10px;
}

/* ============================================
   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-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 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;
    }
}

@media (max-width: 480px) {
    .gh-stats-grid {
        grid-template-columns: 1fr;
    }
    
    .gh-inventory-grid {
        grid-template-columns: 1fr;
    }
}