/* Mobile Responsive Styles for Trends.Earth API Dashboard */

/* Basic responsive navigation */
@media (max-width: 768px) {
    /* Make tabs wrap and reduce padding */
    .nav-tabs {
        flex-wrap: wrap !important;
        gap: 2px !important;
    }
    
    .nav-item {
        margin-bottom: 4px !important;
    }
    
    .nav-link {
        padding: 0.5rem 0.75rem !important;
        font-size: 0.9rem !important;
        min-height: 44px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    /* Container adjustments for mobile */
    .container-fluid {
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
    }
    
    /* Table responsive adjustments */
    .ag-cell, .ag-header-cell {
        min-height: 32px !important;
        padding: 4px 8px !important;
    }
    
    /* Better spacing for touch */
    .btn {
        min-height: 44px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    /* Scroll hint for tables */
    .table-scroll-hint {
        display: block !important;
        text-align: center;
        padding: 0.5rem;
        background-color: #f8f9fa;
        border: 1px solid #dee2e6;
        border-top: none;
        color: #6c757d;
        font-size: 0.875rem;
        font-style: italic;
    }
}

/* Desktop - hide mobile-specific elements */
@media (min-width: 769px) {
    .table-scroll-hint {
        display: none !important;
    }
}

/* Horizontal scrolling indicator for tables */
.table-scroll-hint {
    display: none;
    font-size: 0.8rem;
    color: #6c757d;
    text-align: center;
    padding: 0.5rem;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-top: none;
}

@media (max-width: 768px) {
    .table-scroll-hint {
        display: block;
    }
}

/* Pinned columns styling */
.ag-pinned-left-cols-container {
    box-shadow: 2px 0 4px rgba(0, 0, 0, 0.1) !important;
}

/* Touch-friendly styling for mobile */
@media (max-width: 768px) {
    .ag-cell, .ag-header-cell {
        min-height: 32px !important;
    }
    
    /* Increase touch targets */
    .btn, .nav-link {
        min-height: 44px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    /* Better spacing for touch */
    .nav-tabs {
        gap: 2px !important;
    }
}

/* Desktop styles - ensure mobile elements are hidden */
@media (min-width: 769px) {
    /* Hide mobile menu toggle on desktop */
    #mobile-menu-toggle {
        display: none !important;
    }
    
    /* Hide mobile menu overlay on desktop */
    .mobile-menu-overlay {
        display: none !important;
        visibility: hidden !important;
    }
    
    /* Ensure desktop tabs are visible */
    #tabs-nav {
        display: flex !important;
        visibility: visible !important;
    }
}

/* AG-Grid Row Status Colors - Execution Statuses */
.ag-row.row-failed {
    background-color: #F8D7DA !important;
    color: #721C24 !important;
}

.ag-row.row-finished {
    background-color: #D1E7DD !important;
    color: #0F5132 !important;
}

.ag-row.row-running {
    background-color: #CCE5FF !important;
    color: #084298 !important;
}

.ag-row.row-ready {
    background-color: #FFF3CD !important;
    color: #664D03 !important;
}

.ag-row.row-pending {
    background-color: #E2E3E5 !important;
    color: #495057 !important;
}

/* AG-Grid Row Status Colors - Script Statuses */
.ag-row.row-published {
    background-color: #D1E7DD !important;
    color: #0F5132 !important;
}

.ag-row.row-draft {
    background-color: #FFF3CD !important;
    color: #664D03 !important;
}

.ag-row.row-archived {
    background-color: #F8D7DA !important;
    color: #721C24 !important;
}

.ag-row.row-success {
    background-color: #D1E7DD !important;
    color: #0F5132 !important;
}

.ag-row.row-fail {
    background-color: #F8D7DA !important;
    color: #721C24 !important;
}

.ag-row.row-building {
    background-color: #CCE5FF !important;
    color: #084298 !important;
}

.ag-row.row-active {
    background-color: #D1E7DD !important;
    color: #0F5132 !important;
}

.ag-row.row-inactive {
    background-color: #E2E3E5 !important;
    color: #495057 !important;
}

/* Hover effects for all status rows */
.ag-row.row-failed:hover,
.ag-row.row-archived:hover,
.ag-row.row-fail:hover {
    background-color: #F5C2C7 !important;
}

.ag-row.row-finished:hover,
.ag-row.row-published:hover,
.ag-row.row-success:hover,
.ag-row.row-active:hover {
    background-color: #BADBCC !important;
}

.ag-row.row-running:hover,
.ag-row.row-building:hover {
    background-color: #B6D7FF !important;
}

.ag-row.row-ready:hover,
.ag-row.row-draft:hover {
    background-color: #FFECB5 !important;
}

.ag-row.row-pending:hover,
.ag-row.row-inactive:hover {
    background-color: #D3D3D4 !important;
}

/* Enhanced JSON Viewer Styles */
.enhanced-json-viewer {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 13px;
    line-height: 1.4;
}

.json-controls {
    border: 1px solid #e9ecef;
    border-radius: 0.375rem;
    background-color: #f8f9fa;
    padding: 12px;
    margin-bottom: 16px;
}

.json-tree-container {
    border: 1px solid #e9ecef;
    border-radius: 0.375rem;
    background-color: #ffffff;
    padding: 16px;
    max-height: 60vh;
    overflow-y: auto;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
}

/* JSON Node Styling */
.json-details {
    border: none;
    margin: 2px 0;
}

.json-summary {
    cursor: pointer;
    padding: 4px 8px;
    margin: 2px 0;
    border-radius: 4px;
    transition: background-color 0.2s ease;
    list-style: none;
    outline: none;
}

.json-summary::-webkit-details-marker {
    display: none;
}

.json-summary::marker {
    content: '';
}

.json-summary:before {
    content: '▶';
    display: inline-block;
    width: 16px;
    color: #6c757d;
    transition: transform 0.2s ease;
    margin-right: 4px;
}

.json-details[open] .json-summary:before {
    transform: rotate(90deg);
}

.json-summary:hover {
    background-color: #f8f9fa;
}

.json-details-content {
    margin-left: 12px;
    margin-top: 3px;
    border-left: 1px solid #e9ecef;
    padding-left: 8px;
}

/* JSON Value Styling */
.json-key {
    color: #0066cc;
    font-weight: 500;
}

.json-colon {
    color: #666;
    margin: 0 4px;
}

.json-index {
    color: #8c59ab;
    font-weight: 500;
}

.json-value {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
}

.json-value-string {
    color: #0d7377;
}

.json-value-number {
    color: #b45309;
}

.json-value-boolean {
    color: #d63384;
    font-weight: 500;
}

.json-value-null {
    color: #6c757d;
    font-style: italic;
}

/* Property and Array Item Styling */
.json-property,
.json-array-item {
    margin: 2px 0;
    padding: 2px 4px;
    border-radius: 3px;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
}

.json-property:hover,
.json-array-item:hover {
    background-color: #f8f9fa;
}

/* Copy Button Styling */
.json-copy-btn {
    opacity: 0;
    transition: opacity 0.2s ease;
    border: none !important;
    margin-left: 8px;
    padding: 2px 6px !important;
    font-size: 10px !important;
    line-height: 1 !important;
    border-radius: 3px !important;
}

.json-property:hover .json-copy-btn,
.json-array-item:hover .json-copy-btn,
.json-primitive:hover .json-copy-btn {
    opacity: 1;
}

.json-copy-btn:hover {
    background-color: #0d6efd !important;
    color: white !important;
}

/* Type Badges */
.json-details .badge {
    font-size: 10px;
    padding: 2px 6px;
    margin-left: 8px;
    font-weight: 400;
}

/* Empty Structure Styling */
.json-empty-object,
.json-empty-array {
    color: #6c757d;
    font-style: italic;
}

/* Search Highlighting */
.json-search-highlight {
    background-color: #fff3cd;
    padding: 1px 2px;
    border-radius: 2px;
    font-weight: 500;
}

.json-search-highlight.active {
    background-color: #ffc107;
    color: #000;
}

/* Responsive adjustments for JSON viewer */
@media (max-width: 768px) {
    .enhanced-json-viewer {
        font-size: 12px;
    }
    
    .json-tree-container {
        padding: 12px;
        max-height: 50vh;
    }
    
    .json-controls {
        padding: 8px;
    }
    
    .json-controls .row {
        flex-direction: column;
    }
    
    .json-controls .col-6 {
        width: 100%;
        margin-bottom: 8px;
    }
    
    .json-controls .col-6:last-child {
        margin-bottom: 0;
    }
    
    .json-copy-btn {
        padding: 4px 8px !important;
        font-size: 12px !important;
    }
    
    .json-details-content {
        margin-left: 8px;
        padding-left: 6px;
    }
}

/* Print styles for JSON viewer */
@media print {
    .json-controls {
        display: none !important;
    }
    
    .json-copy-btn {
        display: none !important;
    }
    
    .json-tree-container {
        border: none;
        max-height: none;
        overflow: visible;
    }
    
    .json-details {
        break-inside: avoid;
    }
}
