:root {
    /* Color Palette */
    --primary-color: #FF6B6B;      /* Coral Orange */
    --primary-hover: #ff5252;
    --secondary-color: #4ECDC4;    /* Sky Blue */
    --secondary-hover: #3bbaaf;
    --bg-color: #FAFAFA;           /* Off-white */
    --text-main: #2D3436;
    --text-muted: #636E72;
    --card-bg: #FFFFFF;
    --border-radius: 16px;
    --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.12);
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans TC', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Outfit', 'Noto Sans TC', sans-serif;
    font-weight: 700;
    line-height: 1.2;
}

/* Utilities */
.container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
}

.hidden {
    display: none !important;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 24px;
    border-radius: 50px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    border: none;
    outline: none;
    font-family: inherit;
    gap: 8px;
}

.btn:active {
    transform: scale(0.96);
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    box-shadow: 0 4px 14px rgba(255, 107, 107, 0.4);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.5);
    transform: translateY(-2px);
}

.btn-google {
    background-color: white;
    color: var(--text-main);
    border: 1px solid #E2E8F0;
    box-shadow: var(--shadow-sm);
}

.btn-google:hover {
    background-color: #F8FAFC;
    box-shadow: var(--shadow-md);
    border-color: #CBD5E1;
}

.google-icon {
    width: 18px;
    height: 18px;
}

.btn-outline {
    background-color: transparent;
    color: var(--text-main);
    border: 2px solid #E2E8F0;
}

.btn-outline:hover {
    border-color: var(--text-muted);
}

/* Navigation */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background-color: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 100;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    transition: all 0.3s ease;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 72px;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0px;
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--text-main);
    text-decoration: none;
    cursor: pointer;
}

.logo-icon {
    color: var(--primary-color);
    font-size: 1.8rem;
    transform: rotate(-10deg);
}

/* Navigation Links & Dropdown */
.nav-links {
    list-style: none;
    display: flex;
    align-items: center;
    margin: 0;
    padding: 0;
    flex: 1;
    margin-left: 40px;
}

.nav-item {
    position: relative;
}

.nav-link {
    color: var(--text-dark);
    text-decoration: none;
    font-weight: 600;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    transition: color var(--transition-fast);
    font-size: 1.05rem;
}

.nav-link:hover {
    color: var(--primary-color);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0; /* Left aligned like TibaMe */
    transform: translateY(10px);
    background: white;
    min-width: 320px;
    border-radius: 12px;
    box-shadow: 0 12px 48px rgba(0,0,0,0.12);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    z-index: 100;
    border: 1px solid rgba(0,0,0,0.04);
}

.nav-item.dropdown:hover .dropdown-menu,
.dropdown-menu.show,
.user-dropdown-menu.show {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0) !important;
    display: block !important;
}

@media (max-width: 768px) {
    .hide-mobile { display: none !important; }
    .show-mobile { display: block; }
    .show-mobile-flex { display: flex; }
    
    /* Consolidate hamburger into user menu */
    .nav-links { display: none !important; }
    .hamburger-btn { display: none !important; }

    /* Shrink login button on mobile */
    .btn-google {
        padding: 6px 12px;
        font-size: 0.8rem;
        gap: 5px;
    }
    .btn-google .google-icon {
        width: 14px;
        height: 14px;
    }
    .hide-mobile-text { display: none !important; }
}

.udm-mobile-only { display: none; }
@media (max-width: 768px) {
    .udm-mobile-only { display: flex; }
}

/* Invisible bridge to prevent hover gap issues */
.dropdown-menu::before {
    content: '';
    position: absolute;
    top: -20px;
    left: 0;
    right: 0;
    height: 20px;
}

.dropdown-content {
    padding: 24px;
}

.dropdown-title {
    font-size: 1.1rem;
    color: var(--primary-color);
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    font-weight: 700;
}

.poem p {
    margin: 0 0 8px 0;
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.8;
}

