﻿:root {
    --skeleton-bg: color-mix(in srgb, var(--rz-text-color) 12%, transparent);
    --skeleton-bg-strong: color-mix(in srgb, var(--rz-text-color) 18%, transparent);
    --skeleton-shimmer: color-mix(in srgb, var(--rz-base-background-color) 55%, transparent);
    --ease-out: var(--transition-easing, cubic-bezier(0.16, 1, 0.3, 1));
}

.index-page,
.index-page *,
.index-page *::before,
.index-page *::after {
    box-sizing: border-box;
}

.index-page {
    position: relative;
    width: 100%;
    isolation: isolate;
    -webkit-font-smoothing: antialiased;
    overflow-x: clip;
    overflow-y: visible;
    overflow-clip-margin: 24px;
}

    .index-page .dashboard-container {
        position: relative;
        z-index: 1;
        width: 100%;
        max-width: 100%;
        min-width: 0;
        padding-bottom: calc(0.5rem + env(safe-area-inset-bottom));
    }

.myst-card--skeleton,
.shortcut-tile--skeleton {
    pointer-events: none;
    background: var(--rz-base-background-color);
    border: 1px solid var(--rz-base-300);
    position: relative;
    overflow: hidden;
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
    box-shadow: none !important;
}

.skeleton-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 1rem;
    padding: 1rem;
}

.skeleton-icon,
.skeleton-text,
.index-page .skeleton-line {
    position: relative;
    overflow: hidden;
    background: var(--skeleton-bg);
}

.skeleton-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
}

.skeleton-text {
    width: 60%;
    height: 16px;
    border-radius: 4px;
}

.index-page .skeleton-line {
    height: 0.55rem;
    border-radius: 999px;
    background: var(--skeleton-bg-strong);
}

@media (max-width: 991.98px) {
    .skeleton-icon {
        width: 38px;
        height: 38px;
        border-radius: 10px;
    }
}

.skeleton-icon::after,
.skeleton-text::after,
.index-page .skeleton-line::after {
    content: "";
    position: absolute;
    inset: 0;
    transform: translate3d(-100%, 0, 0);
    background: linear-gradient(90deg, transparent, var(--skeleton-shimmer), transparent);
    animation: shimmerSweep 1.5s linear infinite;
}

.index-page .skeleton-line::after {
    animation-duration: 1.3s;
}

@keyframes shimmerSweep {
    to {
        transform: translate3d(100%, 0, 0);
    }
}

.index-page .ticker-skeleton {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    width: 100%;
    padding: 0.15rem 0;
}

.shortcut-grid {
    display: grid;
    grid-template-columns: repeat(var(--grid-cols, 4), minmax(0, 1fr));
    gap: var(--grid-gap, 0.75rem);
    width: 100%;
    content-visibility: auto;
    contain-intrinsic-size: 0 300px;
}

.shortcut-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: var(--tile-padding, 0.75rem 0.4rem);
    background: transparent;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-family: inherit;
    animation: cardUltraFadeIn 0.6s var(--ease-out) backwards;
    animation-delay: calc(var(--stagger, 0) * 0.05s);
    transition: transform 0.2s var(--ease-out);
}

    .shortcut-tile:active {
        transform: translate3d(0, 0, 0) scale(0.97);
    }

    .shortcut-tile:focus-visible {
        outline: 2px solid var(--rz-primary);
        outline-offset: 2px;
    }

@media (hover: hover) and (pointer: fine) {
    .shortcut-tile:hover {
        transform: translate3d(0, -2px, 0);
    }

        /* ✅ will-change حذف شد (همزمان با transform بی‌اثر بود) */
        .shortcut-tile:hover .myst-icon-wrapper {
            transform: perspective(600px) translateZ(0) scale(1.1);
        }

            .shortcut-tile:hover .myst-icon-wrapper::before {
                opacity: calc(var(--myst-highlight-strength, 0.55) + 0.25);
            }

        .shortcut-tile:hover .myst-icon-element {
            transform: translateZ(0) scale(1.15) translateY(-2px);
        }
}

