/**
 * Errand Notice Bar Styles
 */

/* =============================================================================
   Notice Bar Layout
   ============================================================================= */

.errand-notice-bar {
    position: relative;
    z-index: 1000;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    overflow: visible;
    transition: background-color 0.6s ease;
}

/* Scroll behavior styles */
.errand-notice-bar.scroll-responsive {
    position: relative;
    top: 0;
    left: 0;
    right: 0;
    transform: translateY(0);
    transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1), background-color 0.6s ease;
    z-index: 9999;
}

.errand-notice-bar.scroll-hidden {
    transform: translateY(-100%);
}

.errand-notice-bar.scroll-visible {
    transform: translateY(0);
}

/* Override any conflicting styles when closing */
.errand-notice-bar.closing {
    position: relative !important;
    transform: translateY(0) !important;
}

.errand-notice-bar.closing > .notice-container {
    transition: none !important;
}

.errand-notice-bar.closing.scroll-hidden,
.errand-notice-bar.closing.scroll-visible {
    transform: translateY(0) !important;
}

.notice-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    min-height: 40px;
    overflow: visible;
}

.notice-content {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    position: relative;
}

/* =============================================================================
   Notice Carousel Styles
   ============================================================================= */

.notice-carousel {
    position: relative;
    width: 100%;
    height: 24px;
    display: flex;
    justify-content: center;
    align-items: center;
    perspective: 1000px;
}

.notice-flip-container {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
}

/* Notice Items - X-axis rotation */
.notice-item {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    transform-origin: center;
    transition: transform 0.6s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.notice-item.active {
    transform: rotateX(0deg);
    z-index: 2;
}

.notice-item:not(.active) {
    transform: rotateX(-90deg);
    z-index: 1;
}

.notice-item.next {
    transform: rotateX(90deg);
    z-index: 1;
}

/* Notice Content */
.notice-inner {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notice-text {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.notice-icon {
    font-size: 1.1em;
    flex-shrink: 0;
    margin-right: 2px;
}

.notice-content-text {
    flex: 1;
    min-width: 0;
}

.notice-text a {
    color: inherit;
    text-decoration: underline;
    transition: opacity 0.3s ease;
}

.notice-text a:hover {
    opacity: 0.8;
    text-decoration: none;
}

/* =============================================================================
   Notice Indicators
   ============================================================================= */

.notice-indicators {
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.notice-dot {
    width: 6px;
    height: 6px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0;
    outline: none;
}

.notice-dot:hover,
.notice-dot.active {
    background: rgba(255, 255, 255, 0.8);
    transform: scale(1.2);
}

.notice-dot:focus {
    outline: 2px solid rgba(255, 255, 255, 0.6);
    outline-offset: 2px;
}

/* =============================================================================
   Notice Actions
   ============================================================================= */

.notice-actions {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-shrink: 0;
    overflow: visible;
    position: relative;
}

/* Help Center Button */
.help-center-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.1);
    color: inherit;
    text-decoration: none;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    transition: background-color 0.3s ease;
    white-space: nowrap;
}

.help-center-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: inherit;
    text-decoration: none;
}

.help-center-btn:focus {
    outline: 2px solid rgba(255, 255, 255, 0.6);
    outline-offset: 2px;
}

.help-center-btn svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

/* =============================================================================
   Language Switcher
   ============================================================================= */

.language-switcher {
    position: relative;
    display: inline-block;
}

.language-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.1);
    color: inherit;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s ease;
    white-space: nowrap;
    position: relative;
}

.language-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
}

.language-toggle:focus {
    outline: 2px solid rgba(255, 255, 255, 0.6);
    outline-offset: 2px;
}

.language-toggle svg {
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.language-toggle[aria-expanded="true"] .dropdown-arrow {
    transform: rotate(180deg);
}

/* Language Dropdown */
.language-dropdown {
    position: absolute;
    top: calc(100% + 5px);
    right: 0;
    left: -4px;
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 120px;
    max-width: 200px;
    z-index: 999999;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
    pointer-events: auto;
    display: block;
}

/* Show state */
.language-dropdown.show {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0) !important;
}

