/* ─── MATRIX Gallery Frontend Styles ──────────────────────────────────────── */
/* نفس التصميم الأصلي بالكامل — لا تغيير في المظهر                            */

.matrix-gallery-section {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f5f5;
    line-height: 1.6;
    overflow-x: hidden;
}

.matrix-gallery {
    padding: 30px;
    max-width: 1280px;
    margin: 0 auto;
}

.matrix-group-title {
    font-size: 32px;
    font-weight: 600;
    text-align: center;
    color: #ff6b00;
    margin: 30px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid #ff6b00;
    display: inline-block;
}

/* ── Cards slider ─────────────────────────────────────────────────────────── */
.matrix-groups-slider {
    position: relative;
    margin-bottom: 30px;
    overflow: hidden;
}

.matrix-group-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 100%;
    display: flex;
    justify-content: space-between;
    pointer-events: none;
    z-index: 10;
}

.matrix-group-nav button {
    pointer-events: auto;
    background: rgba(0,0,0,0.7);
    color: white;
    border: 2px solid rgba(255,255,255,0.3);
    font-size: 24px;
    width: 50px;
    height: 50px;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    margin: 0 10px;
}

.matrix-group-nav button:hover {
    background: rgba(0,0,0,0.9);
    border-color: rgba(255,255,255,0.7);
    transform: scale(1.1);
}

.matrix-groups-container {
    display: flex;
    gap: 20px;
    padding: 20px 10px;
    transition: transform 0.5s ease-in-out;
    overflow: visible;
    flex-wrap: nowrap;
    width: max-content;
}

/* ── Event cards ──────────────────────────────────────────────────────────── */
.matrix-group-card {
    position: relative;
    width: 240px;
    min-width: 240px;
    height: 160px;
    border-radius: 12px;
    background-size: cover;
    background-position: center;
    cursor: pointer;
    display: flex;
    align-items: flex-end;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    flex-shrink: 0;
}

.matrix-group-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}

.matrix-label-box {
    width: 100%;
    background: linear-gradient(transparent, rgba(0,0,0,0.8));
    padding: 12px 0;
    text-align: center;
    backdrop-filter: blur(3px);
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
}

.matrix-label-box h3 {
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    padding: 0 10px;
    line-height: 1.3;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    margin: 0;
}

/* ── Image grid ───────────────────────────────────────────────────────────── */
.matrix-image-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: center;
    margin: 40px 0;
    padding: 30px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    animation: matrixFadeIn 0.5s ease-out;
}

@keyframes matrixFadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

.matrix-image-grid img {
    width: 200px;
    height: 140px;
    object-fit: cover;
    border-radius: 8px;
    transition: all 0.3s ease;
    cursor: pointer;
    box-shadow: 0 3px 8px rgba(0,0,0,0.1);
}

.matrix-image-grid img:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.matrix-hidden { display: none !important; }

/* ── Lightbox ─────────────────────────────────────────────────────────────── */
.matrix-lightbox {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.95);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    animation: matrixFadeIn 0.3s ease-out;
}

.matrix-lightbox.active { display: flex; }

.matrix-lightbox-content {
    position: relative;
    max-width: 85%;
    max-height: 85%;
    text-align: center;
}

.matrix-lightbox-img {
    max-height: 85vh;
    max-width: 85vw;
    border-radius: 8px;
    box-shadow: 0 0 30px rgba(0,0,0,0.8);
    animation: matrixZoomIn 0.3s ease-out;
    transition: opacity 0.3s ease;
}

@keyframes matrixZoomIn {
    from { transform: scale(0.9); opacity: 0; }
    to   { transform: scale(1);   opacity: 1; }
}

.matrix-lightbox-close {
    position: fixed;
    top: 30px; right: 30px;
    color: white;
    font-size: 36px;
    cursor: pointer;
    background: rgba(0,0,0,0.5);
    width: 50px; height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10002;
}

.matrix-lightbox-close:hover {
    background: rgba(255,0,0,0.7);
    transform: rotate(90deg);
}

.matrix-lightbox-nav {
    position: fixed;
    top: 50%;
    width: 100%;
    display: flex;
    justify-content: space-between;
    transform: translateY(-50%);
    pointer-events: none;
    z-index: 10001;
}

.matrix-lightbox-nav button {
    pointer-events: auto;
    margin: 0 30px;
    background: rgba(0,0,0,0.7);
    color: white;
    border: 2px solid rgba(255,255,255,0.3);
    font-size: 30px;
    width: 60px; height: 60px;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.matrix-lightbox-nav button:hover {
    background: rgba(0,0,0,0.9);
    border-color: rgba(255,255,255,0.7);
    transform: scale(1.1);
}

.matrix-lightbox-counter {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    font-size: 18px;
    background: rgba(0,0,0,0.7);
    padding: 8px 20px;
    border-radius: 20px;
    z-index: 10001;
}

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .matrix-group-card {
        width: 200px;
        min-width: 200px;
        height: 140px;
    }
    .matrix-label-box h3    { font-size: 14px; }
    .matrix-image-grid img  { width: 150px; height: 100px; }
    .matrix-lightbox-nav button { margin: 0 15px; width: 50px; height: 50px; font-size: 24px; }
    .matrix-lightbox-close  { top: 20px; right: 20px; width: 40px; height: 40px; font-size: 28px; }
    .matrix-group-nav button { width: 40px; height: 40px; font-size: 20px; }
}

@media (max-width: 480px) {
    .matrix-group-card { width: 180px; min-width: 180px; height: 120px; }
    .matrix-group-nav button { width: 35px; height: 35px; font-size: 18px; margin: 0 5px; }
}
