/* ============================================================
   GalleryPro — Main Stylesheet
   Facebook-style Photo & Video Gallery
   ============================================================ */

/* --- Reset & Root Variables --- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-card: #1c2128;
    --bg-hover: #21262d;
    --border: #30363d;
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-muted: #484f58;
    --accent: #58a6ff;
    --accent-hover: #79b8ff;
    --accent-dark: #1f6feb;
    --danger: #f85149;
    --success: #3fb950;
    --warning: #d29922;
    --purple: #bc8cff;
    --gradient-1: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-2: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --gradient-3: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, .4);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, .5);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, .6);
    --radius: 12px;
    --radius-sm: 8px;
    --transition: 0.25s cubic-bezier(.4, 0, .2, 1);
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ============================================================
   HEADER
   ============================================================ */
.site-header {
    position: sticky;
    top: 0;
    z-index: 200;
    background: rgba(13, 17, 23, .9);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
}

.header-inner {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 12px 24px;
    max-width: 1600px;
    margin: 0 auto;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    font-size: 1.25rem;
    background: var(--gradient-3);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    white-space: nowrap;
}

.logo svg {
    width: 28px;
    height: 28px;
    stroke: #4facfe;
    -webkit-text-fill-color: initial;
}

.header-nav {
    display: flex;
    gap: 8px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: .875rem;
    font-weight: 500;
    transition: all var(--transition);
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
}

.nav-link svg {
    width: 16px;
    height: 16px;
}

.nav-link:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-link.active {
    background: var(--accent-dark);
    color: var(--accent);
}

.nav-link.upload-trigger {
    background: var(--gradient-3);
    color: #fff;
    -webkit-text-fill-color: white;
}

.nav-link.upload-trigger:hover {
    opacity: .9;
    transform: translateY(-1px);
}

.search-bar {
    flex: 1;
    max-width: 400px;
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 99px;
    padding: 8px 16px;
    margin-left: auto;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.search-bar:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(88, 166, 255, .15);
}

.search-bar svg {
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.search-bar input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: .875rem;
    font-family: inherit;
}

.search-bar input::placeholder {
    color: var(--text-muted);
}

.search-bar button {
    background: var(--accent-dark);
    color: #fff;
    border: none;
    border-radius: 99px;
    padding: 5px 14px;
    font-size: .8rem;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--transition);
    font-family: inherit;
}

.search-bar button:hover {
    background: var(--accent);
}

/* User info bar */
.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: 8px;
    flex-shrink: 0;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--gradient-3);
    display: grid;
    place-items: center;
    font-weight: 800;
    font-size: .9rem;
    color: #fff;
    flex-shrink: 0;
}

.user-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
    line-height: 1;
}

.user-name {
    font-size: .82rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
}

.user-role-badge {
    font-size: .62rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .08em;
    padding: 2px 7px;
    border-radius: 99px;
    width: fit-content;
}

.user-role-badge.admin {
    background: rgba(248, 81, 73, .15);
    color: #f85149;
}

.user-role-badge.user {
    background: rgba(63, 185, 80, .15);
    color: #3fb950;
}

.logout-btn {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    text-decoration: none;
    transition: all var(--transition);
    flex-shrink: 0;
}

.logout-btn svg {
    width: 16px;
    height: 16px;
}

.logout-btn:hover {
    background: rgba(248, 81, 73, .15);
    border-color: var(--danger);
    color: var(--danger);
}

/* Guest Sign-in button in header */
.btn-signin-header {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 8px 16px;
    border-radius: 99px;
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: #fff;
    font-size: .82rem;
    font-weight: 700;
    text-decoration: none;
    transition: opacity .2s, transform .2s, box-shadow .2s;
    box-shadow: 0 4px 16px rgba(79,172,254,.35);
    white-space: nowrap;
}

.btn-signin-header svg {
    width: 15px;
    height: 15px;
}

.btn-signin-header:hover {
    opacity: .9;
    transform: translateY(-1px);
    box-shadow: 0 6px 24px rgba(79,172,254,.5);
}

/* User notice (non-admin) */
.user-notice {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    background: rgba(88, 166, 255, .06);
    border: 1px solid rgba(88, 166, 255, .2);
    border-radius: var(--radius-sm);
    padding: 12px;
    font-size: .8rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.user-notice svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    color: var(--accent);
    margin-top: 1px;
}

.user-notice strong {
    color: var(--text-primary);
}

/* Stats bar */
.stats-bar {
    display: flex;
    gap: 32px;
    padding: 10px 24px;
    max-width: 1600px;
    margin: 0 auto;
    border-top: 1px solid var(--border);
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: .8rem;
    color: var(--text-secondary);
}

