/* Stock Market Widget Styles */
.stock-widget {
    position: relative;
}

/* Loading indicator */
.stock-loading {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007bff;
    border-radius: 50%;
    animation: stock-spin 1s linear infinite;
    margin-left: 5px;
}

@keyframes stock-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Price update animation */
.stock-updated {
    animation: stock-pulse 0.6s ease-in-out;
}

@keyframes stock-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); color: #007bff; }
    100% { transform: scale(1); }
}

/* Change indicators */
.stock-change {
    font-size: 0.75rem;
    font-weight: 500;
    padding: 2px 6px;
    border-radius: 12px;
    margin-left: 4px;
}

.stock-change.stock-up {
    color: #28a745;
    background-color: rgba(40, 167, 69, 0.1);
}

.stock-change.stock-down {
    color: #dc3545;
    background-color: rgba(220, 53, 69, 0.1);
}

.stock-change.stock-neutral {
    color: #6c757d;
    background-color: rgba(108, 117, 125, 0.1);
}

/* Market status */
.stock-status {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    padding: 1px 4px;
    border-radius: 8px;
    margin-left: 4px;
}

.stock-status-open {
    color: #28a745;
    background-color: rgba(40, 167, 69, 0.1);
}

.stock-status-closed {
    color: #dc3545;
    background-color: rgba(220, 53, 69, 0.1);
}

/* Data status indicator */
.stock-data-status {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    margin-left: 4px;
}

.stock-data-live {
    background-color: #28a745;
    animation: stock-blink 2s infinite;
}

.stock-data-fallback {
    background-color: #ffc107;
}

@keyframes stock-blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0.3; }
}

/* Refresh button */
[data-stock="refresh-btn"] {
    transition: transform 0.2s ease;
}

[data-stock="refresh-btn"]:hover {
    transform: rotate(180deg);
}

[data-stock="refresh-btn"].loading {
    animation: stock-spin 1s linear infinite;
    pointer-events: none;
}

/* Error display */
[data-stock="error"] {
    color: #dc3545;
    font-size: 0.75rem;
    margin-top: 2px;
    display: none;
}

/* Notification styles */
.stock-notification {
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.stock-success {
    background-color: #28a745 !important;
    color: white !important;
}

/* Responsive adjustments */
@media (max-width: 576px) {
    .stock-widget {
        font-size: 0.875rem;
    }

    .stock-change {
        font-size: 0.7rem;
        padding: 1px 4px;
    }

    .stock-status {
        font-size: 0.6rem;
    }
}

/* Tooltip customization for stock info */
.tooltip.stock-tooltip .tooltip-inner {
    background-color: #2c3e50;
    color: white;
    font-size: 0.75rem;
    padding: 6px 10px;
}

.tooltip.stock-tooltip .tooltip-arrow::before {
    border-top-color: #2c3e50;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .stock-change.stock-up {
        background-color: #28a745;
        color: white;
    }

    .stock-change.stock-down {
        background-color: #dc3545;
        color: white;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .stock-updated,
    .stock-loading,
    [data-stock="refresh-btn"].loading,
    .stock-data-live {
        animation: none;
    }

    [data-stock="refresh-btn"] {
        transition: none;
    }
}
