/* saved-images.css — styles for save image overlay and personal images page */

/* ── Image wrapper ──────────────────────────────────────────────────────────── */
.si-img-wrap {
    position: relative;
    display: inline-block;
    line-height: 0;
}
.si-img-wrap--block {
    display: block;
}

/* ── Save button overlay ────────────────────────────────────────────────────── */
.si-save-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 34px;
    height: 34px;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(6px);
    border: 1.5px solid rgba(255,255,255,0.18);
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity 0.2s, transform 0.2s, background 0.15s;
    z-index: 20;
    pointer-events: none;
}
.si-img-wrap:hover .si-save-btn {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}
.si-save-btn:hover {
    background: rgba(245, 158, 11, 0.9);
}
.si-save-btn--saved {
    background: rgba(245, 158, 11, 0.85);
}
.si-save-btn--saved:hover {
    background: rgba(220, 38, 38, 0.85);
}

/* Saved badge dot */
.si-img-wrap.si-is-saved::after {
    content: '';
    position: absolute;
    bottom: 8px;
    right: 8px;
    width: 9px;
    height: 9px;
    background: #f59e0b;
    border-radius: 50%;
    border: 2px solid #fff;
    z-index: 10;
}

/* ── Delete tooltip ─────────────────────────────────────────────────────────── */
.si-del-tip {
    position: absolute;
    background: #1e293b;
    color: #fff;
    padding: 7px 13px;
    border-radius: 8px;
    font-size: 0.82rem;
    box-shadow: 0 4px 16px rgba(0,0,0,0.22);
    z-index: 180000;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}
