/* admin_panel/avatars/avatar_editor.css */
:root {
    --text-dark: #1c1c1e;
    --text-secondary: #6c757d;
    --background-light: #f0f2f5; 
    --card-background: #ffffff;
    --border-color: #e5e5ea;
    --primary-blue: #007aff;
    --primary-green: #34c759;
    --primary-red: #ff3b30;
    --primary-orange: #ff9500;
    --woman-color: #ff8fa3;
    --man-color: #5390d9;
    --pet-color: #70e000;
    --status-active-bg: #dcfce7; 
    --status-active-text: #166534; 
    --status-hidden-bg: #f3f4f6; 
    --status-hidden-text: #4b5563; 
    --theme-red: #FF4D4D; 
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    display: flex; flex-direction: column; min-height: 100vh;
    background: var(--background-light); color: var(--text-dark);
}
main {
    flex: 1; padding: 1rem; max-width: 1400px; margin: 0 auto; width: 100%;
}
/* Header overrides */
body #header-placeholder { position: static; }
body header { 
    position: static !important; background: var(--background-light) !important; 
    border-bottom: 1px solid var(--border-color); padding: 0.75rem 1rem;
}
body #header-placeholder .header-logo {
    filter: none !important; 
    height: 56px !important;
}
body #header-placeholder .burger-btn { color: var(--text-dark); }

/* Page Title */
.title-container {
    display: flex; align-items: flex-start; justify-content: space-between;
    margin-bottom: 2.5rem;
}
.main-title {
    font-size: 2.5rem;
    font-weight: 800;
    text-transform: uppercase;
    line-height: 1;
    text-align: left;
}
.main-title span { display: block; }

.back-link {
    width: 40px; height: 40px;
    background: white; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    text-decoration: none; color: var(--text-dark);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.back-link svg { width: 24px; height: 24px; }

/* Control Cards */
.controls-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}
.control-card {
    background: var(--card-background);
    border-radius: 26px;
    padding: 1.5rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}
.control-card-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
}

.upload-avatar-form, .add-tag-form { display: flex; flex-direction: column; gap: 1rem; }
.add-tag-form { flex-direction: row; }

.form-group select, .form-group .file-input-label, .add-tag-form input {
    width: 100%; padding: 0.8rem 1rem; border-radius: 26px;
    border: 1px solid var(--border-color); font-size: 1rem; background: var(--background-light);
}
.file-input-label { cursor: pointer; display: block; text-align: center; color: var(--text-secondary); }
.file-input-label.has-file { color: var(--text-dark); background: #e9f5e9; border-color: var(--primary-green); }
#avatar-file-input { display: none; }

.btn {
    padding: 0.8rem 1.2rem; border: none; border-radius: 26px; cursor: pointer;
    font-size: 1rem; font-weight: 600; transition: all 0.2s;
}
.btn-add, .btn-upload { background: var(--primary-blue); color: white; }

/* Tag List */
.tags-list { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }
.tag-item { 
    background: #e5e5ea; 
    color: var(--text-dark); 
    padding: 0.4rem 0.8rem; 
    border-radius: 26px; 
    font-size: 0.9rem; 
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}
.delete-tag-btn {
    background: rgba(0,0,0,0.1);
    border: none;
    cursor: pointer;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background-color 0.2s;
}
.delete-tag-btn:hover { background-color: var(--primary-red); }
.delete-tag-btn img { width: 10px; height: 10px; display: block; }
.delete-tag-btn:hover img { filter: brightness(0) invert(1); }

/* Tabs Navigation */
.gender-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}
.gender-tab {
    padding: 0.75rem 1rem;
    border: none;
    border-bottom: 3px solid transparent;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    background-color: transparent;
    color: var(--text-secondary);
    transition: all 0.2s ease-in-out;
}
.gender-tab.active { color: var(--text-dark); }
.gender-tab[data-gender="woman"].active { border-color: var(--woman-color); }
.gender-tab[data-gender="man"].active { border-color: var(--man-color); }
.gender-tab[data-gender="pet"].active { border-color: var(--pet-color); }

