/**
 * News Flash Frontend Styles
 */

/* Container Styles */
.bcp-news-flash-carousel {
    position: relative;
    z-index: 9999;
    background: #ffffff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

/* Position Variants */
.bcp-news-flash-carousel.news-flash-position-top {
    margin-bottom: 20px;
}

.bcp-news-flash-carousel.news-flash-position-bottom {
    margin-top: 20px;
}

.bcp-news-flash-carousel.news-flash-position-fixed-top {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    margin: 0;
    z-index: 10000;
}

.bcp-news-flash-carousel.news-flash-position-fixed-bottom {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    margin: 0;
    z-index: 10000;
}

/* Add body padding for fixed positions */
body.has-fixed-top-news-flash {
    padding-top: 60px;
}

body.has-fixed-bottom-news-flash {
    padding-bottom: 60px;
}

/* Animation Styles */
.bcp-news-flash-carousel.news-flash-animation-slide {
    animation: slideDown 0.5s ease-out;
}

.bcp-news-flash-carousel.news-flash-animation-fade {
    animation: fadeIn 0.5s ease-out;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Container */
.news-flash-container {
    position: relative;
    overflow: hidden;
    min-height: 60px;
}

/* Wrapper for carousel */
.news-flash-wrapper {
    display: flex;
    transition: transform 0.5s ease;
    will-change: transform;
}

/* Animation: Slide */
.animation-slide .news-flash-wrapper {
    transform: translateX(0);
}

/* Animation: Fade */
.animation-fade .news-flash-item {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.animation-fade .news-flash-item.active {
    opacity: 1;
}

/* Animation: Scroll */
.animation-scroll .news-flash-wrapper {
    animation: scroll-news 20s linear infinite;
}

@keyframes scroll-news {
    0% {
        transform: translateX(100%);
    }
    100% {
        transform: translateX(-100%);
    }
}

/* Individual News Flash Item */
.news-flash-item {
    flex: 0 0 100%;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    min-height: 60px;
}

.news-flash-content {
    display: flex;
    align-items: center;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

/* Icon */
.news-flash-icon {
    font-size: 24px;
    margin-right: 15px;
    flex-shrink: 0;
}

/* Message */
.news-flash-message {
    flex: 1;
    font-size: 15px;
    line-height: 1.6;
}

.news-flash-message p {
    margin: 0;
    display: inline;
}

/* Link */
.news-flash-link {
    display: inline-block;
    margin-left: 10px;
    padding: 2px 10px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s ease;
}

.news-flash-link:hover {
    background: rgba(0, 0, 0, 0.2);
}

/* Dismiss Button */
.news-flash-dismiss {
    background: none;
    border: none;
    padding: 5px;
    margin-left: 15px;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s ease;
    flex-shrink: 0;
}

.news-flash-dismiss:hover {
    opacity: 1;
}

.news-flash-dismiss .dashicons {
    font-size: 20px;
}

/* Type-specific Styles */
.news-flash-info {
    background: #e6f3ff;
    color: #0073aa;
}

.news-flash-info .news-flash-icon {
    color: #0073aa;
}

.news-flash-info .news-flash-link {
    color: #0073aa;
}

.news-flash-warning {
    background: #fff8e5;
    color: #826200;
}

.news-flash-warning .news-flash-icon {
    color: #ffb900;
}

.news-flash-warning .news-flash-link {
    color: #826200;
}

.news-flash-alert {
    background: #ffeaea;
    color: #aa0000;
}

.news-flash-alert .news-flash-icon {
    color: #dc3232;
}

.news-flash-alert .news-flash-link {
    color: #aa0000;
}

.news-flash-success {
    background: #e9f7ef;
    color: #008a20;
}

.news-flash-success .news-flash-icon {
    color: #46b450;
}

.news-flash-success .news-flash-link {
    color: #008a20;
}

.news-flash-promotion {
    background: #f3effc;
    color: #5a3e8b;
}

.news-flash-promotion .news-flash-icon {
    color: #826eb4;
}

.news-flash-promotion .news-flash-link {
    color: #5a3e8b;
}

.news-flash-maintenance {
    background: #ffefe7;
    color: #8a4f00;
}

.news-flash-maintenance .news-flash-icon {
    color: #f56e28;
}

.news-flash-maintenance .news-flash-link {
    color: #8a4f00;
}

/* Controls */
.news-flash-controls {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 10;
}

.news-flash-prev,
.news-flash-next {
    background: rgba(0, 0, 0, 0.5);
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #ffffff;
}

.news-flash-prev:hover,
.news-flash-next:hover {
    background: rgba(0, 0, 0, 0.7);
}

.news-flash-prev .dashicons,
.news-flash-next .dashicons {
    font-size: 16px;
}

/* Indicators */
.news-flash-indicators {
    display: flex;
    gap: 5px;
}

.news-flash-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
}

.news-flash-indicator.active {
    background: rgba(0, 0, 0, 0.7);
    width: 24px;
    border-radius: 4px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .news-flash-item {
        padding: 12px 15px;
    }
    
    .news-flash-icon {
        font-size: 20px;
        margin-right: 10px;
    }
    
    .news-flash-message {
        font-size: 14px;
    }
    
    .news-flash-link {
        display: block;
        margin: 8px 0 0 0;
        text-align: center;
    }
    
    .news-flash-controls {
        bottom: 5px;
    }
    
    .news-flash-prev,
    .news-flash-next {
        width: 25px;
        height: 25px;
    }
    
    /* Mobile behavior: Stack */
    .mobile-stack .news-flash-wrapper {
        flex-direction: column;
    }
    
    .mobile-stack .news-flash-item {
        flex: 0 0 auto;
        border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    }
    
    .mobile-stack .news-flash-item:last-child {
        border-bottom: none;
    }
    
    .mobile-stack .news-flash-controls {
        display: none;
    }
}

/* Accessibility */
.news-flash-dismiss:focus,
.news-flash-prev:focus,
.news-flash-next:focus,
.news-flash-indicator:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .bcp-news-flash-carousel {
        border: 2px solid;
    }
    
    .news-flash-link {
        text-decoration: underline;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .news-flash-wrapper,
    .news-flash-item,
    .news-flash-dismiss,
    .news-flash-prev,
    .news-flash-next,
    .news-flash-indicator {
        transition: none !important;
    }
    
    .animation-scroll .news-flash-wrapper {
        animation: none !important;
    }
}

/* Print Styles */
@media print {
    .bcp-news-flash-carousel {
        display: none !important;
    }
}