:root {
    --bg-color: #0f172a; 
    --bg-gradient: radial-gradient(circle at 50% -20%, #4338ca, #1e1b4b, #0f172a);
    --text-main: #f8fafc;
    --text-muted: #cbd5e1;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --primary: #8b5cf6;
    --primary-dark: #7c3aed;
    --accent: #ec4899;
    --card-hover: rgba(139, 92, 246, 0.2);
    --modal-bg: #1e293b;
    --scrollbar-thumb: #475569;
}
body.light-mode {
    --bg-color: #f8fafc;
    --bg-gradient: radial-gradient(circle at 50% 0%, #e0e7ff, #f1f5f9 60%);
    --text-main: #0f172a;
    --text-muted: #64748b;
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(0, 0, 0, 0.05);
    --primary: #7c3aed;
    --primary-dark: #6d28d9;
    --accent: #d946ef;
    --card-hover: rgba(124, 58, 237, 0.05);
    --modal-bg: #ffffff;
    --scrollbar-thumb: #cbd5e1;
}
* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Poppins', sans-serif; }
body { 
    min-height: 100vh; 
    background-color: var(--bg-color);
    background-image: var(--bg-gradient);
    background-attachment: fixed;
    color: var(--text-main);
    overflow-x: hidden;
    display: flex; flex-direction: column; align-items: center;
    transition: background 0.5s ease, color 0.3s ease;
}
#bg-canvas { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: -1; }
.top-bar { position: fixed; top: 20px; right: 20px; z-index: 100; display: flex; gap: 15px; align-items: center; }
.theme-btn { background: var(--glass-bg); backdrop-filter: blur(12px); border: 1px solid var(--glass-border); width: 45px; height: 45px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text-main); font-size: 1.2em; transition: 0.2s ease-in-out; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1); }
.theme-btn:hover { background: var(--card-hover); transform: scale(1.05); }
.auth-btn { background: var(--glass-bg); backdrop-filter: blur(12px); border: 1px solid var(--glass-border); padding: 10px 24px; border-radius: 50px; color: var(--text-main); cursor: pointer; display: flex; align-items: center; gap: 10px; transition: all 0.2s ease; font-weight: 600; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1); font-size: 0.95em; }
.auth-btn:hover { background: var(--card-hover); transform: translateY(-2px); border-color: var(--primary); }
.user-chip { display: none; align-items: center; gap: 12px; background: var(--glass-bg); padding: 6px 16px 6px 6px; border-radius: 50px; border: 1px solid var(--glass-border); cursor: pointer; transition: all 0.2s ease; color: var(--text-main); backdrop-filter: blur(12px); }
.user-chip:hover { background: var(--card-hover); border-color: var(--primary); }
.user-chip img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; border: 2px solid var(--primary); }
.dropdown-menu { position: absolute; top: 60px; right: 0; width: 220px; background: var(--glass-bg); backdrop-filter: blur(20px); border: 1px solid var(--glass-border); border-radius: 16px; padding: 8px; display: none; flex-direction: column; gap: 4px; box-shadow: 0 10px 25px -5px rgba(0,0,0,0.3); animation: slideDown 0.2s cubic-bezier(0.16, 1, 0.3, 1); transform-origin: top right; }
.dropdown-menu.show { display: flex; }
.menu-item { background: transparent; border: none; color: var(--text-main); padding: 12px; text-align: left; border-radius: 8px; cursor: pointer; transition: 0.2s; display: flex; align-items: center; gap: 12px; font-size: 0.95em; }
.menu-item:hover { background: rgba(255,255,255,0.05); }
.menu-item.logout:hover { background: rgba(220, 38, 38, 0.15); color: #fca5a5; }
@keyframes slideDown { from { opacity:0; transform: scale(0.95) translateY(-10px); } to { opacity:1; transform: scale(1) translateY(0); } }
.main-container { width: 100%; max-width: 1200px; padding: 100px 20px 40px; display: flex; flex-direction: column; align-items: center; gap: 50px; }
.profile-card { background: var(--glass-bg); backdrop-filter: blur(12px); border: 1px solid var(--glass-border); padding: 60px 40px; border-radius: 32px; text-align: center; position: relative; width: 100%; max-width: 500px; box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25); animation: fadeIn 0.8s ease-out; transition: transform 0.3s ease; }
.profile-card:hover { transform: translateY(-5px); }
@keyframes fadeIn { from { opacity:0; transform: translateY(20px); } to { opacity:1; transform:translateY(0); } }
.profile-img-wrapper { width: 156px; height: 156px; margin: 0 auto 25px; position: relative; display: flex; align-items: center; justify-content: center; background: linear-gradient(45deg, #ff00cc, #3333ff, #00ccff, #ff00cc); background-size: 400%; border-radius: 50%; animation: glowingBorder 20s linear infinite; box-shadow: 0 0 20px rgba(139, 92, 246, 0.4); }
@keyframes glowingBorder { 0% { background-position: 0 0; } 50% { background-position: 100% 0; } 100% { background-position: 0 0; } }
.profile-img { width: 146px; height: 146px; border-radius: 50%; border: 4px solid var(--modal-bg); object-fit: cover; position: relative; z-index: 2; background: var(--modal-bg); }
/* Fixed Overlay Style - ALWAYS VISIBLE if class added */
.profile-edit-overlay { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 146px; height: 146px; border-radius: 50%; background: rgba(0,0,0,0.6); display: flex; align-items: center; justify-content: center; color: white; font-size: 2em; z-index: 3; cursor: pointer; pointer-events: auto; opacity: 0; transition: opacity 0.3s ease; }
.profile-name { font-size: 2.8em; font-weight: 700; background: linear-gradient(135deg, var(--text-main) 30%, var(--primary)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; margin-bottom: 8px; letter-spacing: -0.5px; }
.profile-quote { color: var(--text-muted); font-size: 1.1em; font-weight: 400; margin-bottom: 35px; }
.social-row { display: flex; justify-content: center; gap: 15px; }
.social-btn { width: 50px; height: 50px; border-radius: 14px; background: rgba(255,255,255,0.03); display: flex; align-items: center; justify-content: center; color: var(--text-muted); font-size: 1.4em; text-decoration: none; transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1); border: 1px solid var(--glass-border); }
.social-btn:hover { transform: translateY(-4px); background: var(--primary); color: white; border-color: var(--primary); box-shadow: 0 10px 15px -3px rgba(168, 85, 247, 0.3); }
.social-btn.telegram:hover { background: #0088cc; border-color: #0088cc; box-shadow: 0 10px 15px -3px rgba(0, 136, 204, 0.3); }
.gallery-container { width: 100%; background: var(--glass-bg); backdrop-filter: blur(12px); border-radius: 32px; padding: 40px; border: 1px solid var(--glass-border); margin-top: 20px; transition: background 0.5s; box-shadow: 0 25px 50px -12px rgba(0,0,0,0.1); }
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 30px; flex-wrap: wrap; gap: 20px; padding-bottom: 20px; border-bottom: 1px solid var(--glass-border); }
.section-title { font-size: 1.5em; font-weight: 600; color: var(--text-main); display: flex; align-items: center; gap: 12px; }
.section-title i { color: var(--primary); }
.upload-trigger { background: var(--primary); color: white; padding: 10px 24px; border-radius: 12px; font-weight: 600; cursor: pointer; border: none; display: flex; align-items: center; gap: 10px; transition: 0.2s; box-shadow: 0 4px 6px -1px rgba(168, 85, 247, 0.3); font-size: 0.95em; }
.upload-trigger:hover { background: var(--primary-dark); transform: translateY(-1px); }
.upload-trigger.disabled { background: #334155; cursor: not-allowed; opacity: 0.7; box-shadow: none; }
.spinner { border: 2px solid rgba(255,255,255,0.3); border-radius: 50%; border-top: 2px solid white; width: 18px; height: 18px; animation: spin 1s linear infinite; display: none; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
/* UPDATED GRID FOR 3 COLUMNS */
.gallery-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); 
    gap: 24px; min-height: 200px; transition: opacity 0.2s; 
}
.gallery-item { border-radius: 16px; overflow: hidden; position: relative; aspect-ratio: 16/9; cursor: pointer; border: 1px solid var(--glass-border); transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); background: rgba(0,0,0,0.2); }
.gallery-item:hover { transform: translateY(-4px); box-shadow: 0 20px 25px -5px rgba(0,0,0,0.3); border-color: var(--primary); }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s ease; }
.gallery-item:hover img { transform: scale(1.05); }
.item-overlay { position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, transparent 60%); opacity: 0; transition: 0.3s; display: flex; flex-direction: column; justify-content: flex-end; padding: 20px; }
.gallery-item:hover .item-overlay { opacity: 1; }
.item-info { display: flex; justify-content: space-between; align-items: center; color: white; }
.user-mini { display: flex; align-items: center; gap: 8px; font-size: 0.85em; font-weight: 500; }
.user-mini img { width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--primary); }
.stats-row { display: flex; gap: 8px; }
.like-badge { display: flex; align-items: center; gap: 6px; background: rgba(255,255,255,0.1); padding: 4px 10px; border-radius: 20px; font-size: 0.8em; backdrop-filter: blur(4px); }
.item-actions { position: absolute; top: 12px; right: 12px; display: flex; gap: 8px; }
.action-icon { background: rgba(0,0,0,0.5); color: white; width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: 0.2s; backdrop-filter: blur(4px); }
.action-icon:hover { background: var(--primary); }
.action-icon.delete:hover { background: #ef4444; }
.pagination { display: flex; justify-content: center; align-items: center; margin-top: 40px; gap: 8px; }
.page-btn { background: transparent; border: 1px solid var(--glass-border); color: var(--text-main); width: 40px; height: 40px; border-radius: 12px; cursor: pointer; transition: 0.2s; display: flex; align-items: center; justify-content: center; font-size: 0.9em; }
.page-btn:hover:not(:disabled) { background: var(--card-hover); border-color: var(--primary); color: var(--primary); }
.page-btn.active { background: var(--primary); border-color: var(--primary); font-weight: 600; color: white; }
.page-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.music-widget { position: fixed; bottom: 20px; left: 20px; background: var(--glass-bg); backdrop-filter: blur(20px); border: 1px solid var(--glass-border); padding: 12px 24px; border-radius: 50px; display: flex; align-items: center; gap: 20px; z-index: 1000; box-shadow: 0 20px 25px -5px rgba(0,0,0,0.2); transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); width: fit-content; max-width: calc(100% - 40px); }
.music-widget:hover { transform: translateY(-4px); box-shadow: 0 25px 30px -5px rgba(0,0,0,0.3); }
.music-icon-wrapper { background: var(--primary); width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: white; flex-shrink: 0; box-shadow: 0 0 15px var(--primary); cursor: pointer; transition: 0.3s; }
.music-icon-wrapper:hover { transform: scale(1.1); }
.music-info { display: flex; flex-direction: column; width: 140px; }
.song-name { font-size: 0.9em; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-main); }
.artist-name { font-size: 0.75em; color: var(--text-muted); }
.music-controls { display: flex; gap: 12px; }
.music-btn { background: none; border: none; color: var(--text-main); cursor: pointer; font-size: 1.1em; transition: 0.2s; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border-radius: 50%; }
.music-btn:hover { background: rgba(255,255,255,0.1); color: var(--primary); }
#playlist-modal { position: fixed; bottom: 90px; left: 20px; width: 320px; max-height: 400px; background: var(--modal-bg); border: 1px solid var(--glass-border); border-radius: 20px; display: none; flex-direction: column; box-shadow: 0 20px 25px -5px rgba(0,0,0,0.3); z-index: 999; overflow: hidden; animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1); }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
#playlist-modal.show { display: flex; }
.playlist-header { padding: 15px; border-bottom: 1px solid var(--glass-border); display: flex; gap: 10px; align-items: center; }
#playlist-search { width: 100%; padding: 10px 15px; border-radius: 10px; border: 1px solid var(--glass-border); background: rgba(0,0,0,0.2); color: var(--text-main); outline: none; font-size: 0.9em; }
#playlist-search:focus { border-color: var(--primary); }
.playlist-items { overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 5px; }
.playlist-items::-webkit-scrollbar { width: 6px; }
.playlist-items::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 10px; }
.playlist-item { padding: 10px; border-radius: 8px; cursor: pointer; display: flex; justify-content: space-between; align-items: center; transition: 0.2s; font-size: 0.9em; color: var(--text-muted); }
.playlist-item:hover { background: rgba(255,255,255,0.05); color: var(--text-main); }
.playlist-item.active { background: var(--card-hover); color: var(--primary); font-weight: 600; }
.playlist-item.active i { display: block; }
.playlist-item i { display: none; }
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,0.95); z-index: 2000; display: none; flex-direction: column; justify-content: center; align-items: center; animation: fadeIn 0.2s; }
.lightbox.active { display: flex; }
.lightbox img { max-width: 90%; max-height: 80vh; border-radius: 12px; box-shadow: 0 0 50px rgba(168, 85, 247, 0.2); cursor: grab; }
.lightbox-close { position: absolute; top: 20px; right: 30px; color: white; font-size: 2.5em; cursor: pointer; transition: 0.2s; }
.lightbox-close:hover { transform: scale(1.1); color: var(--primary); }
.lightbox-details { margin-top: 20px; display: flex; align-items: center; gap: 20px; color: white; }
.heart-btn { background: none; border: none; color: white; font-size: 1.5em; cursor: pointer; transition: 0.2s; }
.heart-btn.liked { color: #ef4444; animation: pop 0.3s; }
@keyframes pop { 50% { transform: scale(1.3); } }
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.8); backdrop-filter: blur(8px); z-index: 1500; display: none; justify-content: center; align-items: center; }
.modal-overlay.show { display: flex; }
.modal-box { background: var(--modal-bg); padding: 30px; border-radius: 24px; border: 1px solid var(--glass-border); width: 90%; max-width: 400px; text-align: center; color: var(--text-main); box-shadow: 0 20px 25px -5px rgba(0,0,0,0.3); }
.modal-actions { display: flex; gap: 12px; justify-content: center; margin-top: 24px; }
.btn { padding: 10px 20px; border-radius: 10px; border: none; cursor: pointer; font-weight: 600; font-size: 0.95em; transition: 0.2s; }
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--primary); color: white; }
.btn-danger { background: #ef4444; color: white; }
.btn-secondary { background: #475569; color: white; }
#admin-panel { text-align: left; }
.admin-row { display: flex; justify-content: space-between; margin-bottom: 15px; align-items: center; font-weight: 500; }
/* Arrow Buttons */
.lightbox-nav-btn {
    position: absolute; top: 50%; transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1); backdrop-filter: blur(4px);
    width: 50px; height: 50px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: white; font-size: 1.5em; cursor: pointer; transition: 0.2s;
    border: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 3000;
}
.lightbox-nav-btn:hover { background: var(--primary); border-color: var(--primary); transform: translateY(-50%) scale(1.1); }
.lightbox-nav-btn.prev { left: 30px; }
.lightbox-nav-btn.next { right: 30px; }
@media (max-width: 768px) { 
    .profile-name { font-size: 2.2em; } 
    .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); } 
    .music-widget { bottom: 10px; left: 10px; right: 10px; width: auto; justify-content: space-between; max-width: none; } 
    #playlist-modal { left: 10px; right: 10px; width: auto; bottom: 80px; } 
    .lightbox-nav-btn { width: 40px; height: 40px; font-size: 1.2em; }
    .lightbox-nav-btn.prev { left: 10px; }
    .lightbox-nav-btn.next { right: 10px; }
}