.stat-item strong {
    font-size: 1rem;
    font-weight: 700;
    background: var(--gradient-3);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ============================================================
   MAIN LAYOUT
   ============================================================ */
.main-layout {
    display: flex;
    max-width: 1600px;
    margin: 0 auto;
    padding: 24px;
    gap: 24px;
    min-height: calc(100vh - 120px);
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
    width: 240px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar-title {
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--text-muted);
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text-secondary);
    font-size: .875rem;
    font-weight: 500;
    transition: all var(--transition);
}

.sidebar-link:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.sidebar-link.active {
    background: rgba(88, 166, 255, .12);
    color: var(--accent);
}

.sidebar-link .icon {
    font-size: 1rem;
}

.sidebar-link .badge {
    margin-left: auto;
    background: var(--bg-hover);
    color: var(--text-muted);
    font-size: .7rem;
    padding: 2px 7px;
    border-radius: 99px;
    font-weight: 600;
}

.sidebar-link.active .badge {
    background: rgba(88, 166, 255, .2);
    color: var(--accent);
}

.btn-upload-big {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px;
    background: var(--gradient-3);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: .875rem;
    font-weight: 700;
    cursor: pointer;
    transition: opacity var(--transition), transform var(--transition);
    font-family: inherit;
}

.btn-upload-big svg {
    width: 18px;
    height: 18px;
}

.btn-upload-big:hover {
    opacity: .9;
    transform: translateY(-2px);
}

/* ============================================================
   GALLERY CONTENT
   ============================================================ */
.gallery-content {
    flex: 1;
    min-width: 0;
}

/* Filter bar */
.filter-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
    gap: 12px;
    flex-wrap: wrap;
}

.filter-label {
    font-size: .9rem;
    color: var(--text-secondary);
}

.filter-label em {
    color: var(--accent);
    font-style: normal;
    font-weight: 600;
}

.filter-right {
    display: flex;
    gap: 12px;
    align-items: center;
}

.view-toggle {
    display: flex;
    gap: 4px;
}

.view-btn {
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
}

.view-btn svg {
    width: 14px;
    height: 14px;
}

.view-btn:hover,
.view-btn.active {
    background: var(--accent-dark);
    border-color: var(--accent);
    color: var(--accent);
}

.sort-select {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    padding: 6px 12px;
    font-size: .8rem;
    cursor: pointer;
    font-family: inherit;
}

/* ============================================================
   GALLERY GRID
   ============================================================ */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
    transition: all var(--transition);
}

.gallery-grid.list-view {
    grid-template-columns: 1fr;
}

.gallery-grid.list-view .gallery-card {
    display: flex;
    gap: 16px;
}

.gallery-grid.list-view .card-media {
    width: 160px;
    height: 110px;
    flex-shrink: 0;
}

.gallery-grid.list-view .card-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Gallery Card */
.gallery-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
    animation: fadeIn .4s ease both;
}

.gallery-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(16px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card-media {
    position: relative;
    width: 100%;
    aspect-ratio: 4/3;
    overflow: hidden;
    background: var(--bg-secondary);
}

.card-media img,
.card-media video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.gallery-card:hover .card-media img,
.gallery-card:hover .card-media video {
    transform: scale(1.05);
}

.video-play-btn {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    background: rgba(0, 0, 0, .35);
    transition: background var(--transition);
}

.video-play-btn svg {
    width: 40px;
    height: 40px;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, .5));
}

.gallery-card:hover .video-play-btn {
    background: rgba(0, 0, 0, .2);
}

/* Overlay */
.card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, .85) 0%, transparent 60%);
    opacity: 0;
    transition: opacity var(--transition);
    display: flex;
    align-items: flex-end;
    padding: 12px;
}

.gallery-card:hover .card-overlay {
    opacity: 1;
}

.card-actions {
    display: flex;
    gap: 8px;
    width: 100%;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 7px 12px;
    border-radius: 99px;
    border: 1px solid rgba(255, 255, 255, .2);
    background: rgba(255, 255, 255, .1);
    backdrop-filter: blur(8px);
    color: #fff;
    font-size: .75rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all var(--transition);
    font-family: inherit;
}

.action-btn svg {
    width: 14px;
    height: 14px;
}

.action-btn:hover {
    background: rgba(255, 255, 255, .25);
    transform: scale(1.05);
}

.action-btn.like-btn:hover {
    background: rgba(248, 81, 73, .6);
    border-color: var(--danger);
}

