:root {
    --primary: #e60023;
    --primary-hover: #ad001a;
    --bg-dark: #0f0f0f;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-muted: #8e8e8e;
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Outfit', sans-serif; }
body { background: var(--bg-dark); color: white; display: flex; min-height: 100vh; overflow-x: hidden; }

/* SIDEBAR */
.sidebar { width: 80px; height: 100vh; background: #0b0b0b; border-right: 1px solid var(--glass-border); display: flex; flex-direction: column; position: fixed; z-index: 1000; transition: 0.4s; overflow: hidden; }
.sidebar:hover { width: 260px; }

.logo { padding: 30px 25px; display: flex; align-items: center; gap: 15px; color: var(--primary); }
.logo h1 { font-size: 1.5rem; font-weight: 800; display: none; white-space: nowrap; }
.sidebar:hover .logo h1 { display: block; }

.nav-links { list-style: none; padding: 0 15px; flex-grow: 1; margin-top: 20px; }
.nav-links li { padding: 15px 12px; border-radius: 16px; margin-bottom: 8px; cursor: pointer; display: flex; align-items: center; gap: 15px; transition: 0.3s; color: var(--text-muted); }
.nav-links li:hover { background: rgba(255,255,255,0.05); color: white; }
.nav-links li.active { background: rgba(230,0,35,0.1); color: var(--primary); }
.nav-links li span { display: none; font-weight: 600; font-size: 0.95rem; white-space: nowrap; }
.sidebar:hover .nav-links li span { display: block; }

.logout-btn-nav:hover { color: var(--primary) !important; background: rgba(230,0,35,0.05); }
.sidebar:hover .logout-label { display: block !important; }

/* MAIN CONTENT & HEADER */
.main-content { margin-left: 80px; width: calc(100% - 80px); padding: 40px; transition: 0.4s; }
.sidebar:hover ~ .main-content { margin-left: 260px; width: calc(100% - 260px); }

.header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 40px; }
.search-bar { background: var(--glass-bg); border: 1px solid var(--glass-border); padding: 12px 25px; border-radius: 50px; display: flex; align-items: center; gap: 12px; width: 50%; max-width: 600px; transition: 0.3s; }
.search-bar:focus-within { width: 55%; background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.2); }
.search-bar input { background: none; border: none; color: white; width: 100%; outline: none; font-size: 1rem; }
.search-bar svg { color: var(--text-muted); }