.poem .poem-highlight {
    margin-top: 16px;
    margin-bottom: 0;
    font-weight: 700;
    color: var(--secondary-color);
    font-size: 1.05rem;
}

/* Hero Section */
.hero-section {
    position: relative;
    padding: 160px 24px 100px;
    text-align: center;
    overflow: hidden;
    background: linear-gradient(135deg, rgba(255,250,250,1) 0%, rgba(240,248,255,0.5) 100%);
}

.hero-content {
    position: relative;
    z-index: 10;
    max-width: 800px;
    margin: 0 auto;
}

.hero-title {
    font-size: clamp(2.5rem, 5vw, 4.5rem);
    margin-bottom: 24px;
    background: linear-gradient(135deg, var(--primary-color), #FF8E8B);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    color: transparent;
    letter-spacing: -0.02em;
}

.hero-subtitle {
    font-size: clamp(1.1rem, 2vw, 1.25rem);
    color: var(--text-muted);
    margin-bottom: 40px;
    font-weight: 500;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.hero-decoration {
    position: absolute;
    border-radius: 50%;
    z-index: 1;
    filter: blur(60px);
    opacity: 0.4;
    animation: float 8s ease-in-out infinite alternate;
}

.dec-1 {
    width: 300px;
    height: 300px;
    background-color: var(--primary-color);
    top: 50px;
    left: -100px;
}

.dec-2 {
    width: 400px;
    height: 400px;
    background-color: var(--secondary-color);
    bottom: -100px;
    right: -100px;
    animation-delay: -3s;
}

.dec-3 {
    width: 200px;
    height: 200px;
    background-color: #FFD166; /* Accent yellow */
    top: 150px;
    right: 15%;
    animation-delay: -5s;
}

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(30px, -50px) scale(1.1); }
}

/* Gallery Section */
.gallery-section {
    padding: 40px 0 100px;
    min-height: 60vh;
}

.gallery-controls {
    margin-bottom: 40px;
    text-align: left;
}

.section-title {
    font-size: 2rem;
    color: var(--text-main);
    position: relative;
    display: inline-block;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    width: 40px;
    height: 4px;
    background-color: var(--secondary-color);
    border-radius: 4px;
}

/* ==========================================================================
   Carousel Section
   ========================================================================== */
.carousel-section {
    margin-bottom: 3rem;
}

.carousel-section.hidden {
    display: none;
}

.carousel-container {
    position: relative;
    width: 100%;
    padding: 20px 0; /* Add padding for shadows */
}

.carousel-track {
    display: flex;
    gap: 20px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    padding: 0 10%; /* Center the 80% slide */
    height: 440px;
    
    /* Hide scrollbar */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}

.carousel-track::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

.carousel-item {
    min-width: 80%; /* Active slide takes 80% of container */
    scroll-snap-align: center;
    position: relative;
    overflow: hidden;
    border-radius: 24px; /* TibaMe style rounded corners */
    box-shadow: var(--shadow-md);
    cursor: pointer;
    flex-shrink: 0;
}

.carousel-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.carousel-item-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.8));
    padding: 3rem 2rem 2rem;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.carousel-item-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.carousel-item-author {
    font-size: 1rem;
    opacity: 0.9;
}

.carousel-item-likes {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 107, 107, 0.9);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: 600;
}

.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: white;
    border: 1px solid #E2E8F0;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    font-size: 1.5rem;
    color: var(--secondary-color); /* Teal color */
    cursor: pointer;
    z-index: 10;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.carousel-btn:hover {
    color: white;
    background: var(--secondary-color);
    transform: translateY(-50%) scale(1.05);
}

.prev-btn { left: calc(10% - 28px); }
.next-btn { right: calc(10% - 28px); }

