/* =====================================================
    تصميم صفحة الشورتس العصرية - الأزرار تحت بعضها في اليمين والتمرير مفعل
===================================================== */

.shorts-main-page *,
.shorts-modal-overlay * {
    box-sizing: border-box;
}

.shorts-main-page {
    display: block;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
    box-sizing: border-box;
    font-family: inherit;
}

/* إعلان الترويجي العلوي */
.shorts-top-banner-ad {
    position: relative;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    border: 2px dashed rgba(225, 29, 72, 0.6);
    border-radius: 12px;
    padding: 24px 20px;
    text-align: center;
    font-family: 'Cairo', sans-serif;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.4s ease-in-out;
    overflow: hidden;
    margin-bottom: 28px;
    width: 100%;
}

/* إضافة شريط "مساحة إعلانية" العلوي تلقائياً */
.shorts-top-banner-ad::before {
    content: "مساحة إعلانية مميزة";
    position: absolute;
    top: 0;
    right: 20px;
    background-color: #e11d48;
    color: #fff;
    font-size: 11px;
    padding: 3px 12px;
    border-bottom-left-radius: 6px;
    border-bottom-right-radius: 6px;
    font-weight: 700;
}

.shorts-top-banner-ad {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 700;
    color: #ffffff;
}

.shorts-top-banner-ad span {
    display: inline-block;
    color: #38bdf8;
    font-size: 15px;
    font-weight: 700;
    text-decoration: none;
    transition: color 0.3s ease;
    margin-top: 4px;
}

/* التأثير البصري عند تمرير الماوس */
.shorts-top-banner-ad:hover {
    transform: translateY(-3px);
    border-color: #e11d48;
    box-shadow: 0 8px 25px rgba(225, 29, 72, 0.25);
}

.shorts-top-banner-ad:hover span {
    color: #f43f5e;
    text-decoration: underline;
}

/* تخطيط الشبكة الرئيسي */
.shorts-layout-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    grid-template-areas: "items sidebar";
    gap: 28px;
    align-items: start;
    width: 100%;
    direction: ltr;
}

/* القائمة الجانبية للشورتس */
.shorts-sidebar {
    grid-area: sidebar;
    direction: rtl;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 20px;
    position: sticky;
    top: 24px;
}

.sidebar-widget-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.03);
}

.widget-title {
    font-size: 15px;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 14px;
}

.tags-buttons-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    max-height: 160px;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.tags-buttons-wrapper.show-all-tags {
    max-height: 500px;
}

.tag-btn-item {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    background: #f1f5f9;
    color: #475569;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tag-btn-item:hover {
    background: #e11d48;
    color: #fff;
}

.load-more-btn {
    width: 100%;
    margin-top: 14px;
    padding: 10px;
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    color: #334155;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s;
}

.load-more-btn:hover {
    background: #e2e8f0;
}

.sidebar-ad-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    /* جعل الطول ثلاثة أضعاف الطول الحالي (180px * 3 = 540px) */
    min-height: 540px;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    border: 2px dashed rgba(225, 29, 72, 0.6);
    border-radius: 16px;
    color: #ffffff;
    font-size: 16px;
    font-weight: 700;
    text-align: center;
    padding: 24px 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.4s ease-in-out;
    overflow: hidden;
    margin-bottom: 25px;
    width: 100%;
}

/* شريط "مساحة إعلانية" العلوي */
.sidebar-ad-card::before {
    content: "مساحة إعلانية مميزة";
    position: absolute;
    top: 0;
    right: 20px;
    background-color: #e11d48;
    color: #fff;
    font-size: 11px;
    padding: 3px 12px;
    border-bottom-left-radius: 6px;
    border-bottom-right-radius: 6px;
    font-weight: 700;
}

.sidebar-ad-card span {
    display: inline-block;
    font-size: 15px;
    font-weight: 700;
    color: #38bdf8;
    text-decoration: none;
    transition: color 0.3s ease;
    margin-top: 4px;
}

/* التأثير البصري عند تمرير الماوس */
.sidebar-ad-card:hover {
    transform: translateY(-3px);
    border-color: #e11d48;
    box-shadow: 0 8px 25px rgba(225, 29, 72, 0.25);
}

.sidebar-ad-card:hover span {
    color: #f43f5e;
    text-decoration: underline;
}
/* شبكة عرض الشورتس */
.shorts-items-grid {
    grid-area: items;
    direction: rtl;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-content: start;
    gap: 22px;
    min-width: 0;
}

