/* Chart Container */
.chart-container {
    width: 100%;
    height: 300px;
    margin-top: 2rem;
}

#creationModal .metrics-charts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1rem;
    width: 100%;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.metrics-charts.loading {
    opacity: 0.6;
}

.chart-wrapper {
    position: relative;
    background: var(--card-background);
    border-radius: 0.75rem;
    padding: 1rem;
    margin-bottom: 1rem;
    border: 1px solid rgba(130, 46, 245, 0.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    isolation: isolate; /* Create stacking context */
}

.chart-wrapper.loading::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(22, 22, 29, 0.85);
    backdrop-filter: blur(2px);
    border-radius: 0.75rem;
    z-index: 10;
    transition: all 0.3s ease;
}

.chart-wrapper.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 3px solid rgba(130, 46, 245, 0.2);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
    z-index: 11;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.chart-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: var(--text-color);
}

.chart-title i {
    color: var(--primary-color);
}

.chart-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.chart-zoom-btn,
.chart-reset-zoom,
.chart-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    border: none;
    background: var(--button-background);
    color: var(--text-color);
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chart-zoom-btn:hover,
.chart-reset-zoom:hover,
.chart-toggle-btn:hover {
    background: var(--button-hover-background);
}

.chart-toggle-btn {
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
}

.chart-toggle-btn.active {
    background: var(--primary-color);
    color: white;
}

canvas {
    height: 250px !important;
    background-color: rgba(255, 255, 255, 0.05) !important;
    border-radius: 0.5rem;
    padding: 0.5rem;
}

canvas:active {
    cursor: ns-resize;
}

/* Date Range Controls */
.date-range-controls {
    background: var(--card-background);
    padding: 1rem;
    border-radius: 0.75rem;
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
    border: 1px solid rgba(130, 46, 245, 0.2);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.date-range-presets {
    display: flex;
    gap: 0.5rem;
}

.date-range-preset {
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    background: var(--background-color);
    border: 1px solid var(--text-secondary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    /*font-weight: 500;*/
}

.date-range-preset:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(130, 46, 245, 0.3);
}

.date-range-preset.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(130, 46, 245, 0.5);
}

.date-range-preset:active {
    transform: translateY(0);
}

.date-range-custom {
    display: flex;
    gap: 1rem;
    align-items: center;
    color: var(--text-primary);
}

.date-range-custom label {
/*    display: flex;*/
/*    flex-direction: column;*/
    gap: 0.25rem;
    font-size: 0.9rem;
}

.date-range-custom input {
    padding: 0.5rem;
    color-scheme: dark;
    border: 1px solid var(--text-secondary);
    border-radius: 0.5rem;
    font-family: inherit;
    transition: all 0.3s ease;
    background-color: var(--background-color);
    color: var(--text-primary);
}

.date-range-custom input:hover {
    border-color: var(--primary-color);
}

.date-range-custom input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(130, 46, 245, 0.2);
}

.date-range-custom input.invalid {
    border-color: var(--danger-color);
    animation: shake 0.5s;
}

/* Annotations */
.annotation-indicator {
    position: absolute;
    top: 0;
    width: 2px;
    height: 100%;
    /*background: var(--primary-color);*/
    opacity: 0.5;
    cursor: pointer;
    transition: opacity 0.3s ease;
    z-index: 1;
}

.annotation-indicator:hover {
    opacity: 1;
}

.annotation-popup {
    position: fixed;
    background: white;
    border-radius: 0.5rem;
    padding: 1rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    z-index: 2000;
    min-width: 300px;
    max-width: 400px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: none;
}

.annotation-popup.active {
    display: block;
}

.annotation-form {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.annotation-form textarea {
    width: 100%;
    min-height: 80px;
    padding: 0.5rem;
    border: 1px solid var(--text-secondary);
    border-radius: 0.25rem;
    font-family: inherit;
    resize: vertical;
}

.annotation-form textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.annotation-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    margin-top: 0.5rem;
}

.annotation-btn {
    padding: 0.25rem 0.75rem;
    border-radius: 0.25rem;
    border: none;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.3s ease;
}

.annotation-btn-save {
    background: var(--primary-color);
    color: white;
}

.annotation-btn-save:hover {
    background: var(--secondary-color);
}

.annotation-btn-cancel {
    background: var(--text-secondary);
    color: white;
}

.annotation-btn-cancel:hover {
    background: var(--text-primary);
}

.annotation-btn-delete {
    background: #ef4444;
    color: white;
}

.annotation-btn-delete:hover {
    background: #dc2626;
}

.error-toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: #dc3545;
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    animation: fadeInUp 0.3s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translate(-50%, 1rem);
    }
    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

@keyframes spin {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
} 