@media (max-width: 768px) {
    .carousel-section {
        padding-top: 80px !important;
    }
    .carousel-track { 
        height: 70vw; 
        max-height: 400px; 
        padding: 0; 
        gap: 0;
        width: 100%;
    }
    .carousel-item { 
        min-width: 100%; 
        width: 100%;
        flex: 0 0 100%;
        border-radius: 0; 
        background-color: #ffffff; /* Clean white background */
        display: flex;
        align-items: center;
        justify-content: center;
        position: relative;
        overflow: hidden;
    }
    .carousel-item img { 
        width: auto;
        height: auto;
        max-width: 92%; /* Slightly smaller for better shadow visibility */
        max-height: 90%;
        object-fit: contain; 
        position: relative;
        z-index: 1;
        box-shadow: 0 12px 36px rgba(0,0,0,0.15); /* 3D shadow */
        border-radius: 8px;
    }
    .carousel-btn { display: none; }
    .carousel-item-info { 
        padding: 2rem 1rem 1rem; 
        background: linear-gradient(transparent, rgba(0,0,0,0.6));
        width: 100%;
        box-sizing: border-box;
        z-index: 2;
    }
    .carousel-item-title { font-size: 1.1rem; margin-bottom: 2px; }
    .carousel-item-author { font-size: 0.8rem; }
    .carousel-item-likes { padding: 0.25rem 0.6rem; font-size: 0.75rem; }
}

.carousel-indicators {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 1rem;
}

.indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #CBD5E1;
    cursor: pointer;
    transition: var(--transition-fast);
}

.indicator.active {
    background: var(--primary-color);
    width: 24px;
    border-radius: 4px;
}

/* ==========================================================================
   Gallery Layout (CSS Grid)
   ========================================================================== */
.masonry-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
    width: 100%;
}

.artwork-card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: var(--transition-normal);
    cursor: pointer;
    position: relative;
    border: 1px solid rgba(0,0,0,0.03);
    display: flex;
    flex-direction: column;
}

.artwork-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
}

/* Custom tooltip for artwork description */
.artwork-card[data-tooltip] {
    position: relative;
}
.artwork-card[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    background: rgba(30,30,46,0.92);
    color: #fff;
    padding: 8px 14px;
    border-radius: 10px;
    font-size: 0.8rem;
    line-height: 1.4;
    max-width: 240px;
    white-space: pre-wrap;
    word-wrap: break-word;
    z-index: 100;
    pointer-events: none;
    animation: tooltipIn 0.2s ease-out;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
.artwork-card[data-tooltip]:hover::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-2px);
    border: 6px solid transparent;
    border-top-color: rgba(30,30,46,0.92);
    z-index: 100;
    pointer-events: none;
    animation: tooltipIn 0.2s ease-out;
}
@keyframes tooltipIn {
    from { opacity: 0; transform: translateX(-50%) translateY(-4px); }
    to { opacity: 1; transform: translateX(-50%) translateY(-8px); }
}

.card-image-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 4/3; /* Force horizontal thumbnails */
    overflow: hidden;
    background-color: #f1f5f9;
}

.card-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.artwork-card:hover .card-image {
    transform: scale(1.05);
}

/* Hover overlay */
.card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0) 50%);
    opacity: 0;
    transition: opacity var(--transition-fast);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 20px;
}

.artwork-card:hover .card-overlay {
    opacity: 1;
}

.card-title {
    color: white;
    font-size: 1.25rem;
    margin-bottom: 8px;
    transform: translateY(10px);
    transition: transform var(--transition-fast);
}

.artwork-card:hover .card-title {
    transform: translateY(0);
}

.card-info {
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid rgba(0,0,0,0.03);
}

.card-author {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: var(--text-main);
    font-weight: 500;
}

.author-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background-color: var(--secondary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.7rem;
}

.author-avatar-img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #E2E8F0;
}

.card-stats {
    display: flex;
    gap: 12px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.like-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 1.1rem;
    padding: 4px 8px;
    border-radius: 12px;
    transition: var(--transition-fast);
}

.like-btn:hover {
    background: rgba(255, 107, 107, 0.1);
    color: var(--primary-color);
}

.like-btn.liked {
    color: var(--primary-color);
}

