/* LEOS Mission Ready - Telemetry Dashboard Styles */
/* Grafana-inspired design with LEOS brand colors */

.telemetry-dashboard-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: #0a0e27;
    color: #e2e8f0;
    overflow: hidden;
}

/* Dashboard Header */
.dashboard-header {
    height: 60px;
    background: rgba(15, 23, 42, 0.95);
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    flex-shrink: 0;
}

.dashboard-selector {
    display: flex;
    align-items: center;
    gap: 12px;
}

.dashboard-dropdown {
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(148, 163, 184, 0.2);
    color: #e2e8f0;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 14px;
    min-width: 250px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.dashboard-dropdown:hover {
    border-color: rgba(0, 212, 255, 0.3);
    background: rgba(30, 41, 59, 0.9);
}

.dashboard-dropdown:focus {
    outline: none;
    border-color: #00d4ff;
    box-shadow: 0 0 0 2px rgba(0, 212, 255, 0.2);
}

.dashboard-dropdown optgroup {
    color: #94a3b8;
    font-weight: 600;
}

.dashboard-controls {
    display: flex;
    align-items: center;
    gap: 24px;
}

.time-range-selector {
    display: flex;
    align-items: center;
    gap: 8px;
}

.time-dropdown {
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(148, 163, 184, 0.2);
    color: #e2e8f0;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
}

.dashboard-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dashboard-btn {
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(148, 163, 184, 0.2);
    color: #e2e8f0;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.dashboard-btn:hover {
    background: rgba(0, 153, 255, 0.2);
    border-color: rgba(0, 153, 255, 0.3);
    color: #00d4ff;
}

.dashboard-btn.active {
    background: rgba(0, 153, 255, 0.3);
    border-color: #00d4ff;
    color: #00d4ff;
}

.new-dashboard {
    background: rgba(16, 185, 129, 0.2);
    border-color: rgba(16, 185, 129, 0.3);
    color: #10b981;
}

.new-dashboard:hover {
    background: rgba(16, 185, 129, 0.3);
    border-color: #10b981;
}

/* Dashboard Workspace */
.dashboard-workspace {
    flex: 1;
    display: flex;
    overflow: hidden;
    position: relative;
}

.dashboard-grid {
    flex: 1;
    padding: 16px;
    overflow: auto;
    display: grid;
    grid-template-columns: repeat(24, 1fr);
    grid-auto-rows: 40px;
    gap: 16px;
    align-content: start;
}

/* Dashboard Widgets */
.dashboard-widget {
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    transition: all 0.3s ease;
}

.dashboard-widget:hover {
    border-color: rgba(0, 212, 255, 0.3);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.dashboard-widget.dragging {
    opacity: 0.5;
    cursor: move;
}

.widget-header {
    background: rgba(30, 41, 59, 0.6);
    padding: 12px 16px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.widget-title {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #e2e8f0;
}

.widget-controls {
    display: flex;
    gap: 4px;
}

.widget-btn {
    background: transparent;
    border: none;
    padding: 4px;
    cursor: pointer;
    font-size: 14px;
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

.widget-btn:hover {
    opacity: 1;
}

.widget-content {
    flex: 1;
    padding: 16px;
    overflow: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Widget Resize Handle */
.widget-resize-handle {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 20px;
    height: 20px;
    cursor: nwse-resize;
    background: linear-gradient(135deg, transparent 50%, rgba(148, 163, 184, 0.3) 50%);
}

/* Widget Types */
.stat-widget {
    text-align: center;
}

.stat-value {
    font-size: 48px;
    font-weight: 700;
    color: #00d4ff;
    line-height: 1;
    margin-bottom: 8px;
}

.stat-unit {
    font-size: 14px;
    color: #94a3b8;
    margin-bottom: 8px;
}

.stat-trend {
    font-size: 14px;
    color: #10b981;
    font-weight: 500;
}

.widget-chart,
.widget-gauge {
    width: 100%;
    height: 100%;
}

.widget-table {
    width: 100%;
    font-size: 13px;
}

.widget-map {
    width: 100%;
    height: 100%;
    background: rgba(0, 153, 255, 0.1);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
}

.widget-placeholder {
    font-size: 48px;
    opacity: 0.3;
}

/* Widget Panel (Edit Mode) */
.widget-panel {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 300px;
    background: rgba(15, 23, 42, 0.98);
    border-left: 1px solid rgba(148, 163, 184, 0.2);
    padding: 24px;
    overflow-y: auto;
    z-index: 100;
}

.widget-panel h3 {
    margin: 0 0 20px 0;
    font-size: 18px;
    font-weight: 600;
    color: #e2e8f0;
}

.widget-types {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.widget-type-card {
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 8px;
    padding: 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.widget-type-card:hover {
    background: rgba(0, 153, 255, 0.2);
    border-color: rgba(0, 153, 255, 0.3);
    transform: translateY(-2px);
}

.widget-icon {
    display: block;
    font-size: 32px;
    margin-bottom: 8px;
}

.widget-name {
    font-size: 13px;
    color: #e2e8f0;
    font-weight: 500;
}

/* Dashboard Info */
.dashboard-info {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: #64748b;
    font-size: 16px;
    max-width: 500px;
    padding: 40px;
}

/* Grid Overlay (Edit Mode) */
.dashboard-grid.edit-mode {
    background-image: 
        linear-gradient(rgba(148, 163, 184, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(148, 163, 184, 0.05) 1px, transparent 1px);
    background-size: 40px 40px;
}

/* Fullscreen Mode */
.telemetry-dashboard-container:fullscreen {
    background: #0a0e27;
}

.telemetry-dashboard-container:fullscreen .dashboard-header {
    background: rgba(15, 23, 42, 0.98);
}

/* Responsive Design */
@media (max-width: 1200px) {
    .dashboard-grid {
        grid-template-columns: repeat(12, 1fr);
    }
    
    .widget-panel {
        width: 250px;
    }
}

@media (max-width: 768px) {
    .dashboard-header {
        flex-wrap: wrap;
        height: auto;
        padding: 12px;
    }
    
    .dashboard-selector,
    .dashboard-controls {
        width: 100%;
    }
    
    .dashboard-controls {
        margin-top: 12px;
        justify-content: space-between;
    }
    
    .dashboard-grid {
        grid-template-columns: repeat(6, 1fr);
        padding: 12px;
        gap: 12px;
    }
    
    .widget-panel {
        width: 100%;
        position: fixed;
        bottom: 0;
        top: auto;
        height: 50vh;
        border-left: none;
        border-top: 1px solid rgba(148, 163, 184, 0.2);
    }
}

/* Widget Configuration Modal */
.widget-config-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(15, 23, 42, 0.98);
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-radius: 12px;
    padding: 24px;
    min-width: 400px;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.widget-config-modal h3 {
    margin: 0 0 20px 0;
    font-size: 20px;
    font-weight: 600;
    color: #e2e8f0;
}

.config-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 13px;
    color: #94a3b8;
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(148, 163, 184, 0.2);
    color: #e2e8f0;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 14px;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #00d4ff;
    box-shadow: 0 0 0 2px rgba(0, 212, 255, 0.2);
}

/* Table Widget Styles */
.widget-table-container {
    width: 100%;
    height: 100%;
    overflow: auto;
}

.widget-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.widget-table th {
    background: rgba(30, 41, 59, 0.6);
    color: #94a3b8;
    font-weight: 600;
    text-align: left;
    padding: 12px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
    position: sticky;
    top: 0;
    z-index: 10;
}

.widget-table td {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
    color: #e2e8f0;
}

.widget-table tr:hover {
    background: rgba(0, 153, 255, 0.05);
}

.widget-table .status-good {
    color: #10b981;
}

.widget-table .status-warning {
    color: #fbbf24;
}

.widget-table .status-error {
    color: #ef4444;
}

/* Alert Widget Styles */
.alert-list {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.alert-filters {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.alert-filter {
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(148, 163, 184, 0.2);
    color: #94a3b8;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.alert-filter:hover {
    background: rgba(30, 41, 59, 0.8);
    color: #e2e8f0;
}

.alert-filter.active {
    background: rgba(0, 153, 255, 0.2);
    border-color: rgba(0, 153, 255, 0.3);
    color: #00d4ff;
}

.alert-items {
    flex: 1;
    overflow-y: auto;
}

.alert-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 8px;
    background: rgba(30, 41, 59, 0.3);
    border: 1px solid rgba(148, 163, 184, 0.1);
    transition: all 0.2s ease;
}

.alert-item:hover {
    background: rgba(30, 41, 59, 0.5);
    border-color: rgba(148, 163, 184, 0.2);
}

.alert-critical {
    border-left: 3px solid #ef4444;
}

.alert-warning {
    border-left: 3px solid #fbbf24;
}

.alert-info {
    border-left: 3px solid #00d4ff;
}

.alert-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.alert-content {
    flex: 1;
}

.alert-message {
    color: #e2e8f0;
    font-size: 13px;
    margin-bottom: 4px;
}

.alert-meta {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #64748b;
}

.alert-satellite {
    font-weight: 500;
    color: #94a3b8;
}

/* Stat Widget Enhanced */
.stat-widget {
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.stat-label {
    font-size: 13px;
    color: #64748b;
    margin-top: 8px;
    font-weight: 500;
}

/* Animations */
@keyframes widgetSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dashboard-widget {
    animation: widgetSlideIn 0.3s ease;
}

/* Loading States */
.widget-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #64748b;
}

.widget-loading::after {
    content: '';
    width: 32px;
    height: 32px;
    border: 3px solid rgba(0, 212, 255, 0.2);
    border-top-color: #00d4ff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}