/* MK Galerii - Frontend styles */

/* =====================
   GALLERY GRID
   ===================== */
.mk-galerii-wrap { width: 100%; }

.mk-galerii-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 36px;
}

@media (max-width: 1024px) { .mk-galerii-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 680px)  { .mk-galerii-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; } }
@media (max-width: 400px)  { .mk-galerii-grid { grid-template-columns: 1fr; } }

.mk-galerii-card {
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    cursor: pointer;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.mk-galerii-card:hover { transform: translateY(-4px); box-shadow: 0 8px 28px rgba(0,0,0,0.16); }

.mk-card-thumb { position: relative; padding-top: 70%; background: #f1f5f9; overflow: hidden; }
.mk-card-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s ease; }
.mk-galerii-card:hover .mk-card-thumb img { transform: scale(1.06); }

.mk-card-no-thumb { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #94a3b8; }

.mk-card-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0); display: flex; align-items: center; justify-content: center; transition: background 0.3s; }
.mk-galerii-card:hover .mk-card-overlay { background: rgba(0,0,0,0.35); }

.mk-card-open-btn {
    color: #fff; opacity: 0; transform: scale(0.7);
    transition: opacity 0.3s, transform 0.3s;
    background: rgba(110,9,49,0.85); border-radius: 50%;
    width: 56px; height: 56px; display: flex; align-items: center; justify-content: center;
}
.mk-galerii-card:hover .mk-card-open-btn { opacity: 1; transform: scale(1); }

.mk-card-count {
    position: absolute; bottom: 10px; right: 10px;
    background: rgba(0,0,0,0.6); color: #fff; font-size: 12px;
    padding: 3px 10px; border-radius: 20px;
}

.mk-card-info { padding: 14px 16px; }
.mk-card-title { margin: 0; font-size: 15px; font-weight: 600; color: #1e293b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Load more */
.mk-galerii-load-more-wrap { text-align: center; margin-top: 8px; }
.mk-load-more-btn {
    display: inline-flex; align-items: center; gap: 8px;
    background: #6e0931; color: #fff; border: none;
    padding: 13px 32px; border-radius: 50px; font-size: 15px; font-weight: 600;
    cursor: pointer; transition: background 0.2s, transform 0.2s;
    box-shadow: 0 4px 16px rgba(110,9,49,0.25);
}
.mk-load-more-btn:hover { background: #5a0727; transform: translateY(-2px); }
.mk-load-more-btn:disabled { background: #94a3b8; cursor: not-allowed; transform: none; }

/* =====================
   LIGHTBOX
   ===================== */
.mk-lightbox {
    position: fixed; inset: 0;
    z-index: 99999999;
    display: none; align-items: stretch;
}
.mk-lightbox.is-open { display: flex; }

.mk-lightbox-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.92);
    backdrop-filter: blur(6px);
    z-index: 0;
}

.mk-lightbox-container {
    position: relative; display: flex;
    width: 100%; height: 100%; z-index: 1;
}

.mk-desktop-only { display: flex; }
.mk-mobile-only  { display: none; }

/* Sidebar */
.mk-lightbox-sidebar {
    width: 240px; min-width: 240px;
    background: rgba(15,23,42,0.97);
    border-right: 1px solid rgba(255,255,255,0.08);
    display: flex; flex-direction: column;
    transition: transform 0.3s, width 0.3s, min-width 0.3s;
    overflow: hidden; z-index: 10;
}
.mk-lightbox-sidebar.is-hidden { transform: translateX(-100%); width: 0; min-width: 0; }

.mk-sidebar-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px; border-bottom: 1px solid rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.5); font-size: 11px; font-weight: 700;
    letter-spacing: 0.1em; text-transform: uppercase; flex-shrink: 0;
}
.mk-sidebar-toggle { background: none; border: none; color: rgba(255,255,255,0.4); cursor: pointer; font-size: 20px; padding: 0; }
.mk-sidebar-toggle:hover { color: #fff; }

.mk-sidebar-list { overflow-y: auto; flex: 1; padding: 8px; }
.mk-sidebar-list::-webkit-scrollbar { width: 4px; }
.mk-sidebar-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 2px; }