.like-btn.liked i {
    animation: heartBeat 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes heartBeat {
    0% { transform: scale(1); }
    50% { transform: scale(1.4); }
    100% { transform: scale(1); }
}

/* ==========================================================================
   Manage Artworks Modal
   ========================================================================== */
.manage-modal-content {
    background: var(--card-bg);
    width: 100%;
    max-width: 700px;
    padding: 32px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    position: relative;
}

.manage-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-y: auto;
    padding-right: 8px;
    margin-top: 16px;
}

/* Custom Scrollbar for manage list */
.manage-list::-webkit-scrollbar {
    width: 6px;
}
.manage-list::-webkit-scrollbar-track {
    background: transparent;
}
.manage-list::-webkit-scrollbar-thumb {
    background: #CBD5E1;
    border-radius: 4px;
}

.manage-item {
    display: flex;
    align-items: center;
    background: #F8FAFC;
    border: 1px solid #E2E8F0;
    padding: 12px;
    border-radius: 12px;
    gap: 16px;
    transition: all var(--transition-fast);
}

.manage-item:hover {
    box-shadow: var(--shadow-sm);
    border-color: #CBD5E1;
}

.manage-item-img {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    object-fit: cover;
    background: #E2E8F0;
    flex-shrink: 0;
}

.manage-item-info {
    flex: 1;
    min-width: 0;
}

.manage-item-title {
    font-weight: 600;
    color: var(--text-dark);
    font-size: 1.1rem;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.manage-item-stats {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.manage-item-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.btn-edit {
    color: #3B82F6;
    border-color: #BFDBFE;
    background: white;
}
.btn-edit:hover {
    background: #EFF6FF;
    border-color: #3B82F6;
}

.btn-delete {
    color: #EF4444;
    border-color: #FECACA;
    background: white;
}
.btn-delete:hover {
    background: #FEF2F2;
    border-color: #EF4444;
}

.load-more-container {
    text-align: center;
    padding: 40px 0;
    width: 100%;
}

/* State Containers (Loading, Error) */
.loading-container, .error-container {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(78, 205, 196, 0.2);
    border-top-color: var(--secondary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

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

.error-icon {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 16px;
}

.error-container p {
    margin-bottom: 24px;
    font-size: 1.1rem;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

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

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.modal-content {
    position: relative;
    z-index: 1001;
    max-width: 90vw;
    max-height: 90vh;
    background: transparent;
    display: flex;
    flex-direction: column;
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal.active .modal-content {
    transform: scale(1);
}

.modal-image-container {
    max-height: 70vh;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.3);
}

#modal-image {
    max-width: 100%;
    max-height: 70vh;
    object-fit: contain;
    display: block;
    margin: 0 auto;
}

.modal-info {
    padding: 20px 0 0;
    color: white;
}

#modal-title {
    font-size: 1.5rem;
    margin-bottom: 8px;
}

.modal-meta {
    display: flex;
    gap: 16px;
    color: rgba(255,255,255,0.7);
    font-size: 0.95rem;
}

.modal-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.modal-close:hover {
    background: var(--primary-color);
}

/* Fallback mock data styles */
.mock-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(0,0,0,0.6);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: bold;
    z-index: 2;
    backdrop-filter: blur(4px);
}

/* Nav Actions & Auth Menu */
.nav-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.auth-user-menu {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.85rem;
}

/* ---- User Profile Dropdown ---- */
.user-profile-dropdown {
    position: relative;
}

.user-profile-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 12px 4px 4px;
    background-color: var(--card-bg);
    border: 1px solid #E2E8F0;
    border-radius: 50px;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: inherit;
}

.user-profile-btn:hover {
    border-color: var(--secondary-color);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    background-color: var(--secondary-color);
}

.user-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-main);
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 200px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.15);
    border: 1px solid rgba(0,0,0,0.06);
    padding: 8px 0;
    z-index: 200;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.2s ease;
}

.user-dropdown-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.udm-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    font-size: 0.9rem;
    color: var(--text-main);
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s;
}

