/* DB-backed gallery panels: shader grid/cards, pagination, profile, notifications. */

/* Shared gallery container (also used by the file-based gallery.js, which still
   carries its own inline styles until its own sweep - inline wins, so unaffected). */
.v2-gallery-db,
.v2-gallery-profile,
.v2-notifications {
    padding: 16px;
    overflow-y: auto;
    height: 100%;
    box-sizing: border-box;
}

.v2-gallery-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.v2-gallery-heading {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.v2-gallery-signin-msg {
    padding: 32px;
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
}

/* Status lines (loading / waiting / empty / error) inside the grid */
.v2-gallery-status {
    color: var(--text-muted);
    font-size: 12px;
    padding: 8px;
    grid-column: 1 / -1;
}

.v2-gallery-status-error {
    color: var(--console-error);
}

/* Sort + filters */
.v2-gallery-sort-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
}

.v2-gallery-sort-label {
    font-size: 11px;
    color: var(--text-muted);
}

.v2-gallery-sort-select {
    min-width: 130px;
}

.v2-gallery-filters-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-bottom: 10px;
}

.v2-gallery-search-input {
    min-width: 220px;
    flex: 1;
    max-width: 340px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 5px 8px;
    font-size: 11px;
}

.v2-gallery-tag-input {
    min-width: 180px;
    max-width: 240px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 5px 8px;
    font-size: 11px;
}

.v2-gallery-category-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}

/* Grid + cards */
.v2-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 12px;
}

.v2-gallery-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 6px 8px;
    border-radius: 6px;
    background: transparent;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
    user-select: none;
}

.v2-gallery-card:hover {
    background: var(--bg-secondary);
    transform: translateY(-1px);
}

/* position: relative so feature badges can overlay the corner without affecting layout */
.v2-gallery-card-thumb {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 94px;
    height: 94px;
    margin-bottom: 6px;
    border-radius: 4px;
    overflow: hidden;
    background: var(--bg-tertiary);
}

.v2-gallery-img-cover {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.v2-gallery-type-icon {
    width: auto;
    vertical-align: middle;
    filter: drop-shadow(0 0 1px rgba(0,0,0,0.7)) drop-shadow(0 0 2px rgba(0,0,0,0.5));
}

.v2-gallery-card-name {
    font-size: 11px;
    color: var(--text-secondary);
    text-align: center;
    word-break: break-word;
    line-height: 1.3;
    max-width: 100%;
}

.v2-gallery-card-author {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Feature badges (JS / AUDIO) overlaid on the thumbnail */
.v2-gallery-badges {
    position: absolute;
    top: 4px;
    right: 4px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    pointer-events: none;
}

.v2-gallery-badge {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.5px;
    padding: 2px 5px;
    border-radius: 3px;
    border: 1px solid rgba(0,0,0,0.4);
    box-shadow: 0 1px 2px rgba(0,0,0,0.4);
    line-height: 1;
}

.v2-gallery-badge-js {
    color: #1a1a1a;
    background: rgba(247, 223, 30, 0.95);
}

.v2-gallery-badge-audio {
    color: #0a1622;
    background: rgba(56, 189, 248, 0.95);
}

/* Pagination */
.v2-gallery-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 12px 0 4px;
    user-select: none;
}

.v2-gallery-page-btn {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 11px;
    cursor: pointer;
    min-width: 28px;
    transition: background 0.15s;
}

.v2-gallery-page-btn:disabled {
    color: var(--text-muted);
    cursor: default;
    opacity: 0.4;
}

.v2-gallery-page-btn:not(:disabled):not(.is-active):hover {
    background: var(--bg-secondary);
}

.v2-gallery-page-btn.is-active {
    background: var(--accent);
    color: #fff;
    font-weight: 700;
    cursor: default;
}

.v2-gallery-ellipsis {
    font-size: 11px;
    color: var(--text-muted);
    padding: 0 2px;
}

.v2-gallery-page-info {
    font-size: 10px;
    color: var(--text-muted);
    margin-left: 10px;
}

/* Profile */
.v2-profile-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 0 16px;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.v2-profile-avatar-wrap {
    width: 56px;
    height: 56px;
    position: relative;
    flex-shrink: 0;
    overflow: visible;
}

.v2-profile-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: var(--text-muted);
    overflow: hidden;
}

.v2-profile-avatar-wrap.is-editable,
.v2-profile-avatar.is-editable {
    cursor: pointer;
}

.v2-profile-name-col {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.v2-profile-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.v2-profile-subtitle {
    font-size: 11px;
    color: var(--text-muted);
}

.v2-profile-about {
    margin-bottom: 10px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-secondary);
}

.v2-profile-about-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.v2-profile-about-text {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
    white-space: pre-wrap;
}

.v2-profile-settings {
    margin-bottom: 12px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-secondary);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.v2-profile-settings-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-primary);
}

.v2-profile-name-input {
    max-width: 320px;
}

.v2-profile-avatar-hint {
    font-size: 11px;
    color: var(--text-muted);
}

.v2-profile-about-input {
    max-width: 720px;
    resize: vertical;
}

.v2-profile-save-btn {
    align-self: flex-start;
}

.v2-profile-avatar-edit {
    position: absolute;
    right: -4px;
    bottom: -4px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    padding: 0;
    min-width: 0;
    font-size: 11px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    color: #fff;
    border: 1px solid rgba(0,0,0,0.35);
    cursor: pointer;
    z-index: 2;
}

.v2-gallery-file-hidden {
    display: none;
}

/* Notifications */
.v2-notif-btn-row {
    display: flex;
    gap: 6px;
}

.v2-notif-action-btn {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 4px 10px;
    font-size: 11px;
    cursor: pointer;
    transition: background 0.15s;
}

.v2-notif-action-btn:hover {
    background: var(--bg-secondary);
}

.v2-notif-empty {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

.v2-notif-item {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.2s;
}

.v2-notif-item.is-read {
    opacity: 0.6;
}

.v2-notif-item:hover {
    background: var(--bg-secondary);
}

.v2-notif-row {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.v2-notif-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.v2-notif-body {
    flex: 1;
    min-width: 0;
}

.v2-notif-text {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.v2-notif-time {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

.v2-notif-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    flex-shrink: 0;
    margin-top: 4px;
}

.v2-notif-user {
    cursor: pointer;
    text-decoration: underline;
    text-decoration-color: var(--text-muted);
}