.si-del-tip-link { color: #93c5fd; text-decoration: none; }
.si-del-tip-link:hover { text-decoration: underline; }
.si-del-tip-del {
    color: #f87171;
    cursor: pointer;
    font-size: 0.8rem;
    border-left: 1px solid rgba(255,255,255,0.15);
    padding-left: 10px;
}
.si-del-tip-del:hover { text-decoration: underline; }

/* ── Toast notification ─────────────────────────────────────────────────────── */
.si-toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(16px);
    background: #1e293b;
    color: #fff;
    padding: 10px 22px;
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: 0 8px 24px rgba(0,0,0,0.25);
    z-index: 200000;
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    pointer-events: none;
    white-space: nowrap;
}
.si-toast--visible { opacity: 1; transform: translateX(-50%) translateY(0); }
.si-toast--success { background: #16a34a; }
.si-toast--warn    { background: #d97706; }
.si-toast--error   { background: #dc2626; }
.si-toast--info    { background: #1e293b; }

/* ── Collection picker modal ────────────────────────────────────────────────── */
.si-picker {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 190000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.si-picker-inner {
    background: #fff;
    border-radius: 18px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 24px 60px rgba(0,0,0,0.25);
    overflow: hidden;
}
.si-picker-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px 20px;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
}
.si-picker-header strong { flex: 1; font-size: 1rem; }
.si-picker-close {
    background: none;
    border: none;
    color: rgba(255,255,255,0.8);
    cursor: pointer;
    font-size: 1rem;
}
.si-picker-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px 20px 0;
    background: #f8fafc;
}
.si-picker-img {
    max-height: 160px;
    max-width: 100%;
    border-radius: 8px;
    object-fit: contain;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}
.si-picker-label {
    padding: 14px 20px 6px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.si-picker-cols {
    max-height: 180px;
    overflow-y: auto;
    padding: 0 14px;
}
.si-picker-col-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 6px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    color: #334155;
    transition: background 0.12s;
}
.si-picker-col-item:hover { background: #f1f5f9; }
.si-picker-col-item input { accent-color: #f59e0b; width: 16px; height: 16px; cursor: pointer; }
.si-picker-no-cols { padding: 12px 6px; font-size: 0.88rem; color: #94a3b8; }
.si-picker-no-cols a { color: #f59e0b; }
.si-picker-dup {
    margin: 8px 20px 0;
    padding: 8px 12px;
    background: #fef9c3;
    border-radius: 6px;
    font-size: 0.82rem;
    color: #a16207;
}
.si-picker-footer { padding: 16px 20px; }
.si-picker-save-btn {
    width: 100%;
    padding: 11px;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: opacity 0.2s;
}
.si-picker-save-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.si-picker-save-btn:not(:disabled):hover { opacity: 0.9; }

/* ── My Images Page ─────────────────────────────────────────────────────────── */
.si-page-wrap {
    max-width: 960px;
    margin: 40px auto;
    padding: 0 20px 80px;
}
.si-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
}
.si-page-title {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-color, #0f172a);
}

/* ── Layout ─────────────────────────────────────────────────────────────────── */
.si-layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 24px;
    align-items: start;
}
@media (max-width: 640px) {
    .si-layout { grid-template-columns: 1fr; }
}

/* ── Collections sidebar ────────────────────────────────────────────────────── */
.si-collections-panel {
    background: #f8fafc;
    border-radius: 14px;
    padding: 16px;
    border: 1px solid #e2e8f0;
}
.si-collections-title {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: #94a3b8;
    margin-bottom: 12px;
}
.si-collection-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    color: #334155;
    transition: background 0.15s;
    margin-bottom: 2px;
    gap: 8px;
}
.si-collection-item:hover,
.si-collection-item.active { background: #e2e8f0; color: #0f172a; }
.si-collection-item .si-col-name  { flex: 1; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.si-collection-item .si-col-count { font-size: 0.78rem; color: #94a3b8; }
.si-collection-item .si-col-pub   { font-size: 0.72rem; color: #22c55e; }

.si-settings-icon {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 4px;
    border-radius: 4px;
    transition: background 0.15s, color 0.15s;
    opacity: 0;
}
.si-collection-item:hover .si-settings-icon,
.si-collection-item.active .si-settings-icon { opacity: 1; }
.si-settings-icon:hover { background: #cbd5e1; color: #1e293b; }

.si-new-collection-btn {
    width: 100%;
    margin-top: 10px;
    padding: 8px;
    border: 2px dashed #cbd5e1;
    border-radius: 8px;
    background: none;
    cursor: pointer;
    color: #64748b;
    font-size: 0.85rem;
    transition: border-color 0.2s, color 0.2s;
}
.si-new-collection-btn:hover { border-color: #ffffff; color: #ffffff; }

/* ── Images grid ────────────────────────────────────────────────────────────── */
.si-images-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}
@media (max-width: 480px) {
    .si-images-grid { grid-template-columns: repeat(2, 1fr); }
}

.si-image-card {
    background: #fff;
    border-radius: 14px;
    border: 1px solid #e2e8f0;
    overflow: hidden;
    transition: box-shadow 0.2s, transform 0.2s;
}
.si-image-card:hover { box-shadow: 0 8px 28px rgba(0,0,0,0.1); transform: translateY(-2px); }

.si-image-thumb {
    width: 100%;
    aspect-ratio: 4/3;
    object-fit: cover;
    display: block;
    background: #f1f5f9;
    cursor: zoom-in;
}

.si-image-info {
    padding: 12px 14px;
}
.si-image-caption {
    font-size: 0.85rem;
    color: #475569;
    margin-bottom: 8px;
    font-style: italic;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.si-image-source {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-bottom: 10px;
}
.si-image-source a { color: #3b82f6; text-decoration: none; }
.si-image-source a:hover { text-decoration: underline; }

.si-image-actions {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
}
.si-btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px 7px;
    border-radius: 6px;
    color: #94a3b8;
    font-size: 0.85rem;
    transition: background 0.15s, color 0.15s;
}
.si-btn-icon:hover { background: #f1f5f9; color: #0f172a; }
.si-btn-icon.danger:hover { background: #fee2e2; color: #dc2626; }

/* ── Empty state ────────────────────────────────────────────────────────────── */
.si-empty {
    text-align: center;
    padding: 60px 20px;
    color: #94a3b8;
    grid-column: 1/-1;
}
.si-empty i  { font-size: 3rem; margin-bottom: 16px; display: block; }
.si-empty h3 { font-size: 1.1rem; color: #64748b; margin: 0 0 8px; }
.si-empty p  { font-size: 0.9rem; }

/* ── Collection select dropdown ─────────────────────────────────────────────── */
.si-col-select-popup {
    position: absolute;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    padding: 6px;
    min-width: 200px;
    z-index: 50000;
}
.si-col-select-item {
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.88rem;
    color: #334155;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.15s;
}
.si-col-select-item:hover { background: #f1f5f9; }
.si-col-select-item.checked { color: #f59e0b; }

/* ── Public collection page ─────────────────────────────────────────────────── */
.si-public-hero {
    padding: 0 0 20px 0;
    margin-bottom: 24px;
    border-bottom: 1px solid #e2e8f0;
    color: var(--text-color, #0f172a);
}
.si-public-hero h1 { font-size: 1.6rem; margin: 0 0 8px; font-weight: 700; }
.si-public-hero p  { color: #64748b; margin: 0 0 16px; font-size: 0.95rem; }
.si-hero-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 16px; font-size: 0.85rem; color: #64748b; }
.si-hero-meta span { display: flex; align-items: center; gap: 6px; }/* ── Modern Toolbar & Buttons ────────────────────────────────────────────────── */
.si-toolbar {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 24px;
    background: #f8fafc;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    align-items: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.02);
}
.si-toolbar-group {
    display: flex;
    gap: 10px;
    align-items: center;
}
.si-toolbar-divider {
    width: 1px;
    height: 24px;
    background: #cbd5e1;
    margin: 0 4px;
}
.si-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    font-size: 0.88rem;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    border: 1px solid transparent;
}
.si-btn i { font-size: 1.05rem; }

/* Button Variants */
.si-btn-primary {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.25);
}
.si-btn-primary:hover {
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
    transform: translateY(-1px);
}

.si-btn-secondary {
    background: #fff;
    color: #475569;
    border-color: #cbd5e1;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.si-btn-secondary:hover {
    background: #f1f5f9;
    color: #0f172a;
    border-color: #94a3b8;
}

.si-btn-lock {
    background: #fff;
    color: #f59e0b;
    border-color: #fcd34d;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.si-btn-lock:hover {
    background: #fef3c7;
    border-color: #f59e0b;
}

.si-btn-telegram {
    background: #e0f2fe;
    color: #0284c7;
    border-color: #bae6fd;
}
.si-btn-telegram:hover {
    background: #bae6fd;
    color: #0369a1;
}

/* ── View Toggle Mode (List View) ───────────────────────────────────────────── */
.si-images-grid {
    transition: all 0.3s ease;
}
.si-images-grid--list {
    grid-template-columns: 1fr;
}
.si-images-grid--list .si-image-card {
    display: flex;
    flex-direction: row;
    align-items: center;
}
.si-images-grid--list .si-image-thumb {
    width: 240px;
    height: auto;
    aspect-ratio: auto;
}
@media (max-width: 640px) {
    .si-images-grid--list .si-image-thumb { width: 120px; }
    .si-images-grid--list .si-image-card { align-items: stretch; }
}
.si-col-settings-popup {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    min-width: 190px;
}
.si-settings-menu { padding: 6px; display: flex; flex-direction: column; }
.si-settings-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    font-size: 0.85rem;
    color: #334155;
    cursor: pointer;
    border-radius: 6px;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}
.si-settings-item:hover { background: #f1f5f9; }
.si-settings-item i { width: 16px; text-align: center; color: #64748b; }
.si-settings-item-active { color: #16a34a; }
.si-settings-item-active i { color: #16a34a; }
.si-settings-item-active:hover { background: #dcfce7; }
.si-settings-danger { color: #ef4444; }
.si-settings-danger i { color: #ef4444; }
.si-settings-danger:hover { background: #fee2e2; }
.si-settings-separator { height: 1px; background: #e2e8f0; margin: 4px 0; }

/* ── GLightbox Button ────────────────────────────────────────────────────────── */
.si-lb-save-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: #fff;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}
.si-lb-save-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}
.si-lb-save-btn--saved {
    border-color: #f59e0b;
    color: #f59e0b;
}
.si-lb-save-btn i {
    font-size: 1rem;
}

/* Gallery Fixes */
.gallery-slide .si-save-btn {
    right: auto;
    left: 8px; /* Move to top-left to avoid counter on the right */
}
.gallery-slide .si-img-wrap.si-is-saved::after {
    right: auto;
    left: 8px; /* Move to bottom-left to avoid overlap with bottom-right overlays */
}

.gallery-slider-wrapper .si-save-btn {
    right: auto;
    left: 8px;
}

/* Ensure the wrapper fills the parent container in grid/flex galleries */
.feed-gallery .si-img-wrap,
.article-gallery-grid .si-img-wrap,
.article-gallery .si-img-wrap,
.gallery .si-img-wrap,
.gallery-slide .si-img-wrap,
.gallery-slider-wrapper .si-img-wrap {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
}

/* Ensure images inside these wrappers also fill the space correctly */
.feed-gallery .si-img-wrap img,
.article-gallery-grid .si-img-wrap img,
.article-gallery .si-img-wrap img,
.gallery .si-img-wrap img,
.gallery-slide .si-img-wrap img,
.gallery-slider-wrapper .si-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