.short-item-card {
    min-width: 0;
    cursor: pointer;
    background: #ffffff;
    border-radius: 18px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.04);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.short-item-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.1);
}

.short-thumb-box {
    position: relative;
    width: 100%;
    aspect-ratio: 9 / 16;
    overflow: hidden;
    background: #0f172a;
}

.short-thumb-box img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.short-item-card:hover .short-thumb-box img {
    transform: scale(1.05);
}

.short-thumb-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    height: 100%;
    color: #fff;
    background: #1e293b;
    text-align: center;
}

.short-thumb-overlay {
    position: absolute;
    inset: auto 0 0;
    padding: 40px 14px 16px;
    color: #fff;
    background: linear-gradient(transparent, rgba(2, 6, 23, 0.9));
}

.short-card-title {
    font-size: 14px;
    font-weight: 700;
    overflow-wrap: anywhere;
    line-height: 1.5;
}

/* الحالة الفارغة */
.shorts-empty-state {
    grid-column: 1 / -1;
    padding: 60px 20px;
    text-align: center;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
}

.shorts-empty-icon {
    font-size: 32px;
    color: #e11d48;
    margin-bottom: 12px;
}

.shorts-empty-state h3 {
    color: #0f172a;
    font-size: 18px;
    font-weight: 800;
    margin-bottom: 8px;
}

.shorts-empty-state p {
    color: #64748b;
    font-size: 13px;
}

/* =====================================================
    نافذة المشغل المنبثقة (Modal) - ارتفاع كامل للشاشة
===================================================== */

.shorts-modal-overlay {
    display: none;
    position: fixed;
    z-index: 99999;
    inset: 0;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
    padding: 12px;
    background: rgba(2, 6, 23, 0.96);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    animation: fadeInModal 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes fadeInModal {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1); }
}

.shorts-modal-overlay[aria-hidden="true"] {
    display: none !important;
}

.shorts-modal-overlay[aria-hidden="false"] {
    display: flex !important;
}

.shorts-modal-container {
    direction: ltr;
    display: grid;
    grid-template-columns: auto minmax(360px, 440px);
    grid-template-areas: "player details";
    align-items: stretch;
    justify-content: center;
    gap: 24px;
    width: 100%;
    max-width: 980px;
    height: 94vh;
    margin: auto;
}

/* عمود مشغل الفيديو (اليسار) */
.shorts-video-player-box {
    grid-area: player;
    direction: rtl;
    position: relative;
    width: auto;
    height: 100%;
    margin: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.shorts-screen-black {
    position: relative;
    width: auto;
    height: 100%;
    aspect-ratio: 9 / 16;
    overflow: hidden;
    border-radius: 20px;
    background: #000;
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.6);
}

.shorts-screen-black video,
.shorts-screen-black iframe {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
    background: #000;
    object-fit: cover;
}

.shorts-screen-black video[hidden],
.shorts-screen-black iframe[hidden],
.shorts-screen-black [hidden] {
    display: none !important;
}

.shorts-player-error {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 20px;
    color: #fff;
    background: #0f172a;
    text-align: center;
}

.shorts-player-error[hidden] {
    display: none !important;
}

/* =====================================================
    أزرار التنقل العصرية (تحت بعضها في الجانب الأيمن للفيديو)
===================================================== */

.shorts-red-controls {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 10;
}

.shorts-red-controls .shorts-red-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(6px);
    color: #fff;
    font-size: 20px;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* رموز الأسهم للأزرار تحت بعضها */
#nextShortBtn::before {
    content: "∧"; /* سهم لأعلى (التالي) */
    line-height: 1;
}

#prevShortBtn::before {
    content: "∨"; /* سهم لاسفل (السابق) */
    line-height: 1;
}

.shorts-red-controls .shorts-red-btn:hover {
    background: #e11d48;
    border-color: #fda4af;
    transform: scale(1.1);
    box-shadow: 0 10px 25px rgba(225, 29, 72, 0.5);
}

.shorts-red-controls .shorts-red-btn:active {
    transform: scale(0.95);
}

/* =====================================================
    العمود الأيمن: الثلث للبيانات والثلثين للإعلان
===================================================== */

