/* ===================================================================
   GALERIE FOTO – CTLN.EU
   =================================================================== */

/* ── Reset ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
    background: #0d0d0d;
    color: #efefef;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-weight: 300;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Protecție globală */
img {
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    user-select: none;
    -webkit-user-select: none;
}

/* ── Header ────────────────────────────────────────────────────── */
.site-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    padding: 2rem 2.5rem 1.75rem;
    border-bottom: 1px solid #1e1e1e;
}

.site-header h1 {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: clamp(1.4rem, 3vw, 2rem);
    font-weight: 400;
    letter-spacing: 0.04em;
    color: #f5f5f5;
}

.photo-count {
    font-size: 0.75rem;
    color: #555;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

/* ── Gallery main ──────────────────────────────────────────────── */
main {
    padding: 1.25rem;
}

/* ── Masonry grid ──────────────────────────────────────────────── */
.masonry-grid {
    column-count: 4;
    column-gap: 6px;
}

@media (max-width: 1200px) { .masonry-grid { column-count: 3; } }
@media (max-width: 768px)  { .masonry-grid { column-count: 2; } main { padding: 0.6rem; } }
@media (max-width: 420px)  { .masonry-grid { column-count: 1; } }

/* ── Gallery item ──────────────────────────────────────────────── */
.gallery-item {
    break-inside: avoid;
    position: relative;
    overflow: hidden;
    border-radius: 3px;
    background: #181818;
    margin-bottom: 6px;
    cursor: pointer;
}

@media (max-width: 768px) { .gallery-item { margin-bottom: 4px; } }

.gallery-item img {
    width: 100%;
    height: auto;
    display: block;
    pointer-events: none;   /* imaginea nu e clickabilă direct */
    transition: transform 0.45s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                filter 0.45s ease;
    will-change: transform;
}

/* Overlay transparent captureaza click-ul si blocheaza right-click */
.item-overlay {
    position: absolute;
    inset: 0;
    z-index: 5;
    background: rgba(0, 0, 0, 0);
    transition: background 0.3s ease;
}

.gallery-item:hover .item-overlay {
    background: rgba(0, 0, 0, 0.15);
}

.gallery-item:hover img {
    transform: scale(1.04);
}

/* ── Empty state ───────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 8rem 2rem;
    color: #444;
    font-size: 1rem;
    letter-spacing: 0.05em;
}

/* ── Lightbox ──────────────────────────────────────────────────── */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.28s ease, visibility 0.28s ease;
}

.lightbox.active {
    opacity: 1;
    visibility: visible;
}

.lb-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.97);
    cursor: pointer;
}

.lb-content {
    position: relative;
    z-index: 10;
}