/* --- CLASS TABS (Wrapped style) --- */
.class-tabs {
    display: flex;
    flex-wrap: wrap; /* No scroll, allow wrap */
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    padding-bottom: 5px;
}
.class-tab {
    padding: 0.5rem 1.25rem;
    border-radius: 50px;
    background: #ffffff;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.03);
}
.class-tab.active {
    background: var(--text-dark);
    color: white;
    border-color: var(--text-dark);
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

/* --- GALLERY HEADER INFO (Price UI) --- */
.gallery-header-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding: 0 0.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}
.section-title-group { display: flex; align-items: center; gap: 8px; }
.section-title { font-size: 1.3rem; font-weight: 800; color: var(--text-dark); }
.section-count { color: var(--text-secondary); font-size: 0.9rem; font-weight: 500; }

.section-price-group {
    display: flex;
    align-items: center;
    gap: 12px;
    background: white;
    padding: 8px 16px;
    border-radius: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    border: 1px solid var(--border-color);
}
.section-price-group label {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
}
.category-price-input {
    width: 70px;
    border: none;
    background: var(--background-light);
    padding: 6px 10px;
    border-radius: 10px;
    font-weight: 800;
    text-align: center;
    font-size: 1rem;
    color: var(--text-dark);
}
.category-price-input:focus { outline: none; box-shadow: 0 0 0 2px var(--primary-blue); }

.btn-save-price {
    background-color: var(--theme-red);
    color: white;
    min-width: 50px;
    padding: 6px 12px;
    font-size: 0.85rem;
    border-radius: 10px;
}

/* --- TAG FILTER CLOUD --- */
.gallery-tag-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 2rem;
    padding: 0 0.5rem;
}
.filter-tag-chip {
    padding: 6px 14px;
    border-radius: 20px;
    background: #ffffff;
    border: 1px solid var(--border-color);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 6px rgba(0,0,0,0.02);
}
.filter-tag-chip:hover { border-color: var(--theme-red); color: var(--theme-red); }
.filter-tag-chip.active {
    background: var(--theme-red);
    color: white;
    border-color: var(--theme-red);
    box-shadow: 0 4px 12px rgba(255, 77, 77, 0.3);
}

/* --- AVATAR GRID --- */
.avatar-grid {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: repeat(2, 1fr); 
}
@media (min-width: 768px) {
    .avatar-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 1200px) {
    .avatar-grid { grid-template-columns: repeat(4, 1fr); }
}