.shorts-modal-sidebar {
    grid-area: details;
    direction: rtl;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 16px;
    width: 100%;
    height: 100%;
    margin: 0;
}

/* بطاقة البيانات (ثلث المساحة العلوي) */
.modal-info-card {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 14px;
    width: 100%;
    flex: 1;
    padding: 20px;
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-radius: 20px;
    background: #ffffff;
    color: #0f172a;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    overflow-y: auto;
}

.modal-home-btn {
    width: 100%;
    min-height: 40px;
    padding: 8px 12px;
    border: 0;
    border-radius: 10px;
    background: #0f172a;
    color: #fff;
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
    flex-shrink: 0;
}

.modal-home-btn:hover {
    background: #e11d48;
    transform: translateY(-1px);
}

.modal-summary-title {
    margin-bottom: 6px;
    font-size: 16px;
    font-weight: 800;
    line-height: 1.5;
    color: #0f172a;
}

#modalSummaryText {
    margin: 0;
    color: #475569;
    font-size: 13px;
    line-height: 1.7;
    overflow-wrap: anywhere;
}

.modal-tags-box {
    min-width: 0;
    padding-top: 10px;
    border-top: 1px solid #f1f5f9;
}

.modal-tags-title {
    margin-bottom: 6px;
    font-size: 12px;
    font-weight: 800;
    color: #0f172a;
}

.modal-tags-btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.modal-tag-btn {
    padding: 4px 10px;
    border: 1px solid #fecdd3;
    border-radius: 999px;
    background: #fff1f2;
    color: #be123c;
    font: inherit;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.modal-tag-btn:hover,
.modal-tag-btn.active {
    background: #e11d48;
    border-color: #e11d48;
    color: #fff;
}

/* مساحة الإعلان (الثلثين السفليين) */
.modal-ad-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 2;
    width: 100%;
    padding: 24px;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    border: 2px dashed rgba(225, 29, 72, 0.6);
    border-radius: 20px;
    color: #ffffff;
    font-size: 16px;
    font-weight: 700;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.4s ease-in-out;
    overflow: hidden;
}

/* شريط "مساحة إعلانية" العلوي */
.modal-ad-card::before {
    content: "مساحة إعلانية مميزة";
    position: absolute;
    top: 0;
    right: 20px;
    background-color: #e11d48;
    color: #fff;
    font-size: 11px;
    padding: 3px 12px;
    border-bottom-left-radius: 6px;
    border-bottom-right-radius: 6px;
    font-weight: 700;
}

.modal-ad-card span {
    display: inline-block;
    font-size: 15px;
    font-weight: 700;
    color: #38bdf8;
    text-decoration: none;
    transition: color 0.3s ease;
    margin-top: 6px;
}

/* التأثير البصري عند تمرير الماوس */
.modal-ad-card:hover {
    transform: translateY(-3px);
    border-color: #e11d48;
    box-shadow: 0 8px 25px rgba(225, 29, 72, 0.25);
}

.modal-ad-card:hover span {
    color: #f43f5e;
    text-decoration: underline;
}
/* =====================================================
    التجاوب مع الشاشات (Responsive Design)
===================================================== */

@media (max-width: 1024px) {
    .shorts-items-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .shorts-layout-grid {
        grid-template-columns: minmax(0, 1fr) 260px;
        gap: 20px;
    }

    .shorts-modal-container {
        grid-template-columns: auto minmax(300px, 360px);
        height: 90vh;
    }
}

@media (max-width: 768px) {
    .shorts-main-page {
        padding: 12px;
    }

    .shorts-layout-grid {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas:
            "sidebar"
            "items";
        gap: 20px;
    }

    .shorts-sidebar {
        position: static;
    }

    .shorts-items-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }

    .shorts-modal-overlay {
        align-items: center;
        padding: 10px;
    }

    .shorts-modal-container {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas:
            "player"
            "details";
        height: auto;
        max-height: 96vh;
        gap: 14px;
        max-width: 420px;
    }

    .shorts-video-player-box,
    .shorts-modal-sidebar {
        width: 100%;
        height: auto;
    }

    .shorts-screen-black {
        height: 56vh;
        min-height: 420px;
    }

    .modal-info-card {
        flex: none;
        max-height: 25vh;
    }

    .modal-ad-card {
        flex: none;
        min-height: 120px;
    }
}

@media (max-width: 420px) {
    .shorts-items-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}