/* ============================================
   LIVE PRICE REFRESH UI STYLES
   ============================================ */

/* Refresh Button */
.refresh-prices-btn {
    display: inline-flex;
    /* Visible for all users */
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    vertical-align: middle;
    box-shadow: 0 2px 8px rgba(34, 197, 94, 0.3);
}

/* Hide button in aside/sidebar sections */
.refresh-prices-btn[data-location="aside"] {
    display: none !important;
}

[dir="ltr"] .refresh-prices-btn {
    margin-left: 12px;
}

[dir="rtl"] .refresh-prices-btn {
    margin-right: 12px;
}

.refresh-prices-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.4);
    transform: translateY(-1px);
}

.refresh-prices-btn:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(34, 197, 94, 0.3);
}

.refresh-prices-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: linear-gradient(135deg, #9ca3af 0%, #6b7280 100%);
    box-shadow: 0 2px 8px rgba(107, 114, 128, 0.2);
}

.refresh-icon {
    width: 18px;
    height: 18px;
    stroke: white;
    stroke-width: 2.5;
    fill: none;
    transition: transform 0.3s ease;
}

/* Loading state - rotating icon */
.refresh-prices-btn.loading .refresh-icon {
    animation: rotate 1s linear infinite;
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* Cooldown state */
.refresh-prices-btn.cooldown {
    position: relative;
    overflow: hidden;
}

.refresh-prices-btn.cooldown::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.3) 0%, transparent 100%);
    animation: cooldown-progress 10s linear;
}

@keyframes cooldown-progress {
    from {
        transform: translateY(0);
    }

    to {
        transform: translateY(100%);
    }
}

/* Tooltip */
.refresh-prices-btn[data-tooltip] {
    position: relative;
}

.refresh-prices-btn[data-tooltip]::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) scale(0);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: all 0.2s ease;
    z-index: 1000;
}

.refresh-prices-btn[data-tooltip]::after {
    content: '';
    position: absolute;
    bottom: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%) scale(0);
    border: 6px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.9);
    opacity: 0;
    transition: all 0.2s ease;
    z-index: 1000;
}

.refresh-prices-btn:hover[data-tooltip]::before,
.refresh-prices-btn:hover[data-tooltip]::after {
    opacity: 1;
    transform: translateX(-50%) scale(1);
}

/* ============================================
   SKELETON OVERLAY
   ============================================ */

.price-skeleton-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg,
            rgba(255, 255, 255, 0.95) 0%,
            rgba(240, 240, 240, 0.95) 20%,
            rgba(255, 255, 255, 0.95) 40%,
            rgba(255, 255, 255, 0.95) 100%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: inherit;
    z-index: 10;
    display: none;
    pointer-events: none;
}