.action-btn.download-btn:hover {
    background: rgba(63, 185, 80, .6);
    border-color: var(--success);
}

.action-btn.delete-btn:hover {
    background: rgba(248, 81, 73, .6);
    border-color: var(--danger);
}

.card-type-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(0, 0, 0, .6);
    backdrop-filter: blur(4px);
    border-radius: 99px;
    padding: 3px 10px;
    font-size: .7rem;
}

.card-info {
    padding: 12px 14px 14px;
}

.card-caption {
    font-size: .85rem;
    color: var(--text-primary);
    font-weight: 500;
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-meta {
    display: flex;
    justify-content: space-between;
    font-size: .72rem;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.card-stats {
    display: flex;
    gap: 10px;
    font-size: .72rem;
    color: var(--text-muted);
}

.card-stats .downloads-stat {
    color: #4facfe;
    font-weight: 600;
}

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-secondary);
}

.empty-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 24px;
    border-radius: 50%;
    background: var(--bg-card);
    display: grid;
    place-items: center;
    border: 1px solid var(--border);
}

.empty-icon svg {
    width: 40px;
    height: 40px;
}

.empty-state h2 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.empty-state p {
    margin-bottom: 24px;
}

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 40px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.page-btn {
    min-width: 40px;
    height: 40px;
    padding: 0 14px;
    display: grid;
    place-items: center;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: .875rem;
    font-weight: 600;
    transition: all var(--transition);
}

.page-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--bg-hover);
}

.page-btn.active {
    background: var(--accent-dark);
    border-color: var(--accent);
    color: var(--accent);
}

/* ============================================================
   UPLOAD MODAL
   ============================================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .75);
    backdrop-filter: blur(6px);
    z-index: 500;
    display: grid;
    place-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition);
}

.modal-overlay.open {
    opacity: 1;
    pointer-events: all;
}

.modal-box {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 16px;
    width: min(600px, 95vw);
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    transform: scale(.95) translateY(20px);
    transition: transform var(--transition);
}

.modal-overlay.open .modal-box {
    transform: scale(1) translateY(0);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    font-size: 1.1rem;
    font-weight: 700;
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: var(--bg-hover);
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: all var(--transition);
}

.modal-close:hover {
    background: var(--danger);
    color: #fff;
}

.modal-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
}

/* Drop Zone */
.drop-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
    min-height: 180px;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}

.drop-zone.drag-over {
    border-color: var(--accent);
    background: rgba(88, 166, 255, .05);
    transform: scale(1.01);
}

.drop-content {
    padding: 32px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.drop-icon svg {
    width: 48px;
    height: 48px;
    color: var(--accent);
}

.drop-content h3 {
    font-size: 1rem;
    font-weight: 600;
}

.drop-content p {
    color: var(--text-secondary);
    font-size: .85rem;
}

.browse-label {
    color: var(--accent);
    cursor: pointer;
    text-decoration: underline;
}

.drop-hint {
    color: var(--text-muted);
    font-size: .75rem !important;
}

/* Previews */
.preview-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
    padding: 0 16px 16px;
}

.preview-item {
    position: relative;
    border-radius: var(--radius-sm);
    overflow: hidden;
    aspect-ratio: 1;
    border: 2px solid var(--border);
    background: var(--bg-hover);
}

.preview-item img,
.preview-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-item .remove-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: none;
    background: rgba(248, 81, 73, .9);
    color: #fff;
    font-size: .85rem;
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: transform var(--transition);
}

.preview-item .remove-btn:hover {
    transform: scale(1.1);
}

.preview-item .type-badge {
    position: absolute;
    bottom: 4px;
    left: 4px;
    font-size: .65rem;
    background: rgba(0, 0, 0, .7);
    border-radius: 4px;
    padding: 1px 5px;
}

/* Form */
.upload-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: .8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: .05em;
}

.form-group input,
.form-group select {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: .9rem;
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(88, 166, 255, .15);
}

/* Progress */
.upload-progress {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.progress-bar-wrap {
    height: 6px;
    background: var(--bg-card);
    border-radius: 99px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: var(--gradient-3);
    border-radius: 99px;
    transition: width .3s;
}

#progressText {
    font-size: .8rem;
    color: var(--text-secondary);
    text-align: center;
}

/* Result */
.upload-result {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.result-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: .85rem;
    font-weight: 500;
}

.result-item.success {
    background: rgba(63, 185, 80, .1);
    border: 1px solid rgba(63, 185, 80, .3);
    color: var(--success);
}

.result-item.error {
    background: rgba(248, 81, 73, .1);
    border: 1px solid rgba(248, 81, 73, .3);
    color: var(--danger);
}