.lb-img-wrap {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lb-img-wrap img {
    max-width: 90vw;
    max-height: 88vh;
    object-fit: contain;
    display: block;
    pointer-events: none;
    border-radius: 2px;
    transition: opacity 0.22s ease;
}

/* Overlay pe imaginea din lightbox – blochează right-click și drag */
.lb-protect {
    position: absolute;
    inset: 0;
    z-index: 20;
    cursor: default;
}

.lb-loader {
    position: absolute;
    inset: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lb-loader.hidden { display: none; }

.spinner {
    width: 34px;
    height: 34px;
    border: 2px solid rgba(255, 255, 255, 0.12);
    border-top-color: rgba(255, 255, 255, 0.65);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Buttons */
.lb-btn {
    position: fixed;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    z-index: 9100;
    line-height: 1;
    transition: color 0.2s ease, transform 0.2s ease;
    font-family: inherit;
}

.lb-btn:hover { color: #fff; }

.lb-close {
    top: 1.2rem;
    right: 1.6rem;
    font-size: 2rem;
    padding: 0.4rem;
}

.lb-prev,
.lb-next {
    top: 50%;
    transform: translateY(-50%);
    font-size: 3.5rem;
    padding: 0.5rem 1.2rem;
}

.lb-prev { left: 0.5rem; }
.lb-next { right: 0.5rem; }

.lb-prev:hover { transform: translateY(-50%) translateX(-4px); }
.lb-next:hover { transform: translateY(-50%) translateX(4px); }

@media (max-width: 600px) {
    .lb-prev, .lb-next { font-size: 2.5rem; padding: 0.4rem 0.75rem; }
}

.lb-counter {
    position: fixed;
    bottom: 1.4rem;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.8rem;
    letter-spacing: 0.12em;
    z-index: 9100;
    pointer-events: none;
}

/* ===================================================================
   ADMIN PANEL
   =================================================================== */

.admin-body {
    background: #0a0a0a;
    color: #ddd;
}

/* ── Admin header ──────────────────────────────────────────────── */
.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.1rem 2rem;
    background: #111;
    border-bottom: 1px solid #1e1e1e;
    position: sticky;
    top: 0;
    z-index: 100;
}

.admin-header h1 {
    font-size: 1rem;
    font-weight: 400;
    color: #eee;
    letter-spacing: 0.02em;
}

.admin-nav a {
    color: #666;
    text-decoration: none;
    font-size: 0.82rem;
    margin-left: 1.5rem;
    transition: color 0.2s;
}

.admin-nav a:hover { color: #eee; }

/* ── Login ─────────────────────────────────────────────────────── */
.login-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
}

.login-box {
    background: #141414;
    border: 1px solid #202020;
    border-radius: 10px;
    padding: 2.75rem 2.5rem;
    width: 100%;
    max-width: 380px;
}

.login-box h2 {
    font-family: 'Playfair Display', serif;
    font-size: 1.55rem;
    font-weight: 400;
    color: #f0f0f0;
    text-align: center;
    margin-bottom: 0.35rem;
}

.login-sub {
    text-align: center;
    color: #555;
    font-size: 0.82rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 2rem;
}

/* ── Admin main ────────────────────────────────────────────────── */
.admin-main {
    max-width: 1440px;
    margin: 0 auto;
    padding: 2rem;
}

/* ── Alerts ────────────────────────────────────────────────────── */
.alert {
    padding: 0.85rem 1.1rem;
    border-radius: 6px;
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.alert-error {
    background: rgba(160, 30, 30, 0.2);
    border: 1px solid rgba(160, 30, 30, 0.4);
    color: #f09090;
}

.alert-success {
    background: rgba(30, 120, 60, 0.2);
    border: 1px solid rgba(30, 120, 60, 0.4);
    color: #80d0a0;
}

/* ── Forms ─────────────────────────────────────────────────────── */
.form-group { margin-bottom: 1.2rem; }

.form-group label {
    display: block;
    font-size: 0.73rem;
    color: #777;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 0.45rem;
}

.form-group input[type="text"],
.form-group input[type="password"] {
    width: 100%;
    background: #0d0d0d;
    border: 1px solid #252525;
    border-radius: 5px;
    color: #eee;
    font-size: 0.95rem;
    font-family: inherit;
    padding: 0.75rem 1rem;
    outline: none;
    transition: border-color 0.2s;
}

.form-group input:focus { border-color: #3a3a3a; }

/* ── Buttons ───────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    background: #efefef;
    color: #0a0a0a;
    border: none;
    border-radius: 5px;
    padding: 0.75rem 1.6rem;
    font-size: 0.88rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s;
}

.btn:hover { background: #d5d5d5; }

.btn-full { width: 100%; justify-content: center; margin-top: 0.5rem; }

.btn-ghost {
    background: transparent;
    color: #666;
    border: 1px solid #2a2a2a;
}

.btn-ghost:hover { background: #1a1a1a; color: #aaa; }

/* ── Admin section ─────────────────────────────────────────────── */
.admin-section {
    background: #101010;
    border: 1px solid #1c1c1c;
    border-radius: 8px;
    padding: 1.75rem;
    margin-bottom: 1.75rem;
}

.admin-section h2 {
    font-size: 0.72rem;
    font-weight: 500;
    color: #666;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin-bottom: 1.25rem;
}

/* ── Upload area ───────────────────────────────────────────────── */
.upload-area {
    border: 2px dashed #252525;
    border-radius: 7px;
    padding: 2.75rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.25s, background 0.25s;
    user-select: none;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: #444;
    background: rgba(255, 255, 255, 0.025);
}

.upload-icon {
    font-size: 2.5rem;
    color: #333;
    margin-bottom: 0.75rem;
    line-height: 1;
}

.upload-area p {
    color: #555;
    font-size: 0.9rem;
    margin-bottom: 0.3rem;
}

.upload-area strong { color: #888; }

.upload-hint {
    font-size: 0.75rem !important;
    color: #3a3a3a !important;
    letter-spacing: 0.04em;
}

.upload-area input[type="file"] { display: none; }

/* Upload file preview list */
.upload-preview-list {
    margin-top: 0.75rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.upload-preview-chip {
    background: #1a1a1a;
    border: 1px solid #252525;
    border-radius: 20px;
    padding: 0.25rem 0.75rem;
    font-size: 0.78rem;
    color: #888;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 220px;
}

/* ── Admin stats ───────────────────────────────────────────────── */
.admin-stats {
    display: flex;
    gap: 0.75rem;
    font-size: 0.8rem;
    color: #555;
    margin-bottom: 1.25rem;
}

/* ── Admin photo grid ──────────────────────────────────────────── */
.admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
}

.admin-photo-item {
    position: relative;
    border-radius: 5px;
    overflow: hidden;
    background: #181818;
    aspect-ratio: 1;
}

.admin-photo-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: filter 0.3s;
}

.admin-photo-item:hover img {
    filter: brightness(0.7);
}

.photo-meta {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1.25rem 0.6rem 0.5rem;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.75));
    font-size: 0.68rem;
    color: rgba(255, 255, 255, 0.55);
    opacity: 0;
    transition: opacity 0.25s;
    pointer-events: none;
}

.admin-photo-item:hover .photo-meta { opacity: 1; }

.delete-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 28px;
    height: 28px;
    background: rgba(0, 0, 0, 0.7);
    border: none;
    border-radius: 50%;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s, background 0.2s;
    font-family: inherit;
}

.admin-photo-item:hover .delete-btn { opacity: 1; }
.delete-btn:hover { background: rgba(180, 30, 30, 0.9) !important; color: #fff; }

.empty-admin {
    color: #3a3a3a;
    font-size: 0.88rem;
    text-align: center;
    padding: 2.5rem;
}

/* ── Schimbare parolă galerie ──────────────────────────────────── */
.pass-change-fields {
    display: flex;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 1rem;
}

.pass-change-fields .form-group {
    margin-bottom: 0;
    flex: 1;
    min-width: 180px;
}

.pass-change-action {
    padding-bottom: 1px; /* aliniaza cu inputurile */
}

.pass-note {
    font-size: 0.76rem;
    color: #444;
    margin-top: 1rem;
}

.pass-note code {
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    border-radius: 3px;
    padding: 0.1rem 0.4rem;
    color: #888;
    font-size: 0.82em;
}

/* ── Log acces ─────────────────────────────────────────────────── */
.log-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.log-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.log-filter {
    background: transparent;
    border: 1px solid #252525;
    border-radius: 20px;
    color: #555;
    font-size: 0.75rem;
    font-family: inherit;
    padding: 0.28rem 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.log-filter:hover  { border-color: #3a3a3a; color: #aaa; }
.log-filter.active { background: #1e1e1e; border-color: #3a3a3a; color: #ddd; }

.log-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.log-total    { font-size: 0.76rem; color: #555; }
.log-truncated { font-size: 0.72rem; color: #3a3a3a; }

.log-table-wrap {
    overflow-x: auto;
    border-radius: 6px;
    border: 1px solid #1a1a1a;
    max-height: 560px;
    overflow-y: auto;
}

.log-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
    white-space: nowrap;
}

.log-table thead {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #111;
}

.log-table th {
    text-align: left;
    padding: 0.65rem 0.85rem;
    font-size: 0.68rem;
    font-weight: 500;
    color: #555;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    border-bottom: 1px solid #1e1e1e;
}

.log-table td {
    padding: 0.5rem 0.85rem;
    border-bottom: 1px solid #141414;
    color: #999;
    vertical-align: middle;
}

.log-table tbody tr:hover td { background: #111; }
.log-table tbody tr:last-child td { border-bottom: none; }

.log-time {
    color: #666;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
}

/* Badges */
.log-badge {
    display: inline-block;
    padding: 0.18rem 0.6rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 500;
    white-space: nowrap;
}

.log-ok         { background: rgba(30,120,60,0.25);  color: #6dcc9a; border: 1px solid rgba(30,120,60,0.4); }
.log-fail       { background: rgba(160,30,30,0.25);  color: #e07070; border: 1px solid rgba(160,30,30,0.4); }
.log-admin-ok   { background: rgba(30,80,160,0.25);  color: #70a0e0; border: 1px solid rgba(30,80,160,0.4); }
.log-admin-fail { background: rgba(160,100,20,0.25); color: #e0b060; border: 1px solid rgba(160,100,20,0.4); }
.log-unknown    { background: rgba(60,60,60,0.25);   color: #888;    border: 1px solid #333; }

.log-ip {
    color: #7ab0d4;
    text-decoration: none;
    font-family: monospace;
    font-size: 0.8rem;
}

.log-ip:hover { color: #a0ccee; text-decoration: underline; }

.log-device { color: #666; }
.log-lang   { color: #555; font-size: 0.72rem; }
.log-empty  { color: #333; }

.log-ref {
    color: #555;
    font-size: 0.72rem;
    cursor: help;
}

/* User-Agent row */
.log-ua-row td.log-ua {
    font-size: 0.67rem;
    color: #3a3a3a;
    padding-top: 0;
    padding-bottom: 0.5rem;
    font-family: monospace;
    white-space: normal;
    word-break: break-all;
    border-bottom: 1px solid #181818;
}

.log-ua-label {
    color: #2a2a2a;
    margin-right: 0.4rem;
    text-transform: uppercase;
    font-size: 0.62rem;
    letter-spacing: 0.06em;
}

/* ── Drag & drop sort ──────────────────────────────────────────── */
.sort-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
    min-height: 32px;
}

.sort-options {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.sort-bar-hint {
    font-size: 0.76rem;
    color: #555;
    margin-right: 0.2rem;
}

.sort-drag-hint {
    font-size: 0.72rem;
    color: #333;
    margin-left: 0.3rem;
}

.sort-bar-actions {
    display: none;          /* vizibil doar după prima reordonare */
    align-items: center;
    gap: 0.5rem;
}

.sort-bar-actions.visible {
    display: flex;
}

.btn-sm {
    padding: 0.38rem 0.9rem;
    font-size: 0.8rem;
}

.admin-photo-item[draggable="true"] {
    cursor: grab;
}

/* SortableJS – placeholder-ul (locul gol rămas) */
.sortable-ghost {
    opacity: 0.2;
    background: #2a2a2a;
    border-radius: 5px;
}

/* SortableJS – elementul selectat înainte de a începe drag-ul */
.sortable-chosen {
    cursor: grabbing !important;
}

/* SortableJS – copia flotantă în timp ce tragi */
.sortable-drag {
    opacity: 0.95;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6);
    border-radius: 5px;
    cursor: grabbing !important;
}
