/* Graph Monitor 2.0 Styles - Chart.js Implementation */

/* Graph container for Chart.js - matches original design */
.monitor-graph-container-v2 {
    position: relative;
    width: 100%;
    height: 100px;
    padding: 0;
    cursor: pointer;
    transition: background-color 0.2s ease;
    background: white;
}

.monitor-graph-container-v2:hover {
    background-color: rgba(45, 137, 152, 0.02);
}

/* Canvas styling */
.monitor-graph-canvas-v2 {
    width: 100% !important;
    height: 100% !important;
}

/* Graph Monitor 2.0 Modal */
#graphModal2 {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(6px);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

#graphModal2.active {
    opacity: 1;
}

.graph-modal-2-container {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 1200px;
    height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Modal Header */
.graph-modal-2-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2rem;
    border-bottom: 1px solid #e5e7eb;
    background: var(--color-bg-input, #f8f9fa);
    border-radius: 12px 12px 0 0;
}

.graph-modal-2-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--telemetry-color-primary, #2d8998);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.graph-modal-2-close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.graph-modal-2-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.graph-modal-2-close-btn svg {
    width: 20px;
    height: 20px;
    stroke: var(--telemetry-color-text-muted, #7f8c8d);
    stroke-width: 2;
}

/* Modal Body */
.graph-modal-2-body {
    flex: 1;
    overflow: hidden;
    position: relative;
}

.graph-modal-2-canvas-container {
    width: 100%;
    height: 100%;
    position: relative;
}

#graphModal2Canvas {
    width: 100% !important;
    height: 100% !important;
}

/* Modal Info Footer */
.graph-modal-2-info {
    padding: 16px 24px;
    background: #f9fafb;
    border-top: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    border-radius: 0 0 12px 12px;
}

.graph-modal-2-info-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.graph-modal-2-info-label {
    font-size: 11px;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.graph-modal-2-info-value {
    font-size: 14px;
    color: #111827;
    font-weight: 500;
}

/* Loading state */
.graph-modal-2-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    color: #6b7280;
}

.graph-modal-2-loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e5e7eb;
    border-top-color: #2d8998;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Responsive */
@media (max-width: 768px) {
    .graph-modal-2-container {
        width: 95%;
        height: 90vh;
    }

    .graph-modal-2-header {
        padding: 16px;
    }

    .graph-modal-2-body {
        padding: 16px;
    }

    .graph-modal-2-title {
        font-size: 16px;
    }
}

/* ==================== DARK MODE ==================== */
@media (prefers-color-scheme: dark) {
    .monitor-graph-container-v2 {
        background: #111315;
    }

    .monitor-graph-container-v2:hover {
        background-color: rgba(45, 137, 152, 0.08);
    }

    #graphModal2 {
        background: rgba(0, 0, 0, 0.6);
    }

    .graph-modal-2-container {
        background: #1f2937;
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    }

    .graph-modal-2-header {
        border-bottom-color: #374151;
        background: #111827;
    }

    .graph-modal-2-close-btn {
        background: rgba(255, 255, 255, 0.1);
    }

    .graph-modal-2-close-btn:hover {
        background: rgba(255, 255, 255, 0.2);
    }

    .graph-modal-2-close-btn svg {
        stroke: #9ca3af;
    }

    .graph-modal-2-body {
        background: #1f2937;
    }

    .graph-modal-2-canvas-container {
        background: #111315;
    }

    .graph-modal-2-info {
        background: #111827;
        border-top-color: #374151;
    }

    .graph-modal-2-info-label {
        color: #9ca3af;
    }

    .graph-modal-2-info-value {
        color: #f3f4f6;
    }

    .graph-modal-2-loading {
        color: #9ca3af;
    }

    .graph-modal-2-loading-spinner {
        border-color: #374151;
        border-top-color: #2d8998;
    }
}