/* Buttons */
.btn-primary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--gradient-3);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: .875rem;
    font-weight: 700;
    cursor: pointer;
    transition: opacity var(--transition), transform var(--transition);
    font-family: inherit;
}

.btn-primary svg {
    width: 16px;
    height: 16px;
}

.btn-primary:hover {
    opacity: .9;
    transform: translateY(-1px);
}

.btn-primary:disabled {
    opacity: .5;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    padding: 10px 20px;
    background: var(--bg-hover);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: .875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
}

.btn-secondary:hover {
    background: var(--border);
    color: var(--text-primary);
}

/* ============================================================
   LIGHTBOX
   ============================================================ */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, .92);
    backdrop-filter: blur(12px);
    display: grid;
    place-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s;
}

.lightbox.open {
    opacity: 1;
    pointer-events: all;
}

.lb-close {
    position: fixed;
    top: 20px;
    right: 24px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, .2);
    background: rgba(255, 255, 255, .08);
    color: #fff;
    font-size: 1.4rem;
    cursor: pointer;
    display: grid;
    place-items: center;
    z-index: 10;
    transition: all var(--transition);
}

.lb-close:hover {
    background: var(--danger);
    border-color: var(--danger);
    transform: rotate(90deg);
}

.lb-nav {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, .2);
    background: rgba(255, 255, 255, .08);
    color: #fff;
    font-size: 1.8rem;
    cursor: pointer;
    display: grid;
    place-items: center;
    z-index: 10;
    transition: all var(--transition);
    line-height: 1;
}

.lb-nav:hover {
    background: rgba(255, 255, 255, .2);
    transform: translateY(-50%) scale(1.1);
}

.lb-prev {
    left: 16px;
}

.lb-next {
    right: 16px;
}

.lb-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    max-width: min(1100px, 95vw);
    max-height: 95vh;
    width: 100%;
}

.lb-media {
    flex: 1;
    max-height: 70vh;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

.lb-media img {
    max-width: 100%;
    max-height: 70vh;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    animation: lbFadeIn .3s ease;
}

.lb-media video {
    max-width: 100%;
    max-height: 70vh;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    outline: none;
}

@keyframes lbFadeIn {
    from {
        opacity: 0;
        transform: scale(.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.lb-info {
    background: rgba(255, 255, 255, .05);
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: var(--radius);
    padding: 16px 24px;
    width: 100%;
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.lb-caption {
    font-size: .95rem;
    font-weight: 600;
    color: #fff;
    flex: 1;
}

.lb-meta {
    font-size: .8rem;
    color: rgba(255, 255, 255, .5);
    flex: 1;
}

.lb-actions {
    display: flex;
    gap: 10px;
}

.lb-action-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 18px;
    border-radius: 99px;
    border: 1px solid rgba(255, 255, 255, .15);
    background: rgba(255, 255, 255, .08);
    color: #fff;
    font-size: .85rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all var(--transition);
    font-family: inherit;
}

.lb-action-btn svg {
    width: 16px;
    height: 16px;
}

.lb-action-btn:hover {
    background: rgba(255, 255, 255, .2);
}

.lb-action-btn.like-btn.liked svg {
    fill: var(--danger);
    stroke: var(--danger);
}

.lb-action-btn.download-btn:hover {
    background: rgba(63, 185, 80, .3);
    border-color: var(--success);
}

/* ============================================================
   TOAST
   ============================================================ */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 18px;
    border-radius: var(--radius);
    background: var(--bg-card);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    font-size: .875rem;
    font-weight: 500;
    min-width: 260px;
    animation: slideInUp .3s ease;
    color: var(--text-primary);
}

.toast.success {
    border-left: 4px solid var(--success);
}

.toast.error {
    border-left: 4px solid var(--danger);
}

.toast.info {
    border-left: 4px solid var(--accent);
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================================
   SCROLLBAR
   ============================================================ */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 99px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
    .main-layout {
        flex-direction: column;
        padding: 16px;
    }

    .sidebar {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 12px;
    }

    .sidebar-section {
        flex: 1;
        min-width: 200px;
    }

    .stats-bar {
        flex-wrap: wrap;
        gap: 16px;
    }

    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }
}

@media (max-width: 600px) {
    .header-inner {
        flex-wrap: wrap;
    }

    .search-bar {
        order: 3;
        max-width: 100%;
        width: 100%;
    }

    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .lb-info {
        flex-direction: column;
        text-align: center;
    }

    .lb-nav {
        display: none;
    }
}