/* PINTEREST MASONRY GRID */
.masonry-grid { columns: 5 250px; column-gap: 20px; width: 100%; }
.photo-card { break-inside: avoid; margin-bottom: 20px; border-radius: 20px; overflow: hidden; position: relative; cursor: zoom-in; transition: 0.3s; background: #1a1a1a; }
.photo-card img { width: 100%; display: block; transition: 0.5s; }
.photo-card:hover { transform: scale(1.02); }
.photo-card:hover img { transform: scale(1.1) rotate(1deg); filter: brightness(0.7); }

/* PIN OVERLAY & BUTTONS */
.photo-card .overlay { position: absolute; inset: 0; background: linear-gradient(to bottom, rgba(0,0,0,0.4) 0%, transparent 40%, rgba(0,0,0,0.6) 100%); opacity: 0; transition: 0.3s; z-index: 1; pointer-events: none; }
.photo-card:hover .overlay { opacity: 1; }

.photo-card .download-btn {
    position: absolute; top: 15px; right: 15px;
    background: var(--primary); color: white; border: none; padding: 10px 18px;
    border-radius: 50px; font-weight: 700; cursor: pointer;
    opacity: 0; transition: 0.3s; z-index: 10;
}
.photo-card:hover .download-btn { opacity: 1; transform: translateY(0); }
.photo-card .download-btn:hover { background: var(--primary-hover); }

.fav-badge {
    position: absolute; bottom: 15px; right: 15px;
    width: 38px; height: 38px; background: rgba(255,255,255,0.9);
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    cursor: pointer; opacity: 0; transition: 0.3s; z-index: 10; color: #222;
}
.photo-card:hover .fav-badge { opacity: 1; }
.photo-card.is-fav .fav-badge { opacity: 1; background: var(--primary); color: white; }
.fav-badge svg { transition: 0.2s; }
.fav-badge:hover svg { transform: scale(1.2); }

/* BOARDS GRID */
.boards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 24px; width: 100%; }
.board-card { position: relative; cursor: pointer; transition: 0.3s; border-radius: 24px; background: rgba(255,255,255,0.03); padding: 15px; border: 1px solid transparent; }
.board-card:hover { background: rgba(255,255,255,0.06); transform: translateY(-8px); border-color: rgba(255,255,255,0.1); }
.board-actions { position: absolute; top: 25px; right: 25px; opacity: 0; transition: 0.3s; z-index: 20; }
.board-card:hover .board-actions { opacity: 1; }
.board-dots { background: white; color: black; border-radius: 50%; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; }
.board-preview { display: grid; grid-template-columns: 2fr 1fr; grid-template-rows: 1fr 1fr; gap: 4px; border-radius: 18px; overflow: hidden; height: 200px; margin-bottom: 15px; background: #222; }
.board-preview img { width: 100%; height: 100%; object-fit: cover; }
.board-preview img:first-child { grid-row: span 2; }
.board-info h3 { font-size: 1.2rem; font-weight: 700; color: white; }

/* BOARD DROPDOWN MENU */
.board-menu {
    position: absolute; top: 40px; right: 0;
    background: white; border-radius: 16px;
    width: 180px; padding: 10px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    display: none; flex-direction: column; z-index: 100;
    animation: menuPop 0.2s ease-out;
}
.board-menu.show { display: flex; }

@keyframes menuPop { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

.board-menu-item {
    padding: 12px 15px; border-radius: 10px;
    color: #111; font-weight: 600; font-size: 0.9rem;
    display: flex; align-items: center; gap: 10px;
    transition: 0.2s; cursor: pointer;
}
.board-menu-item:hover { background: #f0f0f0; }
.board-menu-item svg { color: #555; }
.board-menu-item.delete:hover { background: #fee2e2; color: var(--primary); }
.board-menu-item.delete:hover svg { color: var(--primary); }

/* LIGHTBOX / PIN DETAIL (PINTEREST STYLE) */
.lightbox { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.85); backdrop-filter: blur(15px); z-index: 9999; align-items: center; justify-content: center; padding: 20px; }
.lightbox.show { display: flex; }

.pin-container {
    background: #1e1e1e; width: 100%; max-width: 1000px; height: 90vh;
    border-radius: 32px; display: flex; overflow: hidden;
    box-shadow: 0 40px 100px rgba(0,0,0,0.8);
    border: 1px solid rgba(255,255,255,0.05);
}

.pin-image-side { flex: 1.2; background: #111; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.pin-image-side img { width: 100%; height: 100%; object-fit: contain; }

.pin-info-side { flex: 0.8; background: #1e1e1e; display: flex; flex-direction: column; padding: 35px; border-left: 1px solid rgba(255,255,255,0.05); }

.pin-top-actions { display: flex; justify-content: space-between; align-items: center; margin-bottom: 40px; }
.action-icons { display: flex; gap: 12px; }

.pin-content { flex-grow: 1; }
.album-tag { color: var(--primary); font-weight: 800; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 10px; display: block; }
.pin-content h1 { font-size: 2.2rem; font-weight: 800; color: white; line-height: 1.1; margin-bottom: 15px; }
.pin-description { color: var(--text-muted); font-size: 1rem; line-height: 1.6; margin-bottom: 30px; }

.user-info-pin { display: flex; align-items: center; gap: 15px; padding-top: 20px; border-top: 1px solid rgba(255,255,255,0.05); }
.user-avatar-circle { width: 48px; height: 48px; background: #e0b0ff; color: #4a148c; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 1.2rem; }
.user-name-pin strong { display: block; font-size: 1.1rem; color: white; }
.user-name-pin span { color: var(--text-muted); font-size: 0.9rem; }

.pin-footer { margin-top: auto; padding-top: 20px; }


@media (max-width: 900px) {
    .pin-container { flex-direction: column; height: auto; overflow-y: auto; }
    .pin-info-side { padding: 25px; }
}

/* TOAST NOTIFICATIONS */
.toast-container { position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%); z-index: 10000; display: flex; flex-direction: column; gap: 12px; pointer-events: none; }
.toast {
    background: #111; color: white; padding: 18px 32px; border-radius: 60px;
    font-weight: 800; box-shadow: 0 30px 60px rgba(0,0,0,0.6);
    border: 1px solid rgba(255,255,255,0.1); display: flex; align-items: center; gap: 14px;
    animation: toastUp 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275); pointer-events: auto;
    font-size: 1rem;
}
@keyframes toastUp { from { opacity: 0; transform: translateY(60px); } to { opacity: 1; transform: translateY(0); } }
.toast.fade-out { opacity: 0; transform: translateY(-20px); transition: 0.4s; }
.toast.success { border-bottom: 3px solid #10b981; }
.toast.error { border-bottom: 3px solid var(--primary); }

/* CUSTOM DIALOGS (Alert/Confirm) */
.custom-dialog-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.85); backdrop-filter: blur(25px);
    z-index: 999999; display: none; align-items: center; justify-content: center;
    animation: fadeIn 0.3s ease;
}
.custom-dialog-overlay.show { display: flex; }
.custom-dialog {
    background: #1a1a1a; border-radius: 40px; padding: 45px; width: 95%; max-width: 440px;
    text-align: center; border: 1px solid rgba(255,255,255,0.08); box-shadow: 0 50px 120px rgba(0,0,0,1);
    animation: scaleIn 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.custom-dialog h3 { font-size: 1.8rem; font-weight: 900; margin-bottom: 15px; color: white; }
.custom-dialog p { color: rgba(255,255,255,0.6); line-height: 1.7; margin-bottom: 35px; font-size: 1.1rem; }
.dialog-actions { display: flex; gap: 15px; }
.dialog-actions button { flex: 1; height: 60px; border-radius: 60px; font-weight: 800; border: none; cursor: pointer; transition: 0.3s; font-size: 1.1rem; }
.btn-cancel { background: rgba(255,255,255,0.08); color: white; }
.btn-cancel:hover { background: rgba(255,255,255,0.15); transform: scale(1.05); }
.btn-dialog-delete { background: var(--primary) !important; color: white !important; }
.btn-dialog-delete:hover { background: #ff1a1a !important; box-shadow: 0 15px 30px rgba(255, 0, 0, 0.3); transform: scale(1.05); }

/* Fix menu clickability */
.board-menu-item { pointer-events: auto !important; position: relative; z-index: 150; }
.pin-menu { pointer-events: auto !important; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes scaleIn { from { transform: scale(0.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }
