/* static/css/main.css */

/* === 0. VARIABLES & UTILS === */
:root {
    --bg-body: #000000;
    --bg-glass: rgba(12, 12, 14, 0.85);
    --bg-glass-modal: rgba(12, 12, 14, 0.95);
    --accent: #F72D4B; /* Красный */
    --text-main: #FFFFFF;
    --text-muted: rgba(255, 255, 255, 0.6); /* 60% белый */
    --text-dim: rgba(255, 255, 255, 0.3);
    --border-light: rgba(255, 255, 255, 0.1);

    --font-main: 'Inter', sans-serif;
    --font-logo: 'Montserrat', sans-serif;
}

/* ВАЖНО: Скрывает элементы до загрузки Alpine */
[x-cloak] { display: none !important; }

/* Общий класс для центрирования (DRY) */
.flex-center,
.logo-block, .avatar-block, .search-container-wrapper, .search-block-initial,
.gradient-style, .tab-item, .icon-btn, .acc-close-btn, .acc-card-cover-box {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* === 1. GLOBAL & RESET === */
html {
    scroll-behavior: auto;
}

body {
    background-color: var(--bg-body);
    margin: 0; padding: 0;
    font-family: var(--font-main);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
}
body.modal-open { overflow: hidden; overscroll-behavior: none; }
a { text-decoration: none; color: inherit; }
.content-no-pad {
    padding-top: 0 !important;
    width: calc(100% - 40px);
    margin: 0 20px;
    box-sizing: border-box;
}
.drag-scroll-active {
    user-select: none;
}
.hidden { display: none !important; }

/* === 2. HEADER LAYOUT === */
header {
    height: 73px; width: 100%;
    display: flex; justify-content: center;
    position: relative; z-index: 50;
    background: var(--bg-body);
}

.header-grid {
    width: 1319px; max-width: 100%; height: 100%;
    display: grid;
    grid-template-columns: 200px 1fr 200px; /* 200px по краям */
    align-items: center;
    padding: 0; /* Убрали паддинг по твоему запросу */
    box-sizing: border-box;
}

.logo-block, .avatar-block { height: 100%; cursor: pointer; }
.search-container-wrapper { position: relative; z-index: 51; }

/* Elements */
.logo-text {
    font-family: var(--font-logo); font-weight: 900;
    font-size: 22px; color: #E01F3D; letter-spacing: 0.5px;
}
.user-avatar {
    width: 34px; height: 34px; border-radius: 50%;
    object-fit: cover; background-color: #333;
    display: flex; align-items: center; justify-content: center;
    font-weight: bold; color: #fff;
}

/* === 3. SEARCH UI === */
.gradient-style {
    background:
        linear-gradient(#0C0C0E, #0C0C0E) padding-box,
        linear-gradient(to bottom, var(--border-light) 0%, rgba(255, 255, 255, 0) 100%) border-box;
    border: 1px solid transparent; color: white;
}

.search-input-style {
    width: 363px; height: 34px; outline: none;
    font-family: var(--font-main); font-weight: 700; font-size: 14px; text-align: center;
    border-radius: 999px; cursor: pointer; color: white;
}
.search-input-style::placeholder { color: rgba(255, 255, 255, 0.6); letter-spacing: 0.05em; transition: opacity 0.3s ease; }
.search-input-style:focus::placeholder { opacity: 0; }
.side-btn { width: 32px; height: 32px; cursor: pointer; color: var(--accent); margin: 0 5px; border-radius: 50%; }
.side-btn.gradient-style { color: #F72D4B !important; }
.header-side-icon-mask {
    width: 16px;
    height: 16px;
    display: block;
    background-color: #F72D4B;
    -webkit-mask-image: var(--icon-url);
    mask-image: var(--icon-url);
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
    -webkit-mask-size: contain;
    mask-size: contain;
}

/* === 4. MODALS (Search & History) === */
.search-modal-container {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    transition: top 0.3s cubic-bezier(0.25, 1, 0.5, 1);
}
.search-modal-container.mode-history { top: 74px; }
.search-modal-container.mode-results { top: 0px; }

.glass-window {
    background-color: var(--bg-body);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 18px; box-shadow: 0 30px 60px rgba(0,0,0,0.9);
    overflow: hidden; display: flex; flex-direction: column; align-items: center;
    opacity: 0; transform: translateY(-10px);
    transition: opacity 0.2s ease, transform 0.2s ease, background-color 0.8s ease 0.3s;
}
.glass-window.visible {
    opacity: 1; transform: translateY(0);
    background-color: var(--bg-glass); backdrop-filter: blur(20px);
}

/* --- TABS (Refactored) --- */
.window-history { width: 363px; min-height: 447px; padding: 7px; box-sizing: border-box; }

.tabs-container {
    width: 347px; height: 33px;
    background: transparent;
    display: flex; justify-content: space-between;
    margin-bottom: 20px;
}

.tab-item {
    flex: 1;
    font-size: 12px; font-weight: 700;
    cursor: pointer;
    color: var(--text-muted); /* 60% opacity */
    transition: color 0.2s ease;
}

.tab-item.active {
    background: transparent; /* Убрали фон */
    color: var(--text-main); /* 100% white */
    text-shadow: 0 0 10px rgba(255,255,255,0.3); /* Легкое свечение */
}

/* History Rows */
.history-row {
    width: 347px; height: 37px; display: flex; align-items: center;
    margin-bottom: 13px; cursor: pointer; border-radius: 8px;
    transition: background 0.2s; padding: 0 5px; box-sizing: border-box;
}
.history-row:hover { background: rgba(255,255,255,0.05); }
.hist-mini-cover { width: 32px; height: 32px; border-radius: 6px; object-fit: cover; margin-right: 12px; }
.hist-text-block { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.hist-title { font-size: 13px; font-weight: 700; color: white; line-height: 1.1; }
.hist-sub { font-size: 10px; font-weight: 700; color: rgba(255,255,255,0.4); }
.hist-lightning {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.hist-lightning img {
    width: 14px;
    height: 14px;
    display: block;
    opacity: 0.6;
}

/* Results */
.window-results { width: 760px; padding-bottom: 0; position: relative; margin-top: 9px; }
.search-duplicate-container { width: 100%; height: 52px; display: flex; justify-content: center; align-items: center; margin-bottom: 0; padding-top: 0; }
.search-input-internal {
    width: 363px; height: 34px; outline: none;
    font-family: var(--font-main); font-weight: 700; font-size: 14px; text-align: center;
    border-radius: 999px; cursor: pointer;
    background: var(--border-light); border: 1px solid var(--border-light); color: var(--text-muted);
}
.btn-internal {
    width: 32px; height: 32px; border-radius: 50%; margin: 0 6px;
    color: var(--accent); cursor: pointer; background: var(--border-light);
}

.universe-header { width: 100%; height: 75px; display: none; align-items: center; justify-content: center; font-family: var(--font-main); font-weight: 800; font-size: 16px; color: white; text-transform: uppercase; letter-spacing: 0.5px; }
.universe-header.active { display: flex; }

.results-grid { display: grid; grid-template-columns: repeat(3, 227px); gap: 0px; justify-content: center; padding-bottom: 20px; }
.anime-card-res {
    width: 227px;
    min-height: 430px;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 20px;
    position: relative;
    z-index: 0;
    transition: transform 1s ease;
    --meta-highlight-top: 278px;
}
.res-cover { width: 187px; height: 266px; border-radius: 12px; object-fit: cover; transition: transform 0.2s; cursor: pointer; }
.res-cover:hover { transform: scale(1.03); }
.res-title {
    width: min(205px, 100%);
    padding: 0 2px;
    box-sizing: border-box;
    font-weight: 900;
    font-size: 15px;
    color: white;
    margin-top: 18px;
    line-height: 1.25;
    text-align: center;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    min-height: 2.5em;
}
.res-info { width: 187px; font-size: 13px; font-weight: 700; color: rgba(255, 255, 255, 0.6); margin-top: 6px; text-align: center; line-height: 1.2; }
.res-buttons-block { height: 62px; width: 187px; display: flex; align-items: center; justify-content: center; gap: 15px; }
.card-library-label { font-size: 14px; font-weight: 700; color: rgba(255,255,255,1); margin-top: 0; margin-bottom: 20px; text-align: center; width: 100%; }
.icon-btn { color: rgba(255,255,255,0.6); cursor: pointer; transition: 0.2s; width: 24px; height: 24px; display:flex; align-items:center; justify-content:center; }
.icon-btn:hover { color: #fff; }
.icon-btn-img { width: 16px; height: 16px; opacity: 0.6; display:block; transition: opacity 0.15s ease, filter 0.15s ease; }
.icon-btn:hover .icon-btn-img { opacity: 1; }
.icon-btn-link.copied .icon-btn-img { opacity: 1; filter: brightness(0) saturate(100%) invert(91%) sepia(38%) saturate(4271%) hue-rotate(47deg) brightness(107%) contrast(109%); }

.anime-card-res.in-library::before {
    content: '';
    position: absolute;
    top: calc(var(--meta-highlight-top) + 7px);
    right: -3px;
    bottom: -3px;
    left: -3px;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid transparent;
    border-radius: 20px;
    background-clip: padding-box;
    z-index: -1;
    pointer-events: none;
}

/* home page additions */
.home-section { margin: 40px 20px; margin-left: 80px; width: calc(100% - 100px); max-width: none; padding: 10px; box-sizing: border-box; }
.home-title { font-size: 28px; font-weight: 700; margin-bottom: 18px; text-align: left; margin-left: 14px; font-family: 'Inter', sans-serif; }
.moment-grid {
    display: flex;
    gap: 14px;
    padding-bottom: 10px;
    justify-content: center;
    margin: 0 auto;
    max-width: 1270px;
}
.moment-grid > * { flex: 0 0 253px; }
.moment-grid .mv-moment-card-wrap { width: 253px; flex: 0 0 253px; }
.moment-grid .mv-moment-card { width: 253px; height: 151px; border-radius: 13px; overflow: hidden; }
.mv-moment-thumb { width: 100%; height: 151px; object-fit: cover; border-radius: 13px; }
.moment-grid .mv-moment-anime {
    display: block;
    margin-top: 6px;
    font-weight: 700;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.6);
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-decoration: none;
    transition: color 0.2s ease;
}

.moment-grid .mv-moment-anime:hover {
    color: rgba(255, 255, 255, 0.9);
}
.moment-grid .mv-moment-title {
    display: block;
    margin-top: 8px;
    font-weight: 800;
    font-size: 14px;
    color: #fff;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.moment-grid .mv-moment-title-link {
    text-decoration: none;
    cursor: pointer;
}
.playlist-header-line { display:flex; align-items:center; gap:14px; flex-wrap:wrap; }
.playlist-header-cover { width:64px; height:64px; border-radius:12px; object-fit:cover; border:1px solid rgba(255,255,255,0.12); }
.playlist-header-titles { display:flex; flex-direction:column; gap:6px; }

/* горизонтальные подборки */
.content-no-pad .list-content-grid {
    display: flex;
    overflow-x: auto;
    overflow-y: visible;
    padding: 14px;
    cursor: default;
}
.content-no-pad .library-anime-card {
    flex: 0 0 187px;
}

.moment-grid,
.combined-lists-container {
    cursor: default;
}

/* === 5. ACCOUNT & AUTH OVERLAYS === */
.account-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 200;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.account-modal-overlay.open { opacity: 1; }
.account-glass-window {
    width: 900px; height: 600px;
    background: var(--bg-glass-modal); backdrop-filter: blur(25px);
    border: 1px solid var(--border-light); border-radius: 24px;
    box-shadow: 0 40px 80px rgba(0,0,0,0.9);
    display: flex; flex-direction: column; padding: 30px; box-sizing: border-box;
    transform: scale(0.95); transition: transform 0.10s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.account-modal-overlay.open .account-glass-window { transform: scale(1); }

/* Account content */
.acc-header { display: flex; align-items: center; margin-bottom: 30px; }
.acc-avatar-img { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; background: #333; margin-right: 20px; }
.acc-username { font-family: var(--font-main); font-weight: 900; font-size: 24px; color: white; }
.acc-subtitle { font-family: var(--font-main); font-weight: 700; font-size: 14px; color: rgba(255,255,255,0.4); }
.acc-close-btn { margin-left: auto; width: 40px; height: 40px; border-radius: 50%; background: var(--border-light); color: white; cursor: pointer; font-weight: bold; }
.acc-close-btn:hover { background: var(--accent); }

.acc-scroll-area { flex: 1; overflow-y: auto; padding-right: 10px; }
.acc-scroll-area::-webkit-scrollbar { width: 6px; }
.acc-scroll-area::-webkit-scrollbar-track { background: rgba(255,255,255,0.02); }
.acc-scroll-area::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 10px; }
.acc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 20px; }

.acc-card {
    background: rgba(255, 255, 255, 0.03); border-radius: 16px; padding: 10px;
    transition: transform 0.35s ease, filter 0.35s ease, background 0.2s; cursor: pointer; display: flex; flex-direction: column;
}
.acc-card:hover { transform: scale(1.03); animation: universeCardPulse 1s ease-in-out infinite; background: rgba(255, 255, 255, 0.08); }
.acc-card-cover-box { width: 100%; aspect-ratio: 1/1; border-radius: 12px; overflow: hidden; margin-bottom: 12px; background: #1a1a1a; position: relative; }
.acc-card-title { font-family: var(--font-main); font-weight: 800; font-size: 16px; color: white; margin-bottom: 4px; }
.acc-card-count { font-family: var(--font-main); font-weight: 700; font-size: 13px; color: rgba(255,255,255,0.5); }

.collage-grid { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; width: 100%; height: 100%; gap: 2px; }
.collage-img, .playlist-cover-full { width: 100%; height: 100%; object-fit: cover; }

/* Auth */
.auth-tabs { display: flex; width: 100%; margin-bottom: 30px; border-bottom: 1px solid var(--border-light); }
.auth-tab { flex: 1; text-align: center; padding-bottom: 10px; cursor: pointer; font-weight: 700; color: rgba(255,255,255,0.4); transition: 0.2s; }
.auth-tab.active { color: var(--accent); border-bottom: 2px solid var(--accent); }
.auth-input {
    width: 100%; height: 50px; background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-light); border-radius: 12px; margin-bottom: 15px;
    color: white; padding: 0 20px; box-sizing: border-box;
    font-family: var(--font-main); font-size: 14px; outline: none;
}
.auth-input:focus { border-color: var(--accent); }
.auth-btn {
    width: 100%; height: 50px; background: var(--accent); border: none;
    border-radius: 12px; color: white; font-weight: 900; font-size: 16px;
    cursor: pointer; transition: 0.2s; margin-top: 10px;
}
.auth-btn:hover { transform: scale(1.02); box-shadow: 0 10px 20px rgba(247, 45, 75, 0.3); }
.auth-error { color: var(--accent); margin-top: 15px; text-align: center; font-size: 13px; font-weight: bold; min-height: 20px;}

/* === NEW STYLES === */

/* 1. List Info 2 lines — see modals.css for .list-info */

/* 2. Rubber Combined Container */
.combined-lists-container {
    flex-grow: 1;
    display: flex;
    overflow-y: auto; /* Allow internal scroll if needed, or just expand */
    min-height: 0; /* Flexbox fix */
}
/* Ensure parent has height */
.lists-section {
    display: flex;
    flex-direction: column;
    padding: 15px 0 20px 0;
}

/* 3-4. Playlist image, lock, actions — see modals.css */

/* 5. Co-authors in Create Modal */
.create-playlist-window {
    /* Existing styles... */
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.friends-selector-container {
    margin-top: 12px;
    border-top: 1px solid var(--border-light);
    padding-top: 12px;
    max-height: 200px;
    overflow-y: auto;
}

/* 6. Editable Username */
.panel-handle[contenteditable="true"] {
    outline: none;
}
.panel-handle[contenteditable="true"]:focus {
    border-bottom: none;
}