.udm-item:hover {
    background: #F1F5F9;
}

.udm-item i {
    width: 18px;
    text-align: center;
    color: var(--secondary-color);
    font-size: 0.85rem;
}

.udm-divider {
    height: 1px;
    background: #E2E8F0;
    margin: 4px 0;
}

.udm-logout {
    color: #EF4444;
}

.udm-logout i {
    color: #EF4444;
}

/* ---- Notification Bell ---- */
.notif-bell-wrap {
    position: relative;
}
.notif-bell-btn {
    position: relative;
    width: 38px; height: 38px;
    border-radius: 50%;
    border: 1px solid #E2E8F0;
    background: white;
    color: var(--text-muted);
    font-size: 1.05rem;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.2s;
}
.notif-bell-btn:hover { border-color: var(--secondary-color); color: var(--secondary-color); }
.notif-badge {
    position: absolute; top: -4px; right: -4px;
    background: #EF4444; color: white;
    font-size: 0.6rem; font-weight: 800;
    min-width: 18px; height: 18px;
    border-radius: 10px; display: none;
    align-items: center; justify-content: center;
    padding: 0 4px; box-sizing: border-box;
    border: 2px solid white;
}
.notif-badge.has-count { display: flex; }
.notif-bell-btn.ringing { animation: bellRing 0.6s ease-in-out infinite; }
@keyframes bellRing {
    0%,100% { transform: rotate(0); }
    15% { transform: rotate(14deg); }
    30% { transform: rotate(-12deg); }
    45% { transform: rotate(8deg); }
    60% { transform: rotate(-6deg); }
    75% { transform: rotate(2deg); }
}
.notif-panel {
    position: absolute; top: 48px; right: 0;
    width: 360px; max-height: 440px;
    background: white; border-radius: 14px;
    box-shadow: 0 12px 36px rgba(0,0,0,.15);
    display: none; flex-direction: column;
    z-index: 1001; overflow: hidden;
    border: 1px solid #E2E8F0;
}
@media (max-width: 480px) {
    .notif-panel {
        position: fixed;
        top: 70px;
        left: 5%;
        right: 5%;
        width: 90%;
        max-width: none;
    }
}
.notif-panel.show { display: flex; }
.notif-panel-header {
    padding: 14px 16px; font-weight: 700;
    border-bottom: 1px solid #F1F5F9;
    display: flex; align-items: center; justify-content: space-between;
    font-size: 0.95rem;
}
.notif-panel-header .mark-all {
    font-size: 0.75rem; color: var(--secondary-color);
    cursor: pointer; font-weight: 600;
}
.notif-panel-header .mark-all:hover { text-decoration: underline; }
.notif-panel-body {
    overflow-y: auto; max-height: 360px; padding: 4px 0;
}
.notif-item {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 12px 16px; cursor: pointer;
    transition: background 0.15s; position: relative;
}
.notif-item:hover { background: #F8FAFC; }
.notif-item.unread { background: #F0F9FF; }
.notif-item.unread::before {
    content: ''; position: absolute; left: 6px; top: 50%; transform: translateY(-50%);
    width: 6px; height: 6px; border-radius: 50%; background: var(--primary-color);
}
.notif-item-avatar {
    width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
    background: var(--secondary-color); color: white;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.7rem; font-weight: 700; overflow: hidden;
}
.notif-item-avatar img { width: 100%; height: 100%; object-fit: cover; }
.notif-item-body { flex: 1; min-width: 0; }
.notif-item-text { font-size: 0.83rem; line-height: 1.4; color: var(--text-main); }
.notif-item-text strong { font-weight: 700; }
.notif-item-time { font-size: 0.7rem; color: var(--text-muted); margin-top: 2px; display: flex; align-items: center; gap: 8px; }
.notif-reply-btn { border: none; background: #F5F3FF; color: #8B5CF6; font-size: 0.7rem; font-weight: 600; padding: 2px 8px; border-radius: 6px; cursor: pointer; font-family: inherit; transition: all 0.2s; }
.notif-reply-btn:hover { background: #8B5CF6; color: white; }
.notif-item-type {
    font-size: 0.6rem; padding: 2px 6px; border-radius: 8px;
    font-weight: 700; flex-shrink: 0; margin-top: 2px;
}
.notif-item-type.report { background: #FEF2F2; color: #EF4444; }
.notif-item-type.message { background: #EFF6FF; color: #3B82F6; }
.notif-empty {
    text-align: center; padding: 40px 20px; color: var(--text-muted);
    font-size: 0.9rem;
}

/* ---- Hamburger for Mobile ---- */
.hamburger-btn {
    display: none;
    width: 40px;
    height: 40px;
    border: 1px solid #E2E8F0;
    border-radius: 8px;
    background: white;
    color: var(--text-main);
    font-size: 1.1rem;
    cursor: pointer;
    align-items: center;
    justify-content: center;
}

.btn-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid #E2E8F0;
    background: white;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.btn-icon:hover {
    background-color: #F8FAFC;
    color: var(--primary-color);
    border-color: #CBD5E1;
}

/* ---- Mobile Responsive Nav ---- */
@media (max-width: 768px) {
    .nav-container {
        height: 56px;
        padding: 0 12px;
    }

    .logo-text {
        font-size: 1.5rem;
    }

    .nav-links {
        display: none;
        position: fixed;
        top: 56px;
        left: 0;
        right: 0;
        background: white;
        box-shadow: 0 8px 24px rgba(0,0,0,0.1);
        flex-direction: column;
        padding: 8px 0;
        z-index: 99;
        margin-left: 0;
    }

    .nav-links.mobile-open {
        display: flex;
    }

    .nav-link {
        padding: 12px 20px;
        font-size: 1rem;
        border-bottom: 1px solid #F1F5F9;
    }

    .hamburger-btn {
        display: flex;
    }

    .hide-mobile-text {
        display: none;
    }

    .user-name {
        display: none;
    }

    .user-profile-btn {
        padding: 4px;
    }

    .user-profile-btn .fa-chevron-down {
        display: none;
    }

    .btn-sm {
        padding: 8px 12px;
    }

    .auth-user-menu {
        gap: 6px;
    }

    /* Improved Manage Artworks Mobile Layout */
    .manage-modal-content {
        padding: 20px 16px;
        max-width: 95%;
    }

    .manage-item {
        flex-direction: column;
        align-items: stretch;
        padding: 16px;
        gap: 12px;
    }

    .manage-item-img {
        width: 100%;
        height: 180px;
        border-radius: 12px;
    }

    .manage-item-info {
        text-align: left;
    }

    .manage-item-title {
        font-size: 1.2rem;
        margin-bottom: 8px;
        white-space: normal; /* Allow title to wrap on mobile if needed, or keep ellipsis */
    }

    .manage-item-stats {
        display: flex;
        align-items: center;
        gap: 12px;
        white-space: nowrap;
        font-size: 0.85rem;
    }

    .manage-item-date {
        margin-top: 4px;
        display: block;
    }

    .manage-item-actions {
        justify-content: flex-end;
        padding-top: 8px;
        border-top: 1px solid #F1F5F9;
    }

    .manage-item-actions .btn {
        flex: 1;
        max-width: 120px;
    }

    /* Stats Page Mobile Fix */
    .stats-grid {
        grid-template-columns: 1fr !important;
    }

    .stat-card {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 20px !important;
        text-align: left !important;
    }

    .stat-num {
        font-size: 1.8rem !important;
        margin-bottom: 0 !important;
        order: 2;
    }

    .stat-label {
        font-size: 1rem !important;
        order: 1;
    }
}

/* Upload Modal Specific Styles */
.upload-modal-content {
    background: var(--card-bg);
    width: 100%;
    max-width: 500px;
    padding: 32px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    overflow-y: auto;
    position: relative; /* ensure close btn positions inside */
}

/* Upload and Manage modal close button: inside the card, top-right */
.upload-modal-content .modal-close,
.manage-modal-content .modal-close {
    top: 14px;
    right: 14px;
    background: #F1F5F9;
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    font-size: 1rem;
    z-index: 2;
}
.upload-modal-content .modal-close:hover,
.manage-modal-content .modal-close:hover {
    background: var(--primary-color);
    color: white;
}

.upload-title {
    margin-bottom: 24px;
    margin-top: 4px; /* clearance for close button */
    font-size: 1.5rem;
    color: var(--text-main);
    text-align: center;
}

.upload-area {
    width: 100%;
    height: 240px;
    border: 2px dashed #CBD5E1;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background-color: #F8FAFC;
    transition: all var(--transition-fast);
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
}

@media (max-width: 768px) {
    .upload-modal-content { padding: 20px; }
    .upload-area { height: 180px; }
}

.upload-area:hover, .upload-area.dragover {
    border-color: var(--secondary-color);
    background-color: rgba(78, 205, 196, 0.05);
}

.upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    color: var(--text-muted);
    pointer-events: none;
}

.upload-placeholder i {
    font-size: 2.5rem;
    color: #94A3B8;
}

.upload-preview {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background-color: #F1F5F9;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 32px;
}

.input-group label {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-main);
}

.input-group input {
    padding: 12px 16px;
    border: 1px solid #CBD5E1;
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.input-group input:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(78, 205, 196, 0.2);
}

.upload-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.upload-actions .btn {
    padding: 10px 20px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* ==========================================================================
   Tool Tags and Filters
   ========================================================================== */
.tag-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
    align-items: center;
}

.tag-btn {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.9rem;
    background: white;
    color: var(--text-main);
    border: 1px solid #E2E8F0;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.tag-btn:hover {
    background: #F8FAFC;
    border-color: #CBD5E1;
}

.tag-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(255, 107, 107, 0.3);
}

.artwork-tool-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 12px;
    z-index: 5;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    pointer-events: none;
    letter-spacing: 0.3px;
}

/* ==========================================================================
   Leaderboard
   ========================================================================== */
.leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.leaderboard-item {
    display: flex; align-items: center; padding: 14px;
    background: white; border-radius: 16px;
    border: 1px solid #F1F5F9;
    box-shadow: var(--shadow-sm); 
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    cursor: pointer;
    position: relative;
}
.leaderboard-item:hover, .creator-card:hover, .stat-card:hover {
    transform: translateY(-6px) scale(1.02);
    box-shadow: 0 15px 35px rgba(0,0,0,0.12);
    border-color: var(--secondary-color);
    z-index: 5;
}
.leaderboard-item:active, .creator-card:active, .stat-card:active {
    transform: translateY(2px) scale(0.97);
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.1);
}

.lb-rank {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.85rem;
    margin-right: 12px;
    flex-shrink: 0;
    background: #E2E8F0;
    color: var(--text-muted);
}

.lb-rank.rank-1 {
    background: linear-gradient(135deg, #FFD700, #FDB931);
    color: white;
    box-shadow: 0 2px 6px rgba(253, 185, 49, 0.4);
}

.lb-rank.rank-2 {
    background: linear-gradient(135deg, #E2E8F0, #94A3B8);
    color: white;
    box-shadow: 0 2px 6px rgba(148, 163, 184, 0.4);
}

.lb-rank.rank-3 {
    background: linear-gradient(135deg, #F59E0B, #B45309);
    color: white;
    box-shadow: 0 2px 6px rgba(180, 83, 9, 0.4);
}

.lb-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1rem;
    margin-right: 12px;
    flex-shrink: 0;
}

.lb-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.lb-info {
    flex: 1;
    min-width: 0;
}

.lb-name {
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lb-artwork-title {
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lb-score {
    font-weight: bold;
    color: var(--primary-color);
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Footer Centering */
.app-footer {
    text-align: center !important;
}
.app-footer div {
    margin: 0 auto !important;
}
