/* Основные стили и переменные */
:root {
    --bg-color: #f5f5f7;
    --text-color: #1d1d1f;
    --gray-light: #e5e5ea;
    --gray-dark: #8e8e93;
    --accent: #007aff;
    --mint-green: #00c7b5;
}
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Montserrat', Arial, sans-serif;
}
body {
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
/* =========================================
   ЗАКРЕПЛЕННАЯ ШАПКА
   ========================================= */
.app-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 80px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    z-index: 150;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--gray-light);
    padding: 0 20px;
}
.header-logo-container {
    position: absolute;
    left: 20px;
    display: flex;
    align-items: center;
}
.desktop-logo {
    display: block;
    width: 150px; 
    height: 40px;
    object-fit: contain;
}
.mobile-logo {
    display: none;
    width: 45px; 
    height: 45px;
    object-fit: contain;
}
.header-back-btn {
    display: flex;
    align-items: center;
    font-size: 18px;
    text-decoration: none;
    color: var(--text-color);
    font-weight: 600;
}
.back-icon {
    width: 12px;
    height: 20px;
    margin-right: 10px;
}
.header-center-container {
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    width: 100%;
    max-width: 303px;
}
.main-title {
    font-size: 24px;
    font-weight: 600;
    margin: 0;
    letter-spacing: -0.5px;
}
.mode-notice {
    font-size: 12px;
    color: var(--accent);
}
.desktop-search-wrapper {
    position: absolute;
    right: 0; 
    top: 100%; 
    margin-top: 2px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    width: 100%;
}
.desktop-search-input {
    width: 0;
    opacity: 0;
    border: none;
    border-bottom: 2px solid var(--mint-green);
    background: transparent;
    outline: none;
    font-size: 14px;
    padding: 2px 0;
    transition: width 0.4s ease, opacity 0.4s ease;
}
.desktop-search-input.active {
    width: calc(100% - 32px); 
    opacity: 1;
    margin-right: 5px;
}
.search-icon {
    width: 20px;
    height: 20px;
    cursor: pointer;
    flex-shrink: 0;
}
.search-icon img {
    width: 100%;
    height: 100%;
}
.header-mobile-right { display: none; position: absolute; right: 20px; }
/* Бейдж-ссылка в шапке (ПК) */
.header-badge {
    position: absolute;
    right: 20px;
    display: flex;
    align-items: center;
}
/* Бейдж-ссылка внизу страницы (Мобильная) */
.mobile-badge {
    display: none;
}
.search-results {
    position: absolute;
    top: calc(100% + 30px);
    left: 0;
    width: 100%;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    max-height: 300px;
    overflow-y: auto;
    z-index: 100;
    text-align: left;
}
.search-item {
    padding: 10px 15px;
    border-bottom: 1px solid var(--gray-light);
    cursor: pointer;
    font-size: 14px;
}
.search-item:hover { background: var(--bg-color); }
.mobile-search-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: #fff; z-index: 200; display: flex; flex-direction: column;
}
.ms-header { display: flex; padding: 15px 20px; border-bottom: 1px solid var(--gray-light); align-items: center; gap: 10px; }
.ms-header input { flex: 1; padding: 10px 15px; border: none; background: var(--gray-light); border-radius: 10px; font-size: 16px; outline: none; }
.ms-close-btn { background: none; border: none; color: var(--accent); font-size: 16px; cursor: pointer; }
.ms-results-area { flex: 1; overflow-y: auto; }
/* =========================================
   ОСНОВНОЙ КОНТЕНТ 
   ========================================= */