.mk-sidebar-gallery-item {
    display: flex; align-items: center; gap: 10px;
    padding: 8px; border-radius: 8px; cursor: pointer;
    transition: background 0.2s; margin-bottom: 4px;
}
.mk-sidebar-gallery-item:hover, .mk-sidebar-gallery-item.is-active { background: rgba(255,255,255,0.08); }
.mk-sidebar-gallery-item.is-active { border-left: 3px solid #6e0931; padding-left: 5px; }

.mk-sidebar-thumb { width: 44px; height: 36px; border-radius: 5px; object-fit: cover; flex-shrink: 0; }
.mk-sidebar-thumb-placeholder { width: 44px; height: 36px; border-radius: 5px; background: rgba(255,255,255,0.06); flex-shrink: 0; }
.mk-sidebar-name { font-size: 13px; color: rgba(255,255,255,0.75); line-height: 1.3; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

/* Main */
.mk-lightbox-main { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }

.mk-lightbox-topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 16px; flex-shrink: 0;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.mk-lightbox-gallery-title { margin: 0; color: #fff; font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.mk-lightbox-controls { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.mk-lb-btn {
    background: rgba(255,255,255,0.08); border: none; color: rgba(255,255,255,0.7);
    width: 38px; height: 38px; border-radius: 8px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.2s, color 0.2s; flex-shrink: 0;
}
.mk-lb-btn:hover { background: rgba(255,255,255,0.15); color: #fff; }
.mk-lb-close:hover { background: rgba(220,38,38,0.6); }

.mk-lightbox-image-wrap {
    flex: 1; display: flex; align-items: center; justify-content: center;
    position: relative; min-height: 0; padding: 12px 0;
}
.mk-lightbox-img-container {
    position: relative; max-width: calc(100% - 120px); max-height: 100%;
    display: flex; align-items: center; justify-content: center;
}
#mk-lb-img {
    max-width: 100%; max-height: calc(100vh - 200px);
    object-fit: contain; border-radius: 4px;
    user-select: none; pointer-events: none; -webkit-user-drag: none;
    display: block; transition: opacity 0.2s;
}
#mk-lb-img.is-loading { opacity: 0; }

.mk-lb-loader { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; }
.mk-lb-loader.is-visible { display: flex; }
.mk-spinner { width: 36px; height: 36px; border: 3px solid rgba(255,255,255,0.1); border-top-color: rgba(255,255,255,0.7); border-radius: 50%; animation: mk-spin 0.8s linear infinite; }
@keyframes mk-spin { to { transform: rotate(360deg); } }

.mk-lb-nav {
    position: absolute; top: 50%; transform: translateY(-50%);
    background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.7); width: 48px; height: 48px; border-radius: 50%;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: background 0.2s, transform 0.2s; z-index: 2;
}
.mk-lb-prev { left: 12px; }
.mk-lb-next { right: 12px; }
.mk-lb-nav:hover { background: rgba(110,9,49,0.7); color: #fff; transform: translateY(-50%) scale(1.08); }
.mk-lb-nav:disabled { opacity: 0.2; cursor: not-allowed; transform: translateY(-50%); }

.mk-lightbox-info {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 16px; flex-shrink: 0;
    border-top: 1px solid rgba(255,255,255,0.06);
}
.mk-lb-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mk-lb-img-title { color: #fff; font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mk-lb-img-author { color: rgba(255,255,255,0.45); font-size: 12px; }
.mk-lb-img-author:not(:empty)::before { content: '📷 '; }
.mk-lb-counter { color: rgba(255,255,255,0.4); font-size: 13px; flex-shrink: 0; margin-left: 16px; }

.mk-lightbox-thumbs {
    display: flex; gap: 5px; padding: 8px 12px; overflow-x: auto; flex-shrink: 0;
    background: rgba(0,0,0,0.3);
    scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.15) transparent;
}
.mk-lightbox-thumbs::-webkit-scrollbar { height: 3px; }
.mk-lightbox-thumbs::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 2px; }

.mk-lb-thumb-item { flex-shrink: 0; width: 54px; height: 40px; border-radius: 5px; overflow: hidden; cursor: pointer; opacity: 0.5; transition: opacity 0.2s, transform 0.2s; border: 2px solid transparent; }
.mk-lb-thumb-item img { width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.mk-lb-thumb-item:hover { opacity: 0.8; }
.mk-lb-thumb-item.is-active { opacity: 1; border-color: #6e0931; transform: scale(1.05); }

/* Mobile galleries bar */
.mk-mobile-galleries-bar {
    padding: 10px 12px; background: rgba(0,0,0,0.4);
    flex-shrink: 0; border-top: 1px solid rgba(255,255,255,0.08);
}
.mk-mobile-galleries-btn {
    width: 100%; background: #6e0931; color: #fff;
    border: none; padding: 12px 16px; border-radius: 8px;
    font-size: 15px; font-weight: 600; cursor: pointer; text-align: center;
    transition: background 0.2s;
}
.mk-mobile-galleries-btn:hover { background: #5a0727; }

/* =====================
   MOBILE GALLERY LIST VIEW
   ===================== */
.mk-mobile-gallery-list {
    position: absolute; inset: 0;
    background: rgba(10,15,30,0.98);
    display: flex; flex-direction: column;
    z-index: 5;
}

.mk-mobile-list-header {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 14px;
    background: rgba(0,0,0,0.4);
    border-bottom: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
}

.mk-mobile-list-back {
    background: rgba(255,255,255,0.08); border: none;
    color: #fff; padding: 8px 14px; border-radius: 8px;
    font-size: 14px; font-weight: 600; cursor: pointer;
    white-space: nowrap; transition: background 0.2s;
}
.mk-mobile-list-back:hover { background: rgba(255,255,255,0.15); }

.mk-mobile-list-title {
    flex: 1; color: #fff; font-size: 16px; font-weight: 600; text-align: center;
}

.mk-mobile-list-items {
    overflow-y: auto; flex: 1; padding: 12px;
    display: flex; flex-direction: column; gap: 10px;
}
.mk-mobile-list-items::-webkit-scrollbar { width: 4px; }
.mk-mobile-list-items::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 2px; }

.mk-mobile-gallery-item {
    display: flex; align-items: center; gap: 14px;
    padding: 10px 12px; border-radius: 10px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.07);
    cursor: pointer; transition: background 0.2s, border-color 0.2s;
}
.mk-mobile-gallery-item:hover { background: rgba(255,255,255,0.1); }
.mk-mobile-gallery-item.is-active {
    background: rgba(110,9,49,0.25);
    border-color: rgba(110,9,49,0.6);
}

.mk-mobile-gallery-thumb {
    width: 70px; height: 52px; border-radius: 7px;
    object-fit: cover; flex-shrink: 0;
    background: rgba(255,255,255,0.06);
}
.mk-mobile-gallery-thumb.mk-no-thumb { display: flex; align-items: center; justify-content: center; color: rgba(255,255,255,0.2); }

.mk-mobile-gallery-info { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.mk-mobile-gallery-name { color: #fff; font-size: 15px; font-weight: 500; line-height: 1.3; }
.mk-mobile-active-badge { display: inline-block; background: #6e0931; color: #fff; font-size: 11px; padding: 2px 8px; border-radius: 10px; }

.mk-lightbox img { -webkit-user-select: none; user-select: none; }

/* =====================
   MOBILE BREAKPOINT
   ===================== */
@media (max-width: 768px) {
    .mk-desktop-only { display: none !important; }
    .mk-mobile-only  { display: flex !important; }

    .mk-lightbox-topbar.mk-mobile-only { padding: 10px 12px; gap: 10px; }
    .mk-lightbox-gallery-title { font-size: 14px; }

    .mk-lightbox-sidebar { display: none; }

    .mk-lightbox-img-container { max-width: calc(100% - 76px); }
    #mk-lb-img { max-height: calc(100vh - 230px); }

    .mk-lb-nav { width: 36px; height: 36px; }
    .mk-lb-prev { left: 6px; }
    .mk-lb-next { right: 6px; }

    .mk-lightbox-thumbs { padding: 6px 10px; }
    .mk-lb-thumb-item { width: 44px; height: 34px; }
    .mk-lightbox-info { padding: 6px 12px; }
}

/* Fade-in animation */
@keyframes mk-fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}
.mk-galerii-card.mk-animate { animation: mk-fadeInUp 0.35s ease forwards; }