/* Language Options */
.language-option {
    display: block;
    padding: 10px 15px;
    color: #333 !important;
    text-decoration: none;
    font-size: 13px;
    transition: background-color 0.2s ease;
    border-bottom: 1px solid #f0f0f0;
    white-space: nowrap;
}

.language-option:visited {
    color: #333 !important;
}

.language-option:last-child {
    border-bottom: none;
}

.language-option:hover {
    background: #f8f9fa;
    color: var(--primary-color, #0073aa) !important;
    text-decoration: none;
}

.language-option:focus {
    background: #f8f9fa;
    color: var(--primary-color, #0073aa) !important;
    outline: 2px solid var(--primary-color, #007cba);
    outline-offset: -2px;
}

.language-option.current {
    background: #e3f2fd;
    color: var(--primary-color, #1976d2) !important;
    font-weight: 600;
}

/* =============================================================================
   Close Button
   ============================================================================= */

.notice-close {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background-color 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.notice-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

.notice-close:focus {
    outline: 2px solid rgba(255, 255, 255, 0.6);
    outline-offset: 2px;
}

.notice-close svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* =============================================================================
   Animations
   ============================================================================= */

@keyframes slideInFromTop {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideOutToTop {
    from {
        transform: translateY(0);
        opacity: 1;
    }
    to {
        transform: translateY(-100%);
        opacity: 0;
    }
}

.errand-notice-bar.slide-in {
    animation: slideInFromTop 0.5s ease-out;
}

.errand-notice-bar.slide-out {
    animation: slideOutToTop 0.3s ease-in forwards !important;
    position: relative !important;
    transform: none !important;
}

/* =============================================================================
   Responsive Design
   ============================================================================= */

/* Tablet */
@media (max-width: 1024px) {
    .notice-container {
        gap: 15px;
    }
    
    .notice-actions {
        gap: 12px;
    }
}

/* Mobile */
@media (max-width: 768px) {
    .errand-notice-bar.scroll-responsive {
        position: fixed;
    }
    
    .notice-container {
        flex-direction: column;
        gap: 10px;
        padding: 8px 15px;
    }
    
    .notice-content {
        width: 100%;
        order: 1;
    }
    
    .notice-carousel {
        max-width: none;
    }
    
    .notice-text {
        white-space: normal;
        text-align: center;
        line-height: 1.3;
    }
    
    .notice-actions {
        justify-content: center;
        order: 2;
        gap: 10px;
    }
    
    .help-center-btn,
    .language-toggle {
        font-size: 11px;
        padding: 5px 10px;
    }
    
    .language-dropdown {
        right: 0;
        left: -4px;
        min-width: 140px;
    }
    
    .notice-indicators {
        bottom: -15px;
    }
    
    .notice-dot {
        width: 5px;
        height: 5px;
    }
}

/* Small Mobile */
@media (max-width: 480px) {
    .notice-container {
        padding: 6px 12px;
    }
    
    .notice-text {
        font-size: 13px;
        gap: 6px;
    }
    
    .notice-icon {
        font-size: 1em;
    }
    
    .help-center-btn svg,
    .language-toggle svg {
        width: 12px;
        height: 12px;
    }
    
    .notice-close svg {
        width: 14px;
        height: 14px;
    }
    
    .language-dropdown {
        right: -10px;
        left: -4px;
        min-width: 120px;
    }
}

/* =============================================================================
   Accessibility
   ============================================================================= */

/* High contrast mode support */
@media (prefers-contrast: high) {
    .notice-dot {
        border: 1px solid currentColor;
    }
    
    .help-center-btn,
    .language-toggle,
    .notice-close {
        border: 1px solid rgba(255, 255, 255, 0.3);
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .notice-item,
    .notice-dot,
    .help-center-btn,
    .language-toggle,
    .language-dropdown,
    .errand-notice-bar {
        transition: none;
    }
    
    .errand-notice-bar.slide-in,
    .errand-notice-bar.slide-out {
        animation: none;
    }
}

/* Print styles */
@media print {
    .errand-notice-bar {
        display: none;
    }
}