.content-wrapper { flex: 1; padding: 100px 20px 40px 20px; }
.albums-grid { display: grid; grid-template-columns: repeat(5, 200px); gap: 40px 20px; justify-content: center; max-width: 1200px; margin: 0 auto; }
.album-card { position: relative; width: 100%; text-align: center; }
.album-folder { width: 200px; height: 200px; background-color: var(--gray-light); border-radius: 10px; overflow: hidden; margin: 0 auto 10px auto; position: relative; box-shadow: 0 4px 6px rgba(0,0,0,0.1); }
.album-link { text-decoration: none; color: inherit; display: block; }
.album-title { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.micro-thumbs-grid { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 2px; width: 100%; height: 100%; }
.micro-thumb { background: #d1d1d6; width: 100%; height: 100%; overflow: hidden; }
.micro-thumb img, .cover-image { width: 100%; height: 100%; object-fit: cover; }
.menu-dots { position: absolute; bottom: 25px; right: 5px; width: 30px; height: 30px; background: rgba(255,255,255,0.8); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: bold; cursor: pointer; font-size: 18px; z-index: 10; }
.dropdown-menu { display: none; position: absolute; top: calc(100% - 20px); right: 0; background: #fff; border: 1px solid var(--gray-light); box-shadow: 0 4px 10px rgba(0,0,0,0.1); border-radius: 8px; z-index: 1020; min-width: 170px; text-align: left; }
.dropdown-menu a { display: block; padding: 10px 15px; text-decoration: none; color: var(--text-color); font-size: 14px; }
.dropdown-menu a:hover { background: var(--bg-color); border-radius: 8px; }
.dropdown-menu.active { display: block; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 20px; width: 100%; }
.media-card { position: relative; width: 100%; aspect-ratio: 1 / 1; }
.media-thumb { width: 100%; height: 100%; cursor: pointer; position: relative; border-radius: 8px; overflow: hidden; background: var(--gray-light); box-shadow: 0 2px 5px rgba(0,0,0,0.1); }
.media-thumb img { width: 100%; height: 100%; object-fit: cover; }
.video-indicator { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); color: rgba(255,255,255,0.8); font-size: 40px; text-shadow: 0 0 10px rgba(0,0,0,0.5); pointer-events: none; }
.media-card .menu-dots { bottom: 5px; right: 5px; }
.media-card .dropdown-menu { top: 100%; }
/* =========================================
   LIGHTBOX 
   ========================================= */
.lightbox {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; z-index: 1000; display: flex; flex-direction: column; transition: background-color 0.3s ease;
}
.lightbox.theme-black { background-color: rgba(0, 0, 0, 0.95); }
.lightbox.theme-gray  { background-color: rgba(60, 60, 65, 0.95); }
.lightbox.theme-white { background-color: rgba(255, 255, 255, 0.95); }
.lightbox.theme-white .lb-loader-text { color: #1d1d1f; font-weight: bold; }
.hidden { display: none !important; }
.lb-controls { position: absolute; top: 30px; right: 30px; display: flex; gap: 15px; z-index: 9999; }
.lb-control-group { position: relative; }
.lb-circle-btn { width: 45px; height: 45px; border-radius: 50%; background: rgba(0, 0, 0, 0.5); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 22px; cursor: pointer; backdrop-filter: blur(5px); transition: background 0.3s, transform 0.1s; user-select: none; }
.lb-circle-btn:hover { background: rgba(0, 0, 0, 0.8); transform: scale(1.05); }
.lb-controls .dropdown-menu { top: 100%; right: 0; margin-top: 10px; }
.lb-content { flex: 1; display: flex; align-items: center; justify-content: center; position: relative; width: 100vw; height: 100vh; z-index: 1001; }
#lb-media-container { 
    width: 100vw; height: 100vh; 
    max-width: 100vw; max-height: 100vh; 
    overflow: hidden; display: flex; align-items: center; justify-content: center; position: relative; 
}
#lb-media-container img, #lb-media-container video { 
    max-width: 100vw; max-height: 100vh; 
    object-fit: contain; transition: transform 0.1s ease-out; 
}
.slide-in-right { animation: swipeInRight 0.3s forwards cubic-bezier(0.25, 0.8, 0.25, 1); }
.slide-in-left { animation: swipeInLeft 0.3s forwards cubic-bezier(0.25, 0.8, 0.25, 1); }
@keyframes swipeInRight { from { transform: translateX(100%); opacity: 0.5; } to { transform: translateX(0); opacity: 1; } }
@keyframes swipeInLeft { from { transform: translateX(-100%); opacity: 0.5; } to { transform: translateX(0); opacity: 1; } }
.grab-cursor { cursor: grab; }
.grabbing-cursor { cursor: grabbing; }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(0, 0, 0, 0.3); border: none; color: #fff; font-size: 60px; width: 70px; height: 70px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background 0.3s, transform 0.2s; z-index: 9998; }
.lb-nav.prev { left: 4%; }
.lb-nav.next { right: 4%; padding-left: 5px; }
.lb-nav:hover { background: rgba(0, 0, 0, 0.7); transform: translateY(-50%) scale(1.1); }
.lb-loader { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); text-align: center; color: #fff; width: 200px; z-index: 9999; }
.lb-loader-text { margin-bottom: 10px; font-size: 14px; }
.progress-bar { width: 100%; height: 4px; background: #555; border-radius: 2px; overflow: hidden; }
.progress-fill { height: 100%; width: 0%; background: var(--mint-green); transition: width 0.3s ease; }
.app-footer { text-align: center; padding: 0px 10px 30px 10px; font-family: 'Quicksand', sans-serif; font-size: 14px; color: var(--gray-dark); }
/* =========================================
   АДАПТИВНОСТЬ: СМАРТФОНЫ И ПЛАНШЕТЫ
   ========================================= */
@media (max-width: 1100px) {
    .albums-grid { grid-template-columns: repeat(3, 200px); }
    
    .desktop-logo { display: none !important; }
    .mobile-logo { display: block !important; }
    .desktop-only { display: none !important; } /* Скрываем элементы только для ПК */
    .header-logo-container { left: 15px; }
    .header-back-btn { font-size: 16px; }
    .header-center-container { max-width: 200px; }
    .main-title { font-size: 18px; text-align: center; }
    
    .desktop-search-wrapper { display: none !important; } 
    .header-mobile-right { display: block; } 
    .lb-controls { top: 15px; right: 15px; gap: 10px; }
    .lb-circle-btn { width: 40px; height: 40px; font-size: 18px; }
    
    .lb-nav { display: none !important; }
    /* Показываем мобильный бейдж */
    .mobile-only {
        display: flex !important;
        justify-content: center;
        margin-top: 40px;
        margin-bottom: 10px;
        width: 100%;
    }
}
@media (max-width: 768px) and (orientation: landscape) { .albums-grid { grid-template-columns: repeat(3, 200px); } }
@media (max-width: 500px) {
    .albums-grid { grid-template-columns: repeat(2, 160px); }
    .album-folder { width: 160px !important; height: 160px !important; }
}