:root {
    /* Runa Rebranded Palette */
    --primary-color: #8b5cf6; /* Violet 500 */
    --primary-gradient: linear-gradient(135deg, #8b5cf6 0%, #ec4899 100%);
    --primary-hover: #7c3aed; 
    
    --secondary-color: #64748b; /* Slate 500 */
    --success-color: #10b981; /* Emerald 500 */
    --success-gradient: linear-gradient(135deg, #34d399 0%, #059669 100%);
    --danger-color: #ef4444; /* Red 500 */
    --danger-gradient: linear-gradient(135deg, #f87171 0%, #dc2626 100%);
    
    --background-color: #f8fafc; /* Slate 50 */
    --surface-color: #ffffff;
    
    --text-main: #0f172a; /* Slate 900 */
    --text-muted: #64748b; /* Slate 500 */
    --border-color: #e2e8f0; /* Slate 200 */
    
    --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 10px 25px -5px rgb(0 0 0 / 0.05), 0 8px 10px -6px rgb(0 0 0 / 0.05);
    --shadow-lg: 0 20px 40px -10px rgba(15, 23, 42, 0.02); /* Ultra-subtle large radius shadow */
    --shadow-xl: 0 25px 50px -12px rgba(15, 23, 42, 0.08);
    
    --radius: 1.5rem; /* Increased radius for soft minimalism */
    --font-sans: 'Plus Jakarta Sans', system-ui, sans-serif;
    --font-display: 'Outfit', sans-serif;

    /* Runa Branded Mesh Gradient - Purple/Pink Focus */
    --mesh-gradient: radial-gradient(at 40% 20%, #8b5cf6 0px, transparent 50%),
        radial-gradient(at 80% 0%, #ec4899 0px, transparent 50%),
        radial-gradient(at 0% 50%, #d946ef 0px, transparent 50%),
        radial-gradient(at 80% 50%, #6366f1 0px, transparent 50%),
        radial-gradient(at 0% 100%, #8b5cf6 0px, transparent 50%),
        radial-gradient(at 80% 100%, #ec4899 0px, transparent 50%),
        radial-gradient(at 0% 0%, #f43f5e 0px, transparent 50%);
}

/* DARK THEME CLASS */
.dark {
    --background-color: #020617; /* Slate 950 */
    --surface-color: #0f172a;    /* Slate 900 */
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border-color: #1e293b;
    
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.5);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.5), 0 2px 4px -2px rgb(0 0 0 / 0.5);
    --shadow-lg: 0 20px 25px -5px rgb(0 0 0 / 0.5);
    --shadow-xl: 0 25px 50px -12px rgb(0 0 0 / 0.7);
}

/* Logo Toggles */
.dark-only { display: none; }
.dark .dark-only { display: block; }
.dark .light-only { display: none; }

.logo-text {
    font-family: 'Outfit', sans-serif;
    letter-spacing: -0.02em;
    display: inline-flex;
    align-items: baseline;
}

.brand-runa {
    font-weight: 700;
    color: #1e293b; /* Dark Slate (Slate-800) */
}

.brand-list {
    font-weight: 300;
    color: #64748b; /* Muted Blue-Grey (Slate-500) */
}

.dark .brand-runa { color: #f8fafc; } /* White/Slate-50 */
.dark .brand-list { color: #94a3b8; } /* Light Grey/Slate-400 */

body {
    font-family: var(--font-sans);
    background-color: var(--background-color);
    background-image: radial-gradient(at top left, #f5f3ff 0%, transparent 40%), radial-gradient(at top right, #f1f5f9 0%, transparent 40%);
    background-attachment: fixed;
    color: var(--text-main);
    margin: 0;
    padding: 0;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.3s, color 0.3s;
}

.dark body {
    background-image: radial-gradient(at top left, #1e1b4b 0%, transparent 40%), radial-gradient(at top right, #020617 0%, transparent 40%);
}

/* Navbar */
nav {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.dark nav {
    background: rgba(15, 23, 42, 0.8);
    border-bottom-color: rgba(255, 255, 255, 0.05);
}

nav a.brand {
    font-weight: 800;
    font-size: 1.5rem;
    text-decoration: none;
    letter-spacing: -0.03em;
}

.logo-branded {
    background: var(--mesh-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
    font-family: var(--font-display);
    font-weight: 800;
}

.logo-branded .material-symbols-rounded {
    color: #f97316;
}

nav .nav-links {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

nav a {
    color: var(--text-main);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.2s;
}

nav a:not(.brand):not(.logo-branded):hover {
    color: var(--primary-color);
    transform: translateY(-1px);
}

/* User Dropdown */
.nav-user-dropdown {
    position: relative;
    display: inline-block;
}

.nav-user-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: transparent;
    border: none;
    padding: 0.5rem;
    border-radius: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-main);
    font-family: inherit;
    font-weight: 600;
    font-size: 0.85rem;
}

.nav-user-btn:hover {
    background: rgba(0, 0, 0, 0.03);
}

.dark .nav-user-btn:hover {
    background: rgba(255, 255, 255, 0.05);
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    min-width: 200px;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    box-shadow: var(--shadow-xl);
    padding: 0.5rem;
    z-index: 1001;
    backdrop-filter: blur(16px);
    animation: modalPop 0.2s ease-out;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    color: var(--text-main);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
}

.dropdown-item:hover {
    background: rgba(0, 0, 0, 0.03);
    color: var(--primary-color) !important;
}

.dark .dropdown-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.dropdown-item .material-symbols-rounded {
    font-size: 1.25rem;
    color: var(--text-muted);
}

.dropdown-item:hover .material-symbols-rounded {
    color: var(--primary-color);
}

.dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 0.5rem;
}

.text-danger {
    color: #ef4444 !important;
}

.text-danger .material-symbols-rounded {
    color: #ef4444 !important;
}

.text-danger:hover {
    background: rgba(239, 68, 68, 0.05) !important;
}

/* Layout */
.container {
    max-width: 1400px;
    margin: 3rem auto;
    padding: 0 1.5rem;
}

h1, h2, h3 {
    color: var(--text-main);
    margin-top: 0;
    letter-spacing: -0.03em;
    font-family: var(--font-display);
    font-weight: 800;
}

h1 { font-size: 3rem; margin-bottom: 2rem; line-height: 1; }
h2 { font-size: 2rem; margin-bottom: 1.5rem; font-weight: 700; }
h3 { font-size: 1.25rem; margin-bottom: 0.5rem; font-weight: 600; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 1.25rem;
    border: none;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
}

.btn-primary { 
    background: var(--primary-gradient); 
    color: white; 
    box-shadow: 0 4px 6px -1px rgba(99, 102, 241, 0.3);
}

.btn-secondary { 
    background-color: white; 
    color: var(--text-main); 
    border: 1px solid var(--border-color);
}

.dark .btn-secondary { background-color: #1e293b; color: #f8fafc; border-color: #334155; }

.btn-danger { background: var(--danger-gradient); color: white; }
.btn-success { background: var(--success-gradient); color: white; }

/* Icon Buttons */
.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.4rem;
    border-radius: 0.5rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    background: transparent;
}

.btn-icon:hover {
    background: rgba(0, 0, 0, 0.03);
}

.dark .btn-icon:hover {
    background: rgba(255, 255, 255, 0.05);
}

.btn-secondary-soft {
    color: var(--text-muted);
}

.btn-secondary-soft:hover {
    background: rgba(0, 0, 0, 0.05) !important;
    color: var(--text-main);
}

.dark .btn-secondary-soft:hover {
    background: rgba(255, 255, 255, 0.1) !important;
}

.btn-danger-soft {
    color: #ef4444;
}

.btn-danger-soft:hover {
    background: rgba(239, 68, 68, 0.1) !important;
}

/* Forms */
.form-group { margin-bottom: 1.5rem; }
.form-group label { display: block; margin-bottom: 0.5rem; font-weight: 600; font-size: 0.85rem; color: var(--text-muted); }
.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1.5px solid var(--border-color);
    border-radius: 1rem;
    font-size: 1rem;
    box-sizing: border-box;
    transition: all 0.2s ease;
    background-color: #fff;
    color: var(--text-main);
    outline: none;
}

.dark .form-control {
    background-color: #020617;
    color: #f8fafc;
    border-color: #334155;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

/* Cards & Grid */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
}

.bento-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    grid-auto-rows: minmax(240px, auto);
    grid-auto-flow: dense;
    gap: 1.5rem;
}

.bento-large {
    grid-column: span 2;
    grid-row: span 2;
}

/* Bento Masonry Spanning */
.span-2x2 { grid-column: span 2; grid-row: span 2; }
.span-2x1 { grid-column: span 2; grid-row: span 1; }
.span-1x2 { grid-column: span 1; grid-row: span 2; }

/* Gift Card Bento Internals */
.gift-card-bento {
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    height: 100%;
    box-sizing: border-box;
    position: relative;
    gap: 1rem;
}

/* Hero Cards (2x2) should stack vertically: Image top, Info bottom */
.span-2x2 .gift-card-bento {
    flex-direction: column;
}

/* Wide Cards Layout (2x1) keep horizontal */
.span-2x1 .gift-card-bento {
    flex-direction: row;
    gap: 1.5rem;
}

.gift-img-container {
    background: #f1f5f9;
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    width: 100%;
    height: 160px; /* Reduced from 200px */
    flex-shrink: 0;
}

.gift-img-container img {
    max-width: 85%;
    max-height: 85%;
    object-fit: contain;
    border-radius: 0.5rem;
}

/* Specific heights for different bento shapes */
.span-1x2 .gift-img-container { height: 320px; } /* Fixed height instead of 100% */
.span-2x1 .gift-img-container { width: 40%; height: 100%; min-height: 140px; }
.span-2x2 .gift-img-container { height: 340px; } /* Slightly taller for hero */

.gift-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    width: 100%;
    min-height: min-content;
    flex-shrink: 0; /* Never shrink info */
}

.gift-info-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 0.5rem;
    width: 100%;
}

.gift-meta {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    flex-shrink: 0; /* Don't allow meta to compress */
}

.status-pill {
    padding: 0.25rem 0.75rem;
    border-radius: 2rem;
    font-weight: 700;
    font-size: 0.65rem; /* Slightly smaller */
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    white-space: nowrap;
}

.status-pill.available { background: #ecfdf5; color: #059669; }
.status-pill.purchased { background: #fef2f2; color: #dc2626; }

/* Management Actions (Owner only) */
.gift-actions-top {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: flex;
    flex-direction: column; /* Vertical alignment */
    gap: 0.25rem;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(8px);
    padding: 0.25rem;
    border-radius: 0.75rem;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.2s ease;
    border: 1px solid var(--border-color);
}

.card:hover .gift-actions-top {
    opacity: 1; /* Show on hover */
}

/* Dashboard List Card Refinements */
.list-card-bento {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    position: relative;
}

/* Horizontal variation for wide/large dashboard cards */
.span-2x1 .list-card-bento, 
.span-2x2 .list-card-bento {
    flex-direction: row;
    gap: 2rem;
    align-items: center;
}

.span-2x1 .list-card-body,
.span-2x2 .list-card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Management Control Stack (Owner only) */
.list-controls {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(8px);
    padding: 0.25rem;
    border-radius: 0.75rem;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
    border: 1px solid var(--border-color);
    transform: translateX(10px);
}

.card:hover .list-controls {
    opacity: 1;
    transform: translateX(0);
}

/* Refined Image Fan/Stack */
.image-stack-organic {
    position: relative;
    width: 120px;
    height: 120px;
    flex-shrink: 0;
}

.image-stack-organic img {
    position: absolute;
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 1rem;
    border: 3px solid white;
    box-shadow: var(--shadow-md);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.dark .image-stack-organic img { border-color: var(--surface-color); }

.image-stack-organic img:nth-child(1) { z-index: 3; top: 0; left: 0; transform: rotate(-4deg); }
.image-stack-organic img:nth-child(2) { z-index: 2; top: 10px; left: 20px; transform: rotate(6deg); }
.image-stack-organic img:nth-child(3) { z-index: 1; top: 20px; left: 40px; transform: rotate(-8deg); }

.card:hover .image-stack-organic img:nth-child(1) { transform: translate(-10px, -5px) rotate(-12deg); }
.card:hover .image-stack-organic img:nth-child(2) { transform: translate(5px, -8px) rotate(10deg); }
.card:hover .image-stack-organic img:nth-child(3) { transform: translate(20px, 5px) rotate(-15deg); }

/* Quick Add for Dashboard */
.list-quick-add {
    margin-top: 1.5rem;
    display: flex;
    gap: 0.5rem;
}

.card {
    background: var(--surface-color);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    border: none;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Dashboard Specific Info-Dense Layout */
.list-card-fan {
    position: absolute;
    right: -1.5rem;
    top: 1.5rem;
    width: 140px;
    height: 140px;
    pointer-events: none;
}

.fan-item {
    position: absolute;
    width: 100px;
    height: 100px;
    border-radius: 1.25rem;
    border: 3px solid white;
    box-shadow: var(--shadow-md);
    object-fit: cover;
    background: #f1f5f9;
}

.fan-item:nth-child(1) { z-index: 3; transform: rotate(5deg); top: 0; right: 2rem; }
.fan-item:nth-child(2) { z-index: 2; transform: rotate(-8deg); top: 0.5rem; right: 3.5rem; }
.fan-item:nth-child(3) { z-index: 1; transform: rotate(-15deg); top: 1rem; right: 5rem; }

.card:hover .fan-item:nth-child(1) { transform: rotate(12deg) translate(5px, -5px); }
.card:hover .fan-item:nth-child(2) { transform: rotate(-2deg) translate(-5px, -8px); }

.list-avatars {
    display: flex;
    margin-left: 0.5rem;
}

.list-avatars .avatar {
    border: 2px solid white;
    margin-left: -0.5rem;
}

.dark .fan-item { border-color: var(--surface-color); }
.dark .list-avatars .avatar { border-color: var(--surface-color); }

/* Integrated Quick Add */
.card-quick-add {
    margin-top: 3.5rem;
    background: var(--background-color);
    border: 1.5px solid var(--border-color);
    border-radius: 2rem;
    padding: 0.4rem 0.4rem 0.4rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

.card-quick-add:focus-within {
    border-color: var(--vibe-color, var(--primary-color));
    background: white;
}

.card-quick-add input {
    flex: 1;
    border: none;
    background: transparent;
    outline: none;
    font-size: 0.85rem;
    color: var(--text-main);
    font-family: inherit;
}

.card-quick-add button {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: var(--vibe-color, var(--primary-color));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

/* Dynamic Vibe Glow on Hover */
.card:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 40px -10px var(--vibe-glow, rgba(15, 23, 42, 0.1));
}

.dark .card { background: #0f172a; box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5); }

.dark .card:hover {
    box-shadow: 0 20px 40px -10px var(--vibe-glow, rgba(0, 0, 0, 0.7));
}

/* Vibe Header for detail page */
.vibe-banner {
    height: 8px;
    width: 100%;
    background: var(--vibe-color, var(--primary-gradient));
    margin-bottom: 2rem;
    border-radius: 10px;
    opacity: 0.8;
}

/* Bento Large Internal Layout */
.bento-large .bento-body { display: flex; gap: 2rem; flex-grow: 1; }
.bento-large .bento-info { flex: 1.2; display: flex; flex-direction: column; }
.bento-large .bento-gallery { flex: 1; display: flex; flex-direction: column; gap: 0.75rem; }
.bento-large .hero-image { width: 100%; height: 200px; object-fit: cover; border-radius: 1rem; }
.bento-large .thumb-strip { display: flex; gap: 0.5rem; overflow: hidden; }
.bento-large .thumb-strip img { width: 48px; height: 48px; object-fit: cover; border-radius: 0.5rem; border: 2px solid white; }

/* Image Stack Preview */
.image-stack { position: relative; width: 80px; height: 80px; flex-shrink: 0; }
.image-stack-item { position: absolute; width: 64px; height: 64px; object-fit: cover; border-radius: 8px; border: 2px solid white; box-shadow: var(--shadow-sm); transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
.dark .image-stack-item { border-color: var(--border-color); }
.image-stack-item:nth-child(1) { z-index: 3; top: 0; left: 0; }
.image-stack-item:nth-child(2) { z-index: 2; top: 8px; left: 8px; transform: rotate(4deg); }
.image-stack-item:nth-child(3) { z-index: 1; top: 16px; left: 16px; transform: rotate(-4deg); }
.card:hover .image-stack-item:nth-child(2) { transform: translate(12px, -4px) rotate(8deg); }
.card:hover .image-stack-item:nth-child(3) { transform: translate(24px, 4px) rotate(-8deg); }

/* Progress Bar */
.progress-container { width: 100%; height: 6px; background: #f1f5f9; border-radius: 10px; overflow: hidden; margin-top: 1.5rem; }
.dark .progress-container { background: #1e293b; }
.progress-bar { height: 100%; background: var(--mesh-gradient); width: 0; transition: width 1s ease-out; }

/* Quick Add */
.quick-add-container { margin-top: 2rem; display: flex; align-items: center; background: #f8fafc; border: 1px solid var(--border-color); padding: 0.4rem; border-radius: 3rem; }
.dark .quick-add-container { background: #020617; }
.quick-add-input { flex-grow: 1; background: transparent; border: none; padding: 0.5rem 1rem; font-size: 0.9rem; outline: none; color: var(--text-main); }
.quick-add-btn { width: 32px; height: 32px; border-radius: 50%; background: var(--primary-color); color: white; border: none; display: flex; align-items: center; justify-content: center; cursor: pointer; }

/* Modals */
.modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(15, 23, 42, 0.4); backdrop-filter: blur(20px); z-index: 2000; display: flex; justify-content: center; align-items: center; }
.modal-content { background: rgba(255, 255, 255, 0.85); backdrop-filter: blur(10px); padding: 3rem; border-radius: 2rem; width: 90%; max-width: 520px; box-shadow: var(--shadow-xl); border: 1px solid rgba(255, 255, 255, 0.5); animation: modalPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1); }
.dark .modal-content { background: rgba(15, 23, 42, 0.8); border-color: rgba(255, 255, 255, 0.05); }

@keyframes modalPop { from { transform: scale(0.95) translateY(20px); opacity: 0; } to { transform: scale(1) translateY(0); opacity: 1; } }

/* Toast Notifications */
#toast-container { position: fixed; top: 1.5rem; left: 50%; transform: translateX(-50%); z-index: 9999; display: flex; flex-direction: column; gap: 0.75rem; pointer-events: none; }
.toast { background: var(--primary-color); color: white; padding: 0.85rem 1.75rem; border-radius: 50px; font-weight: 600; box-shadow: var(--shadow-xl); display: flex; align-items: center; gap: 0.5rem; pointer-events: auto; animation: toastEnter 0.3s cubic-bezier(0.16, 1, 0.3, 1); border: 1px solid rgba(255,255,255,0.1); backdrop-filter: blur(8px); }
.toast-success { background: var(--accent-color); color: var(--primary-color); }
@keyframes toastEnter { from { transform: translateY(-1rem); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.toast.fade-out { animation: toastExit 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
@keyframes toastExit { from { transform: translateY(0); opacity: 1; } to { transform: translateY(-1rem); opacity: 0; } }

.sortable-ghost {
    opacity: 0.4;
    border: 2px dashed var(--primary-color) !important;
}

.card:hover .drag-handle {
    opacity: 0.8 !important;
}

/* Animations & Motion */
@keyframes springIn { 0% { opacity: 0; transform: translateY(20px) scale(0.95); } 70% { opacity: 1; transform: translateY(-2px) scale(1.01); } 100% { opacity: 1; transform: translateY(0) scale(1); } }
.animate-in { animation: springIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both; }

/* Utilities */
.glass-pill { background: rgba(255, 255, 255, 0.6); backdrop-filter: blur(12px); border: 1px solid rgba(255, 255, 255, 0.4); padding: 0.25rem 0.75rem; border-radius: 2rem; font-size: 0.75rem; font-weight: 700; color: #0f172a; display: flex; align-items: center; gap: 0.25rem; }
.dark .glass-pill { background: rgba(255, 255, 255, 0.05); border-color: rgba(255, 255, 255, 0.1); color: #f8fafc; }
.hidden { display: none !important; }
.link-danger { color: #ef4444; font-size: 0.8rem; text-decoration: none; cursor: pointer; display: inline-flex; align-items: center; }
.link-muted { color: var(--text-muted); font-size: 0.8rem; text-decoration: none; cursor: pointer; display: inline-flex; align-items: center; }
.badge { display: inline-flex; align-items: center; padding: 0.4rem 1rem; font-size: 0.75rem; font-weight: 700; border-radius: 2rem; text-transform: uppercase; background: var(--success-gradient); color: white; }

/* Vibe Picker */
.vibe-swatch {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    border: 3px solid transparent;
}

.vibe-swatch:hover {
    transform: scale(1.15);
}

.vibe-swatch.active {
    border-color: white;
    box-shadow: 0 0 0 2px var(--primary-color), var(--shadow-md);
}

.dark .vibe-swatch.active {
    border-color: #0f172a;
    box-shadow: 0 0 0 2px white, var(--shadow-md);
}

/* Avatars */
.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
    color: white;
    text-transform: uppercase;
    flex-shrink: 0;
    user-select: none;
    box-shadow: var(--shadow-sm);
}

.avatar-sm { width: 24px; height: 24px; font-size: 0.65rem; }
.avatar-lg { width: 48px; height: 48px; font-size: 1.1rem; }

/* Onboarding */
.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: #f3f4f6;
    background-image: var(--mesh-gradient);
    background-size: cover;
    padding: 1rem;
}

.dark .login-page {
    background-color: #020617;
}

.login-container {
    background: var(--surface-color);
    padding: 3rem;
    border-radius: 2rem;
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 440px;
}

/* Masonry Grid (JS-Assisted) */
.masonry-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(440px, 1fr));
    grid-auto-rows: 10px; /* Fine-grained rows for spanning */
    gap: 0; /* Gap handled by logic or internal padding */
    column-gap: 2rem; /* Restore horizontal gap */
}

.masonry-item {
    width: auto;
    margin-bottom: 2rem; /* Visual bottom gap */
    display: flex;
    flex-direction: column;
}

/* Tooltips */
[data-tooltip] {
    position: relative;
    cursor: help;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: #1e293b;
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: normal;
    width: 200px;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
    box-shadow: var(--shadow-lg);
    line-height: 1.4;
    text-transform: none;
    letter-spacing: normal;
}

[data-tooltip]:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Tooltip Arrow */
[data-tooltip]::before {
    content: '';
    position: absolute;
    bottom: 110%;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    border: 6px solid transparent;
    border-top-color: #1e293b;
    opacity: 0;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
}

[data-tooltip]:hover::before {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.dark [data-tooltip]::after {
    background: #334155;
}
.dark [data-tooltip]::before {
    border-top-color: #334155;
}

/* RESPONSIVE */
@media (max-width: 1024px) {
    .masonry-grid {
        column-count: 2;
    }
}

@media (max-width: 768px) {
    /* Switch to flex stack on mobile for stability */
    .masonry-grid {
        display: flex !important;
        flex-direction: column !important;
        gap: 1.5rem !important;
        height: auto !important; /* Override any potential JS height */
    }
    
    .masonry-item {
        margin-bottom: 0; /* Flex gap handles spacing */
        min-height: auto !important;
    }
    
    .bento-large { grid-column: span 1; grid-row: span 1; }
    .bento-large .bento-body { flex-direction: column; }
    .bento-large .bento-gallery { display: none; }
    .hide-mobile { display: none !important; }
    .btn { padding: 0.6rem !important; min-width: 40px; }
    nav { padding: 0.75rem 1rem !important; }
    nav .tagline { display: none; }

    .gift-card-bento {
        flex-direction: column !important; /* Stack image on top of text */
        padding: 1.5rem !important;
        gap: 1rem;
        width: 100%;
    }

    .gift-img-container {
        width: 100% !important;
        height: auto !important;
        min-height: 180px;
        max-height: 300px;
    }
    
    .gift-meta {
        align-items: center;
        flex-direction: row;
        justify-content: flex-end;
    }
    
    .card {
        padding: 0; 
        min-height: auto;
    }
}
@media (max-width: 600px) {
    .login-page { 
        padding: 0 !important; 
        background-image: var(--mesh-gradient) !important; 
        display: flex !important; 
        align-items: stretch; /* Stretch to fill height */
    }
    .login-container { 
        width: 100%; 
        max-width: 100%; 
        min-height: 100vh; /* Fill full height */
        border-radius: 0 !important; /* Sharp corners for full screen feel */
        margin: 0; 
        border: none; 
        box-shadow: none; 
        padding: 2rem 1.5rem; /* Reduced top padding */
        display: flex;
        flex-direction: column;
        justify-content: flex-start; /* Move content to top */
        background: var(--surface-color);
    }
    .login-container > div:first-child {
        margin-bottom: 1.5rem !important; /* Reduce whitespace under logo/tagline */
    }
    .branded-title { background: var(--mesh-gradient) !important; -webkit-background-clip: text !important; -webkit-text-fill-color: transparent !important; }
}