/* --- SKELETON LOADING --- */
.avatar-card.is-loading .skeleton-shimmer {
    display: block;
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(90deg, #f0f0f0 25%, #f8f8f8 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.avatar-card.is-loading .avatar-card-info,
.avatar-card.is-loading .avatar-creation-date {
    visibility: hidden;
}

/* --- AVATAR CARD --- */
.avatar-card {
    position: relative;
    background: var(--card-background);
    border-radius: 26px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 300px;
    transition: opacity 0.3s ease;
}

.avatar-card-img-container {
    width: 100%;
    padding-top: calc(100% * 16 / 9);
    position: relative;
    background-color: #eee;
}
.avatar-card img, .avatar-card video { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; }
.avatar-creation-date { font-size: 0.8rem; color: var(--text-secondary); padding: 0.5rem 1rem 0 1rem; }

.delete-avatar-btn-image {
    position: absolute; 
    top: 12px; 
    right: 12px; 
    background: rgba(0, 0, 0, 0.4); 
    border: none; 
    border-radius: 50% !important; 
    width: 32px !important; 
    height: 32px !important; 
    cursor: pointer; 
    display: flex !important; 
    align-items: center !important; 
    justify-content: center !important; 
    color: white; 
    z-index: 10;
    padding: 0 !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
    backdrop-filter: blur(2px);
}
.delete-avatar-btn-image svg { width: 16px; height: 16px; }

.avatar-card-info { padding: 1rem; display: flex; flex-direction: column; align-items: flex-start; gap: 0.75rem; }
.status-control { width: 100%; display: flex; align-items: center; justify-content: space-between; }
.status-text { font-weight: 600; font-size: 0.85rem; height: 38px; padding: 0 12px; border-radius: 19px; display: flex; align-items: center; }
.status-text.active { background-color: var(--status-active-bg); color: var(--status-active-text); }
.status-text.hidden { background-color: var(--status-hidden-bg); color: var(--status-hidden-text); }

.avatar-name-input { width: 100%; padding: 0.6rem; border: 1px solid var(--border-color); border-radius: 12px; font-size: 0.95rem; font-weight: 600; background: var(--background-light); }
.tag-select { width: 100%; padding: 0.6rem; border-radius: 12px; border: 1px solid var(--border-color); background: var(--background-light); }

.avatar-tags-display { display: flex; flex-wrap: wrap; gap: 0.4rem; width: 100%; min-height: 24px; }
.avatar-tag { background: var(--primary-blue); color: white; padding: 0.2rem 0.6rem; border-radius: 10px; font-size: 0.75rem; display: flex; align-items: center; gap: 4px; }
.remove-tag-btn { background: none; border: none; color: inherit; cursor: pointer; opacity: 0.7; font-size: 1.1rem; line-height: 1; }

.ae-visibility-toggle-btn-v2024 {
    width: 38px; height: 38px; border-radius: 50%; border: none; background: white; cursor: pointer; box-shadow: 0 2px 4px rgba(0,0,0,0.1); display: flex; align-items: center; justify-content: center;
}
.ae-visibility-toggle-btn-v2024::before {
    content: ''; width: 20px; height: 20px; background-color: #1c1c1e; -webkit-mask-size: contain; mask-size: contain; -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
}
.ae-visibility-toggle-btn-v2024[data-current-status="active"]::before { -webkit-mask-image: url(../../components/svg/svg_ui/hide.svg); }
.ae-visibility-toggle-btn-v2024[data-current-status="hidden"]::before { -webkit-mask-image: url(../../components/svg/svg_ui/visible.svg); }

.ae-avatar-badge-v2024 {
    position: absolute; background: rgba(0,0,0,0.6); color: white; padding: 4px 8px; font-size: 0.7rem; font-weight: 500; border-radius: 999px; display: flex; align-items: center; gap: 4px;
}
.ae-user-count-badge-v2024 { bottom: 10px; left: 12px; }

.avatar-file-meta-v2024 { display: flex; gap: 6px; margin-top: 0.25rem; width: 100%; }
.ae-meta-badge-v2024 { padding: 2px 6px; border-radius: 6px; font-size: 0.65rem; font-weight: 700; color: white; text-transform: uppercase; }

.ae-meta-badge-v2024.format-jpg, .ae-meta-badge-v2024.format-jpeg { background-color: var(--primary-blue); }
.ae-meta-badge-v2024.format-png { background-color: var(--primary-green); }
.ae-meta-badge-v2024.format-webp { background-color: #af52de; }
.ae-meta-badge-v2024.format-gif { background-color: #f59e0b; }
.ae-meta-badge-v2024.format-video { background-color: var(--primary-orange) !important; }
.ae-meta-badge-v2024.size-badge { background-color: #e5e5ea; color: var(--text-secondary); }

#status-message {
    position: fixed;
    bottom: -100px;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.8rem 1.5rem;
    border-radius: 50px;
    color: white;
    font-weight: 600;
    font-size: 0.95rem;
    z-index: 10000;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    pointer-events: none;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    backdrop-filter: blur(10px);
}
#status-message.success { background-color: rgba(52, 199, 89, 0.95); }
#status-message.error { background-color: rgba(255, 59, 48, 0.95); }
#status-message.visible { opacity: 1; bottom: 40px; }