.price-skeleton-overlay.active {
    display: block;
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

/* Make price cards position relative for overlay */
.country-card,
.detail-card,
.sidebar-card {
    position: relative;
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================*/
/* Toast Container */
.toast-container {
    position: fixed;
    top: 30px;
    right: 20px;
    z-index: 1000000;
    /* High z-index to appear above header */
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

[dir="ltr"] .toast-container {
    top: 20px;
    right: 20px;
}

[dir="rtl"] .toast-container {
    top: 20px;
    left: 20px;
}

.toast {
    background: white;
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    max-width: 400px;
    pointer-events: auto;
    animation: slideIn 0.3s ease;
    border-left: 4px solid #22c55e;
}

[dir="rtl"] .toast {
    animation: slideInRTL 0.3s ease;
}

[dir="rtl"] .toast {
    border-left: none;
    border-right: 4px solid #22c55e;
}

.toast.error {
    border-left-color: #ef4444;
}

[dir="rtl"] .toast.error {
    border-right-color: #ef4444;
}

.toast.success {
    border-left-color: #22c55e;
}

[dir="rtl"] .toast.success {
    border-right-color: #22c55e;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideInRTL {
    from {
        transform: translateX(-400px);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast.hiding {
    animation: slideOut 0.3s ease forwards;
}

[dir="rtl"] .toast.hiding {
    animation: slideOutRTL 0.3s ease forwards;
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }

    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

@keyframes slideOutRTL {
    from {
        transform: translateX(0);
        opacity: 1;
    }

    to {
        transform: translateX(-400px);
        opacity: 0;
    }
}

.toast-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.toast-icon.success {
    color: #22c55e;
}

.toast-icon.error {
    color: #ef4444;
}

.toast-message {
    flex: 1;
    font-size: 14px;
    line-height: 1.5;
    color: #1f2937;
}

.toast-close {
    width: 20px;
    height: 20px;
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    transition: color 0.2s ease;
    flex-shrink: 0;
}

.toast-close:hover {
    color: #1f2937;
}

/* ============================================
   PRICE UPDATE ANIMATIONS
   ============================================ */

.price-updating {
    animation: priceFlash 0.6s ease;
}

@keyframes priceFlash {

    0%,
    100% {
        background-color: transparent;
    }

    50% {
        background-color: rgba(34, 197, 94, 0.2);
    }
}

.country-card-price,
.detail-card-price,
.sidebar-card-price {
    transition: all 0.3s ease;
}

/* ============================================
   ONBOARDING WALKTHROUGH TOOLTIP
   ============================================ */

.refresh-walkthrough {
    position: absolute;
    top: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    color: white;
    padding: 16px 20px;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    z-index: 10001;
    min-width: 280px;
    max-width: 320px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.refresh-walkthrough.show {
    opacity: 1;
    pointer-events: all;
    animation: walkthroughSlideIn 0.4s ease-out;
}

@keyframes walkthroughSlideIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.refresh-walkthrough::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 8px solid #1e293b;
}

.refresh-walkthrough-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.refresh-walkthrough-title {
    font-size: 15px;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.refresh-walkthrough-icon {
    width: 20px;
    height: 20px;
    color: #22c55e;
}

.refresh-walkthrough-text {
    font-size: 13px;
    line-height: 1.5;
    margin: 0;
    color: #cbd5e1;
}

.refresh-walkthrough-actions {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}

.refresh-walkthrough-btn {
    flex: 1;
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.refresh-walkthrough-btn.primary {
    background: #22c55e;
    color: white;
}

.refresh-walkthrough-btn.primary:hover {
    background: #16a34a;
    transform: translateY(-1px);
}

.refresh-walkthrough-btn.secondary {
    background: transparent;
    color: #94a3b8;
    border: 1px solid #334155;
}

.refresh-walkthrough-btn.secondary:hover {
    background: #1e293b;
    color: white;
}

/* RTL Support */
[dir="rtl"] .refresh-walkthrough {
    left: auto;
    right: 50%;
    transform: translateX(50%);
}

[dir="rtl"] .refresh-walkthrough.show {
    animation: walkthroughSlideInRTL 0.4s ease-out;
}

@keyframes walkthroughSlideInRTL {
    from {
        opacity: 0;
        transform: translateX(50%) translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateX(50%) translateY(0);
    }
}

[dir="rtl"] .refresh-walkthrough::before {
    left: auto;
    right: 50%;
    transform: translateX(50%);
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 768px) {
    .refresh-prices-btn {
        width: 28px;
        height: 28px;
    }

    .refresh-icon {
        width: 16px;
        height: 16px;
    }

    /* Mobile adjustments for walkthrough */
    .refresh-walkthrough {
        min-width: 260px;
        max-width: 90vw;
        padding: 14px 16px;
    }

    .refresh-walkthrough-title {
        font-size: 14px;
    }

    .refresh-walkthrough-text {
        font-size: 12px;
    }

    .refresh-walkthrough-btn {
        padding: 7px 10px;
        font-size: 12px;
    }

    .toast {
        min-width: 280px;
        max-width: calc(100vw - 40px);
    }

    [dir="ltr"] .toast-container {
        right: 10px;
    }

    [dir="rtl"] .toast-container {
        left: 10px;
    }
}

/* Dark mode support (if needed in future) */
@media (prefers-color-scheme: dark) {
    .price-skeleton-overlay {
        background: linear-gradient(90deg,
                rgba(30, 30, 30, 0.95) 0%,
                rgba(50, 50, 50, 0.95) 20%,
                rgba(30, 30, 30, 0.95) 40%,
                rgba(30, 30, 30, 0.95) 100%);
    }
}