.shortcut-tile__title {
    font-size: var(--tile-title-size, 0.82rem);
    font-weight: 600;
    color: var(--rz-text-color);
    text-align: center;
    line-height: 1.4;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.shortcut-tile__desc {
    font-size: var(--tile-desc-size, 0.7rem);
    color: var(--rz-text-tertiary-color);
    text-align: center;
    line-height: 1.4;
    max-width: 100%;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.shortcut-tile--skeleton {
    cursor: default;
    gap: 0.5rem;
}

    .shortcut-tile--skeleton .shortcut-tile__title,
    .shortcut-tile--skeleton .shortcut-tile__desc {
        background: var(--skeleton-bg);
        border-radius: 999px;
        height: 0.65rem;
        -webkit-line-clamp: unset;
        display: block;
    }

@media (max-width: 519.98px) {
    .shortcut-grid {
        --grid-cols: 2 !important;
        --grid-gap: 0.5rem;
        --tile-padding: 0.6rem 0.3rem;
        --tile-title-size: 0.75rem;
        --tile-desc-size: 0.66rem;
    }
}

@media (min-width: 520px) and (max-width: 819.98px) {
    .shortcut-grid {
        --grid-cols: 3 !important;
        --grid-gap: 0.6rem;
        --tile-padding: 0.65rem 0.35rem;
        --tile-title-size: 0.78rem;
        --tile-desc-size: 0.68rem;
    }
}

@media (min-width: 820px) and (max-width: 991.98px) {
    .shortcut-grid {
        --grid-cols: 3 !important;
        --tile-title-size: 0.8rem;
    }
}

@media (min-width: 992px) and (max-width: 1099.98px) {
    .shortcut-grid {
        --grid-cols: 3 !important;
    }
}

@media (min-width: 1100px) and (max-width: 1399.98px) {
    .shortcut-grid {
        --grid-cols: 4 !important;
    }
}

@media (min-width: 1400px) and (max-width: 1699.98px) {
    .shortcut-grid {
        --grid-cols: 5 !important;
    }
}

@media (min-width: 1700px) {
    .shortcut-grid {
        --grid-cols: 5 !important;
        --grid-gap: 1rem;
    }
}

.index-page .dashboard-container :is(.my-style-card, .rz-card):not(.myst-card--skeleton) {
    animation: cardUltraFadeIn 0.7s var(--ease-out) backwards;
    animation-delay: calc(var(--stagger, 0) * 0.06s);
}

@keyframes cardUltraFadeIn {
    from {
        opacity: 0;
        transform: translate3d(0, 16px, 0) scale(0.98);
    }
}

.index-page .dashboard-container :is(img, video, canvas, svg) {
    max-width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
    border-radius: inherit;
}

.index-page .dashboard-container :is(.rz-row, .rz-col, .rz-column, .my-style-card, .rz-card) {
    min-width: 0;
    max-width: 100%;
}

.index-page .dashboard-container .my-style-card:not(.myst-card),
.index-page .dashboard-container .rz-card:not(.myst-card) {
    overflow: hidden;
    border-radius: inherit;
    background-color: var(--rz-card-background-color) !important;
}

.index-page .news-ticker-container {
    height: 56px;
    overflow: hidden;
    position: relative;
    width: 100%;
    direction: rtl;
    display: flex;
    align-items: center;
    border-radius: inherit;
    contain: layout paint;
    /* ✅ وقتی تیکر خارج از دید است رندر و انیمیشنش متوقف می‌شود */
    content-visibility: auto;
    -webkit-mask-image: linear-gradient(180deg, transparent, #000 14%, #000 86%, transparent);
    mask-image: linear-gradient(180deg, transparent, #000 14%, #000 86%, transparent);
}

.index-page .news-ticker-track {
    display: flex;
    flex-direction: column;
    position: absolute;
    inset: 0 0 auto 0;
    width: 100%;
    animation: scrollUpSmooth 14s linear infinite;
}

.index-page .news-ticker-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.index-page .news-ticker-title {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 0.86rem;
    line-height: 1.5;
    color: var(--rz-text-color);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
}

.index-page .ticker-message {
    width: 100%;
    text-align: center;
    font-size: 0.86rem;
    color: var(--rz-text-tertiary-color);
}

@media (max-width: 767px) {
    .index-page .news-ticker-container {
        height: 60px;
        padding: 0 0.65rem;
    }

    .index-page .news-ticker-item {
        min-height: 38px;
        padding: 6px 0;
    }

    .index-page .news-ticker-title {
        font-size: 0.85rem;
    }
}

@media (min-width: 1700px) {
    .index-page .news-ticker-container {
        height: 62px;
    }

    .index-page .news-ticker-title {
        font-size: 0.92rem;
    }
}

@keyframes scrollUpSmooth {
    to {
        transform: translate3d(0, -50%, 0);
    }
}

/* ✅ انیمیشن بی‌نهایت هالهٔ پس‌زمینه فقط روی دسکتاپ (روی موبایل ثابت می‌ماند) */
@media (min-width: 992px) and (prefers-reduced-motion: no-preference) {
    .index-page .bg-halo-watermark {
        animation: haloDrift 26s ease-in-out infinite alternate;
    }
}

@keyframes haloDrift {
    to {
        transform: translate3d(0, -14px, 0) scale(1.03);
    }
}

.myst-palette-slot-1 {
    --myst-auto: var(--rz-primary);
}

.myst-palette-slot-2 {
    --myst-auto: var(--rz-warning);
}

.myst-palette-slot-3 {
    --myst-auto: var(--rz-success);
}

.myst-palette-slot-4 {
    --myst-auto: color-mix(in srgb, var(--rz-danger) 75%, var(--rz-primary));
}

.myst-palette-slot-5 {
    --myst-auto: var(--rz-info);
}

.myst-palette-slot-6 {
    --myst-auto: var(--rz-danger);
}

.myst-palette-slot-7 {
    --myst-auto: color-mix(in srgb, var(--rz-primary) 60%, var(--rz-danger));
}

.myst-palette-slot-8 {
    --myst-auto: color-mix(in srgb, var(--rz-success) 55%, var(--rz-warning));
}

@media (prefers-reduced-motion: reduce) {
    .index-page .news-ticker-track {
        animation: none;
        position: static;
        transform: none;
    }

    .index-page .news-ticker-container {
        height: auto;
        min-height: 48px;
        -webkit-mask-image: none;
        mask-image: none;
    }

    .index-page .ticker-duplicate {
        display: none;
    }

    .index-page .dashboard-container :is(.my-style-card, .rz-card),
    .index-page .dashboard-container .myst-card,
    .shortcut-tile {
        transition: none !important;
        animation: none !important;
    }

        .shortcut-tile:hover .myst-icon-wrapper,
        .shortcut-tile:hover .myst-icon-element {
            transform: none;
        }

    .index-page .bg-halo-watermark {
        animation: none !important;
    }

    .index-page .skeleton-line::after,
    .skeleton-icon::after,
    .skeleton-text::after {
        display: none;
    }
}

.shortcut-tile--customize {
    border: 1.5px dashed color-mix(in srgb, var(--rz-text-color) 25%, transparent);
    background: color-mix(in srgb, var(--rz-text-color) 3%, transparent);
}

    .shortcut-tile--customize:hover {
        border-color: var(--rz-primary);
    }

/* ✅ استایل چراغ پیام خوانده نشده */
.shortcut-tile {
    position: relative; /* ضروری برای قرارگیری صحیح badge */
}

.unread-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    background-color: var(--rz-danger, #f44336);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    box-shadow: 0 2px 4px rgba(244, 67, 54, 0.4);
    z-index: 10;
    line-height: 1;
    animation: pulse-badge 2s infinite;
}

@keyframes pulse-badge {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(244, 67, 54, 0.7);
    }

    70% {
        transform: scale(1.05);
        box-shadow: 0 0 0 6px rgba(244, 67, 54, 0);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(244, 67, 54, 0);
    }
}

@media (max-width: 519.98px) {
    .unread-badge {
        top: 2px;
        right: 2px;
        min-width: 14px;
        height: 14px;
        font-size: 0.6rem;
    }
}