/* Frontend Styles for Live Prices */

/* Icon base styles */
.elp-change-icon {
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
    line-height: 1;
}

.elp-change-icon .elp-icon-img {
    display: inline-block;
    width: auto;
    height: auto;
    max-width: none;
    transition: transform 0.2s ease;
}

/* Up icon - green */
.elp-change-icon.up .elp-icon-img {
    filter: brightness(0) saturate(100%) invert(58%) sepia(94%) saturate(405%) hue-rotate(86deg) brightness(92%) contrast(92%);
}

/* Down icon - rotated and red */
.elp-change-icon.down .elp-icon-img {
    transform: rotatex(180deg);
    filter: brightness(0) saturate(100%) invert(28%) sepia(96%) saturate(7483%) hue-rotate(356deg) brightness(95%) contrast(87%);
}

/* For PNG images - don't apply color filters */
.elp-change-icon.down .elp-icon-img[src$=".png"] {
    filter: none;
    opacity: 0.8;
}

.elp-change-icon.up .elp-icon-img[src$=".png"] {
    filter: none;
    opacity: 0.8;
}

/* Table layout */
.elp-bricks-table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
}

.elp-bricks-table th {
    text-align: left;
    padding: 12px 10px;
    background: #f5f5f5;
    font-weight: 600;
    border: 1px solid #ddd;
}

.elp-bricks-table td {
    padding: 10px;
    border: 1px solid #ddd;
}

.elp-bricks-table .elp-current-value {
    font-weight: 600;
    white-space: nowrap;
}

.elp-bricks-table .elp-change-up {
    color: #46b450;
}

.elp-bricks-table .elp-change-down {
    color: #dc3232;
}

/* Grid layout */
.elp-bricks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin: 15px 0;
}

.elp-grid-item {
    padding: 15px;
    border: 1px solid #eee;
    border-radius: 4px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.elp-grid-item .elp-field-name {
    margin: 0 0 10px 0;
    font-size: 1.1em;
    font-weight: 600;
}

.elp-grid-item .elp-value {
    font-size: 1.2em;
    font-weight: 600;
    margin: 10px 0;
    display: flex;
    align-items: center;
    gap: 5px;
}

.elp-grid-item .elp-change-up {
    color: #46b450;
    font-size: 0.9em;
}

.elp-grid-item .elp-change-down {
    color: #dc3232;
    font-size: 0.9em;
}

.elp-grid-item .elp-change-percentage {
    margin-top: 5px;
    font-size: 0.9em;
}

/* List layout */
.elp-bricks-list {
    list-style: none;
    padding: 0;
    margin: 15px 0;
}

.elp-bricks-list li {
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px;
}

.elp-bricks-list li:last-child {
    border-bottom: none;
}

.elp-bricks-list .elp-list-name {
    min-width: 120px;
}

.elp-bricks-list .elp-list-value {
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: 600;
}

.elp-bricks-list .elp-list-code {
    color: #999;
    margin-left: 5px;
}

.elp-bricks-list .elp-change-up {
    color: #46b450;
}

.elp-bricks-list .elp-change-down {
    color: #dc3232;
}

/* Change indicators */
.elp-change-up {
    color: #46b450;
}

.elp-change-down {
    color: #dc3232;
}

.elp-no-value {
    color: #999;
    font-style: italic;
}

/* Value text */
.elp-value-text {
    display: inline-block;
}

/* Ticker Styles - Enhanced */
.elp-ticker-wrapper {
    width: 100%;
    overflow: hidden;
    position: relative;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.elp-ticker-track {
    width: 100%;
    overflow: hidden;
    white-space: nowrap;
    position: relative;
    display: flex;
}

.elp-ticker-content {
    display: inline-flex;
    white-space: nowrap;
    will-change: transform;
    backface-visibility: hidden;
    -webkit-font-smoothing: antialiased;
    animation: ticker 15s infinite linear;
}

.elp-ticker-track:hover .elp-ticker-content {
  animation-play-state: paused;
}

@keyframes ticker {
  100% {
    transform: translateX(-100vw); /*try changing this to -100vw*/
  }
}

.ticker-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-right: 2px solid #dee2e6;
    white-space: nowrap;
    font-size: 14px;
    line-height: 1.5;
    transition: background-color 0.2s ease;
}

.ticker-item:hover {
    background-color: rgba(0,0,0,0.02);
}

.ticker-item:last-child {
    border-right: none;
}

.ticker-name {
    font-weight: 600;
    color: #212529;
}

.ticker-value {
    font-weight: 500;
    color: #495057;
}

.ticker-change {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-weight: 500;
    padding: 2px 6px;
    border-radius: 3px;
    background-color: rgba(0,0,0,0.02);
}

.ticker-change.up {
    color: #46b450;
    background-color: rgba(70, 180, 80, 0.05);
}

.ticker-change.down {
    color: #dc3232;
    background-color: rgba(220, 50, 50, 0.05);
}

.ticker-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.ticker-arrow svg,
.ticker-arrow-img {
    width: 14px;
    height: 14px;
    display: block;
    transition: transform 0.2s ease;
}

.ticker-change.up .ticker-arrow svg {
    stroke: #46b450;
}

.ticker-change.down .ticker-arrow svg {
    stroke: #dc3232;
}

/* Image arrow styling */
.ticker-change.up .ticker-arrow-img {
    filter: brightness(0) saturate(100%) invert(58%) sepia(94%) saturate(405%) hue-rotate(86deg) brightness(92%) contrast(92%);
}

.ticker-change.down .ticker-arrow-img {
    transform: rotatex(180deg);
    filter: brightness(0) saturate(100%) invert(28%) sepia(96%) saturate(7483%) hue-rotate(356deg) brightness(95%) contrast(87%);
}

/* Pause on hover */
.elp-ticker-paused .ticker-item {
    animation-play-state: paused;
}

/* Optional gradient overlays for smooth edges */
.elp-ticker-wrapper::before,
.elp-ticker-wrapper::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 50px;
    z-index: 2;
    pointer-events: none;
}

.elp-ticker-wrapper::before {
    left: 0;
    background: linear-gradient(to right, #f8f9fa, transparent);
}

.elp-ticker-wrapper::after {
    right: 0;
    background: linear-gradient(to left, #f8f9fa, transparent);
}

/* Remove gradients if not wanted */
.elp-ticker-wrapper.no-gradients::before,
.elp-ticker-wrapper.no-gradients::after {
    display: none;
}



/* Responsive */
@media (max-width: 768px) {
    .elp-bricks-table {
        display: block;
        overflow-x: auto;
    }
    
    .elp-bricks-grid {
        grid-template-columns: 1fr;
    }
    
    .elp-bricks-list li {
        flex-direction: column;
        align-items: flex-start;
    }

    .ticker-item {
        padding: 8px 16px;
        font-size: 12px;
        gap: 6px;
    }
    
    .ticker-arrow svg,
    .ticker-arrow-img {
        width: 12px;
        height: 12px;
    }
    
    .elp-ticker-wrapper::before,
    .elp-ticker-wrapper::after {
        width: 30px;
    }
}