@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Poppins:wght@600;700;800&display=swap');

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

:root {
    --primary: #1e40af;
    --primary-hover: #1e3a8a;
    --gradient-blue: linear-gradient(135deg, #3b82f6 0%, #1e40af 100%);
    --gradient-purple: linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%);
    --gradient-cyan: linear-gradient(135deg, #06b6d4 0%, #3b82f6 100%);
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --border: #e2e8f0;
    --border-light: rgba(255, 255, 255, 0.8);
    --border-dark: rgba(0, 0, 0, 0.08);
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow: 0 2px 4px -1px rgba(0, 0, 0, 0.06), 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 8px -2px rgba(0, 0, 0, 0.1), 0 6px 10px -3px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.5;
    position: relative;
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}

body::before,
body::after {
    content: '';
    position: fixed;
    border-radius: 50%;
    filter: blur(80px);
    z-index: -1;
    pointer-events: none;
}

body::before {
    width: 500px;
    height: 500px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    top: -250px;
    right: -100px;
    opacity: 0.25;
    animation: float-1 20s ease-in-out infinite;
}

body::after {
    width: 600px;
    height: 600px;
    background: linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%);
    bottom: -300px;
    left: -150px;
    opacity: 0.22;
    animation: float-2 25s ease-in-out infinite;
}

.container::before {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    background: linear-gradient(135deg, #06b6d4 0%, #3b82f6 100%);
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.2;
    top: 40%;
    right: -100px;
    z-index: -1;
    pointer-events: none;
    animation: float-3 18s ease-in-out infinite;
}

@keyframes float-1 {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }
    33% {
        transform: translate(30px, -20px) scale(1.05);
    }
    66% {
        transform: translate(-20px, 30px) scale(0.95);
    }
}

@keyframes float-2 {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }
    33% {
        transform: translate(-40px, 30px) scale(1.08);
    }
    66% {
        transform: translate(25px, -25px) scale(0.92);
    }
}

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

.site-header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.03), inset 0 -1px 0 var(--border-light);
    padding: 1.5rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    box-sizing: border-box;
}

.site-logo {
    font-family: 'Poppins', sans-serif;
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: var(--gradient-blue);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-decoration: none;
    transition: all 0.3s ease;
}

.site-logo:hover {
    letter-spacing: 0px;
    transform: scale(1.02);
}

.header-nav {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.header-nav a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9375rem;
    transition: color 0.2s;
}

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

/* Header nav buttons should keep button text color */
.header-nav a.btn {
    color: #fff;
}

.header-nav a.btn:hover {
    color: #fff;
}

.upload-btn-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    background: var(--gradient-blue);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3), 0 1px 2px rgba(30, 64, 175, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.2), inset 0 -1px 0 rgba(0, 0, 0, 0.1);
    position: relative;
}

.upload-btn-header:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1e3a8a 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4), 0 2px 4px rgba(30, 64, 175, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.3), inset 0 -1px 0 rgba(0, 0, 0, 0.15);
}

.upload-btn-header:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(59, 130, 246, 0.3), inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.upload-btn-header i {
    font-size: 1rem;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 0 6rem;
    position: relative;
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
}

.gallery-header {
    margin-bottom: 2rem;
    padding: 3rem 2rem;
    text-align: center;
}

.gallery-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.gallery-stats {
    color: var(--text-secondary);
    font-size: 1rem;
}

.gallery-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0;
    margin: 0;
    width: 100%;
    box-sizing: border-box;
    transition: all 0.3s ease;
}

.photo-card {
    background: var(--bg-primary);
    border: none;
    border-radius: 0;
    overflow: hidden;
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
    aspect-ratio: 1 / 1;
    flex: 0 0 20%; /* Default 5 columns */
    max-width: 20%;
}

.photo-card:hover {
    transform: scale(0.98);
    z-index: 1;
}

.photo-img-wrapper {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--bg-secondary);
    position: relative;
}

.photo-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.photo-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(30, 64, 175, 0) 0%, rgba(30, 64, 175, 0.95) 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    color: white;
    pointer-events: none;
}

.overlay-icon {
    font-size: 3rem;
    margin-bottom: 0.5rem;
    transform: scale(0.8);
    transition: transform 0.3s ease;
}

.overlay-text {
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.photo-card:hover .photo-img {
    transform: scale(1.08);
}

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

.photo-card:hover .overlay-icon {
    transform: scale(1);
}

/* Photo info styles (used in lightbox modal) */
.photo-uploader {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.uploader-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--gradient-purple);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3), 0 1px 3px rgba(139, 92, 246, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.3), inset 0 -1px 0 rgba(0, 0, 0, 0.15);
}

.uploader-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9375rem;
}

.photo-caption {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 0.75rem;
    line-height: 1.5;
}

.photo-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}

.floating-upload-btn {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 56px;
    height: 56px;
    background: var(--gradient-cyan);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(6, 182, 212, 0.4), 0 4px 8px rgba(6, 182, 212, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.3), inset 0 -2px 0 rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    z-index: 40;
    display: none;
    align-items: center;
    justify-content: center;
}

.floating-upload-btn:hover {
    background: linear-gradient(135deg, #0891b2 0%, #2563eb 100%);
    transform: translateY(-4px) scale(1.05);
    box-shadow: 0 12px 28px rgba(6, 182, 212, 0.5), 0 6px 12px rgba(6, 182, 212, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.4), inset 0 -2px 0 rgba(0, 0, 0, 0.2);
}

.floating-upload-btn:active {
    transform: translateY(-2px) scale(1);
    box-shadow: 0 4px 12px rgba(6, 182, 212, 0.4), inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Mobile Bottom Navigation */
.mobile-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    border-top: 1px solid var(--border);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.08), 0 -1px 3px rgba(0, 0, 0, 0.05);
    padding: 0.5rem 0 env(safe-area-inset-bottom, 0.5rem);
    z-index: 100;
}

.mobile-bottom-nav .nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    padding: 0.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.75rem;
    font-weight: 500;
    transition: all 0.2s;
    background: none;
    border: none;
    cursor: pointer;
    position: relative;
}

.mobile-bottom-nav .nav-item i {
    font-size: 1.25rem;
    transition: all 0.2s;
}

.mobile-bottom-nav .nav-item span {
    transition: all 0.2s;
}

.mobile-bottom-nav .nav-item:active {
    transform: scale(0.95);
}

.mobile-bottom-nav .nav-item.active {
    color: var(--primary);
}

.mobile-bottom-nav .nav-item.active i {
    transform: scale(1.1);
}

/* Upload Button in Mobile Nav */
.mobile-bottom-nav .nav-upload-btn {
    position: relative;
    margin-top: -1.5rem;
}

.mobile-bottom-nav .upload-icon-wrapper {
    width: 56px;
    height: 56px;
    background: var(--gradient-blue);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4), 0 2px 6px rgba(59, 130, 246, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.3), inset 0 -2px 0 rgba(0, 0, 0, 0.15);
    border: 3px solid var(--bg-primary);
    transition: all 0.3s ease;
}

.mobile-bottom-nav .upload-icon-wrapper i {
    font-size: 1.5rem;
    color: white;
}

.mobile-bottom-nav .nav-upload-btn:active .upload-icon-wrapper {
    transform: scale(0.9);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4), inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Chat Badge */
.nav-icon-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-badge {
    position: absolute;
    top: -6px;
    right: -8px;
    min-width: 18px;
    height: 18px;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    font-size: 0.625rem;
    font-weight: 700;
    border-radius: 10px;
    padding: 0 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.4), 0 1px 3px rgba(239, 68, 68, 0.3);
    border: 2px solid var(--bg-primary);
    animation: badgePulse 2s ease-in-out infinite;
}

@keyframes badgePulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

.upload-panel-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    z-index: 998;
}

.upload-panel-overlay.active {
    opacity: 1;
    visibility: visible;
}

.upload-panel {
    position: fixed;
    top: 0;
    right: -100%;
    width: 100%;
    max-width: 480px;
    height: 100vh;
    background: var(--bg-primary);
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15), -2px 0 8px rgba(0, 0, 0, 0.1), -1px 0 4px rgba(0, 0, 0, 0.05);
    z-index: 999;
    transition: right 0.3s;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.upload-panel.active {
    right: 0;
}

.upload-panel-handle {
    display: none;
    width: 40px;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    margin: 0.75rem auto 0;
}

.upload-panel-header {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border);
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05), inset 0 1px 0 rgba(255, 255, 255, 0.8);
    flex-shrink: 0;
}

.upload-panel-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.upload-panel-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.5rem;
    padding: 0.5rem;
    transition: color 0.2s;
}

.upload-panel-close:hover {
    color: var(--text-primary);
}

.upload-panel-content {
    padding: 0;
    display: flex;
    flex-direction: column;
    height: 100%;
    max-height: 100%;
    overflow: hidden;
}

.upload-scrollable {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1.5rem;
    padding-bottom: 1.5rem;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

/* Custom scrollbar for upload area */
.upload-scrollable::-webkit-scrollbar {
    width: 8px;
}

.upload-scrollable::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 4px;
}

.upload-scrollable::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
    transition: background 0.2s;
}

.upload-scrollable::-webkit-scrollbar-thumb:hover {
    background: #cbd5e1;
}

.upload-sticky-footer {
    position: sticky;
    bottom: 0;
    background: var(--bg-primary);
    border-top: 1px solid var(--border);
    padding: 1.5rem;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05), 0 -1px 3px rgba(0, 0, 0, 0.03);
    z-index: 10;
    flex-shrink: 0;
}

.upload-sticky-footer .form-group {
    margin-bottom: 1rem;
}

.upload-sticky-footer .btn {
    margin-bottom: 0;
}

.upload-dropzone {
    border: 2px dashed var(--border);
    border-radius: 8px;
    padding: 3rem 2rem;
    text-align: center;
    transition: all 0.2s;
    cursor: pointer;
    background: var(--bg-secondary);
    margin-bottom: 1.5rem;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 0 rgba(255, 255, 255, 0.5);
}

.upload-dropzone:hover {
    border-color: var(--primary);
    background: var(--bg-primary);
    box-shadow: inset 0 2px 4px rgba(30, 64, 175, 0.05), 0 1px 0 rgba(255, 255, 255, 0.8), 0 2px 8px rgba(30, 64, 175, 0.1);
}

.upload-dropzone.dragover {
    border-color: var(--primary);
    background: var(--bg-primary);
    box-shadow: inset 0 2px 4px rgba(30, 64, 175, 0.08), 0 1px 0 rgba(255, 255, 255, 0.8), 0 4px 12px rgba(30, 64, 175, 0.15);
}

.upload-dropzone-icon {
    font-size: 3rem;
    background: var(--gradient-blue);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1rem;
}

.upload-dropzone h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.upload-dropzone p {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.upload-queue {
    margin-bottom: 1.5rem;
    max-height: 400px;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 0.5rem;
    -webkit-overflow-scrolling: touch;
}

.upload-queue:empty {
    display: none;
}

/* Scrollbar for upload queue */
.upload-queue::-webkit-scrollbar {
    width: 6px;
}

.upload-queue::-webkit-scrollbar-track {
    background: transparent;
}

.upload-queue::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.upload-queue::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.upload-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05), inset 0 1px 0 rgba(255, 255, 255, 0.5), inset 0 -1px 0 rgba(0, 0, 0, 0.03);
    position: relative;
}

.upload-item.uploading {
    border-color: var(--primary);
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.05) 0%, rgba(30, 64, 175, 0.05) 100%);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.15), 0 1px 3px rgba(59, 130, 246, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.6), inset 0 -1px 0 rgba(30, 64, 175, 0.1);
}

.upload-item.success {
    border-color: #10b981;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.05) 0%, rgba(5, 150, 105, 0.05) 100%);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.15), 0 1px 3px rgba(16, 185, 129, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.6), inset 0 -1px 0 rgba(16, 185, 129, 0.1);
}

.upload-item.error {
    border-color: #ef4444;
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.05) 0%, rgba(220, 38, 38, 0.05) 100%);
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.15), 0 1px 3px rgba(239, 68, 68, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.6), inset 0 -1px 0 rgba(239, 68, 68, 0.1);
}

.upload-item-header {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.upload-item-thumb {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    object-fit: cover;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

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

.upload-item-name {
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 0.25rem;
}

.upload-item-size {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.upload-item-status {
    font-size: 0.8125rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.25rem;
}

.upload-item-status i {
    font-size: 0.875rem;
}

.upload-item-status.uploading {
    color: var(--primary);
}

.upload-item-status.success {
    color: #10b981;
}

.upload-item-status.error {
    color: #ef4444;
}

.upload-progress-bar {
    width: 100%;
    height: 8px;
    background: var(--border);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.upload-progress-fill {
    height: 100%;
    background: var(--gradient-blue);
    border-radius: 10px;
    transition: width 0.3s ease;
    position: relative;
    overflow: hidden;
}

.upload-progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.upload-progress-percent {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary);
    margin-top: 0.5rem;
    text-align: right;
}

.upload-item-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.upload-item-btn {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
    font-weight: 500;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.upload-item-btn.remove {
    background: #fee2e2;
    color: #991b1b;
}

.upload-item-btn.remove:hover {
    background: #fecaca;
}

.upload-item-btn.retry {
    background: #dbeafe;
    color: #1e40af;
}

.upload-item-btn.retry:hover {
    background: #bfdbfe;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.875rem;
}

.form-group input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.9375rem;
    transition: all 0.2s;
    font-family: inherit;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05), 0 1px 0 rgba(255, 255, 255, 0.8);
    background: var(--bg-primary);
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.1), inset 0 1px 2px rgba(0, 0, 0, 0.05), 0 1px 0 rgba(255, 255, 255, 0.8);
}

.btn {
    width: 100%;
    padding: 0.875rem 1.5rem;
    background: var(--gradient-blue);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3), 0 1px 2px rgba(30, 64, 175, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.2), inset 0 -1px 0 rgba(0, 0, 0, 0.1);
}

.btn:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1e3a8a 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4), 0 2px 4px rgba(30, 64, 175, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.3), inset 0 -1px 0 rgba(0, 0, 0, 0.15);
}

.btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(59, 130, 246, 0.3), inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn:disabled {
    background: var(--border);
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.loading {
    display: none;
    text-align: center;
    padding: 2rem;
}

.loading.active {
    display: block;
}

.spinner {
    border: 3px solid var(--border);
    border-top: 3px solid;
    border-image: var(--gradient-blue) 1;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
    position: relative;
}

.spinner::before {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    border: 3px solid transparent;
    border-top: 3px solid #3b82f6;
    animation: spin 1s linear infinite;
}

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

.success-message,
.error-message {
    display: none;
    padding: 1rem;
    border-radius: 6px;
    margin-bottom: 2rem;
    font-size: 0.9375rem;
}

.success-message {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.error-message {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.success-message.active,
.error-message.active {
    display: block;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 6rem;
    right: 2rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15), 0 4px 12px rgba(0, 0, 0, 0.1);
    min-width: 300px;
    max-width: 400px;
    transform: translateX(450px);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: all;
    border-left: 4px solid;
}

.toast.show {
    transform: translateX(0);
    opacity: 1;
}

.toast-success {
    border-left-color: #10b981;
}

.toast-success i {
    color: #10b981;
    font-size: 1.25rem;
}

.toast-error {
    border-left-color: #ef4444;
}

.toast-error i {
    color: #ef4444;
    font-size: 1.25rem;
}

.toast-info {
    border-left-color: #3b82f6;
}

.toast-info i {
    color: #3b82f6;
    font-size: 1.25rem;
}

.toast-message {
    flex: 1;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.5;
}

@media (max-width: 768px) {
    .toast-container {
        top: 5rem;
        right: 1rem;
        left: 1rem;
    }
    
    .toast {
        min-width: auto;
        max-width: 100%;
        transform: translateY(-100px);
    }
    
    .toast.show {
        transform: translateY(0);
    }
}

.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 1000;
    overflow: hidden;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    width: 100vw;
    height: 100vh;
    background: transparent;
    border-radius: 0;
    overflow: visible;
    position: relative;
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0;
}

.modal-image-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    position: relative;
    padding: 5rem 2rem 2rem 2rem;
    touch-action: pan-y pinch-zoom;
}

.modal-image {
    max-width: calc(100vw - 4rem);
    max-height: calc(100vh - 7rem);
    width: auto;
    height: auto;
    object-fit: contain;
    user-select: none;
    -webkit-user-drag: none;
}

.modal-close {
    position: fixed;
    top: 1rem;
    right: 1rem;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.5rem;
    z-index: 1001;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.modal-close:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: scale(1.1);
}

.modal-nav {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.5rem;
    z-index: 1001;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.modal-nav:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: translateY(-50%) scale(1.1);
}

.modal-nav:active {
    transform: translateY(-50%) scale(0.95);
}

.modal-nav-prev {
    left: 1rem;
}

.modal-nav-next {
    right: 1rem;
}

/* Bottom Info Overlay */
.modal-info-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(
        to top,
        rgba(0, 0, 0, 0.95) 0%,
        rgba(0, 0, 0, 0.85) 30%,
        rgba(0, 0, 0, 0.6) 60%,
        transparent 100%
    );
    display: flex;
    align-items: flex-end;
    padding: 2rem;
    opacity: 0;
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10;
}

.modal-info-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.modal-info-content {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    color: white;
    transform: translateY(20px);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.modal-info-overlay.active .modal-info-content {
    transform: translateY(0);
}

.modal-info-top {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Info Overlay Content Styling */
.modal-info-overlay .photo-uploader {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.modal-info-overlay .uploader-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--gradient-purple);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.25rem;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
    border: 3px solid rgba(255, 255, 255, 0.2);
}

.modal-info-overlay .uploader-details {
    flex: 1;
}

.modal-info-overlay .uploader-name {
    font-weight: 600;
    color: white;
    font-size: 1.125rem;
    margin-bottom: 0.25rem;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.modal-info-overlay .photo-meta {
    display: flex;
    gap: 1rem;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.875rem;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}

.modal-info-overlay .photo-meta span {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.modal-info-overlay .photo-caption {
    color: rgba(255, 255, 255, 0.95);
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.modal-info-overlay .photo-meta i {
    font-size: 0.75rem;
    opacity: 0.9;
}

/* Action Buttons */
.modal-info-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.modal-action-btn {
    flex: 1;
    min-width: 140px;
    max-width: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 12px;
    color: white;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
}

.modal-action-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.modal-action-btn:active {
    transform: translateY(0);
}

.modal-action-btn i {
    font-size: 1rem;
}

.download-btn:hover {
    background: rgba(59, 130, 246, 0.3);
    border-color: rgba(59, 130, 246, 0.5);
}

.delete-btn:hover {
    background: rgba(239, 68, 68, 0.3);
    border-color: rgba(239, 68, 68, 0.5);
}

.modal-counter {
    text-align: center;
    margin-top: 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.site-footer {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--border);
    box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.05), 0 -1px 2px rgba(0, 0, 0, 0.03), inset 0 1px 0 var(--border-light);
    padding: 2rem 2rem 5rem;
    margin-top: 4rem;
    margin-bottom: 0;
}

.footer-container {
    max-width: 1400px;
    margin: 0 auto;
    text-align: center;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: var(--primary);
}

.footer-text {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
}

.empty-state i {
    font-size: 4rem;
    color: var(--border);
    margin-bottom: 1rem;
}

.empty-state h3 {
    font-size: 1.25rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: var(--text-secondary);
}

/* Infinite Scroll Indicators */
.scroll-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    gap: 1rem;
}

.scroll-loading .spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.scroll-loading p {
    color: var(--text-secondary);
    font-size: 0.9375rem;
}

.scroll-end {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-secondary);
    font-size: 0.9375rem;
}

/* Grid Selector Popover */
.grid-selector-overlay {
    position: fixed;
    inset: 0;
    bottom: 4rem;
    background: rgba(0, 0, 0, 0.3);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 90;
}

.grid-selector-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.grid-selector-popover {
    position: fixed;
    bottom: 5rem;
    right: 1rem;
    width: 90px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow-xl);
    transform: translateY(20px) scale(0.8);
    transform-origin: bottom center;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 1000;
    display: block;
}

.grid-selector-popover::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid var(--bg-primary);
    filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.1));
}

.grid-selector-popover::before {
    content: '';
    position: absolute;
    bottom: -9px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 9px solid transparent;
    border-right: 9px solid transparent;
    border-top: 9px solid var(--border);
    z-index: -1;
}

.grid-selector-popover.active {
    transform: translateY(0) scale(1);
    opacity: 1;
    pointer-events: all;
}

.grid-slider-vertical-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.5rem 1rem;
    gap: 1rem;
}

.grid-column-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1;
}

.grid-slider-vertical {
    -webkit-appearance: slider-vertical;
    writing-mode: bt-lr;
    width: 8px;
    height: 180px;
    background: var(--bg-secondary);
    outline: none;
    border-radius: 4px;
    border: 1px solid var(--border);
}

.grid-slider-vertical::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 28px;
    height: 28px;
    background: var(--gradient-blue);
    cursor: pointer;
    border-radius: 50%;
    border: 3px solid var(--bg-primary);
    box-shadow: 0 2px 8px rgba(30, 64, 175, 0.3);
    transition: all 0.2s;
}

.grid-slider-vertical::-moz-range-thumb {
    width: 28px;
    height: 28px;
    background: var(--gradient-blue);
    cursor: pointer;
    border-radius: 50%;
    border: 3px solid var(--bg-primary);
    box-shadow: 0 2px 8px rgba(30, 64, 175, 0.3);
    transition: all 0.2s;
}

.grid-slider-vertical::-webkit-slider-thumb:active {
    transform: scale(1.15);
    box-shadow: 0 4px 12px rgba(30, 64, 175, 0.4);
}

.grid-slider-vertical::-moz-range-thumb:active {
    transform: scale(1.15);
    box-shadow: 0 4px 12px rgba(30, 64, 175, 0.4);
}

/* Footer Info Panel */
.footer-info-overlay {
    position: fixed;
    inset: 0;
    bottom: 4rem;
    background: rgba(0, 0, 0, 0.3);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 90;
    display: block;
}

.footer-info-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.footer-info-panel {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%) translateY(100%);
    max-width: 600px;
    width: 100%;
    background: var(--bg-primary);
    border-top: 1px solid var(--border);
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15), 0 -2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
    z-index: 99;
    display: block;
    padding-bottom: 1rem;
}

.footer-info-panel.active {
    transform: translateX(-50%) translateY(-4rem);
}

.footer-info-handle {
    display: none;
}

.footer-info-content {
    padding: 1.5rem 1rem;
    text-align: center;
}

.footer-info-content .footer-links {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.footer-info-content .footer-links a {
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s;
}

.footer-info-content .footer-links a:hover {
    color: var(--primary);
}

.footer-info-content .footer-text {
    color: var(--text-secondary);
    font-size: 0.75rem;
    margin: 0;
}

/* QR Code Modal */
.qr-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 1000;
    display: block;
}

.qr-modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.qr-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    background: var(--bg-primary);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    opacity: 0;
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 1001;
    max-width: 90%;
    display: block;
}

.qr-modal.active {
    opacity: 1;
    pointer-events: all;
    transform: translate(-50%, -50%) scale(1);
}

.qr-modal-content {
    padding: 2rem ;
    text-align: center;
}

.qr-modal-content h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 1.5rem;
}

.qr-code-container {
    display: inline-block;
    padding: 1.5rem;
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    margin-bottom: 1.5rem;
}

.qr-gallery-btn {
    background: #3b82f6;
    color: white;
    border: 2px solid #2563eb;
    border-radius: 8px;
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
    margin-bottom: 0.75rem;
    width: 100%;
    max-width: 280px;
}

.qr-gallery-btn:hover {
    background: #2563eb;
    border-color: #1d4ed8;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.qr-gallery-btn:active {
    transform: translateY(0);
}

.qr-gallery-btn.copied {
    background: #10b981;
    border-color: #059669;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.qr-gallery-btn.copied i::before {
    content: "\f00c";
}

.qr-slideshow-btn {
    background: #8b5cf6;
    color: white;
    border: 2px solid #7c3aed;
    border-radius: 8px;
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3);
    margin-bottom: 0.75rem;
    width: 100%;
    max-width: 280px;
}

.qr-slideshow-btn:hover {
    background: #7c3aed;
    border-color: #6d28d9;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
}

.qr-slideshow-btn:active {
    transform: translateY(0);
}

.qr-slideshow-btn.copied {
    background: #10b981;
    border-color: #059669;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.qr-slideshow-btn.copied i::before {
    content: "\f00c";
}

.qr-close-btn {
    padding: 0.875rem 2rem;
    background: var(--gradient-blue);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.qr-close-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
}

/* Group Chat Panel */
.chat-overlay {
    position: fixed;
    inset: 0;
    bottom: 4rem;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 995;
    display: block;
}

.chat-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.chat-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 70vh;
    background: var(--bg-primary);
    border-top: 1px solid var(--border);
    border-radius: 24px 24px 0 0;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.15);
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 996;
    display: flex;
    flex-direction: column;
}

.chat-panel.active {
    transform: translateY(0);
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.chat-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chat-header i {
    font-size: 1.25rem;
    color: var(--primary);
}

.chat-close {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.chat-close:hover {
    background: var(--border);
    color: var(--text-primary);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.chat-welcome {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
}

.chat-welcome i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.chat-welcome p {
    font-size: 0.9375rem;
    margin: 0;
}

.chat-message {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    max-width: 85%;
    animation: slideInMessage 0.3s ease;
}

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

.chat-message.own-message {
    align-self: flex-end;
}

.chat-message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    padding: 0 0.5rem;
}

.chat-avatar {
    font-size: 1rem;
    margin-right: 0.25rem;
}

.chat-username {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.chat-timestamp {
    font-size: 0.6875rem;
    color: var(--text-secondary);
    opacity: 0.7;
}

.chat-message-text {
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: 0.75rem 1rem;
    border-radius: 16px;
    font-size: 0.9375rem;
    line-height: 1.5;
    word-wrap: break-word;
}

.chat-message.own-message .chat-message-text {
    background: var(--gradient-blue);
    color: white;
    border-radius: 16px 16px 4px 16px;
}

.chat-message:not(.own-message) .chat-message-text {
    border-radius: 16px 16px 16px 4px;
}

.chat-input-container {
    display: flex;
    gap: 0.75rem;
    padding: 1rem 1.5rem calc(1rem + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--border);
    background: var(--bg-primary);
    flex-shrink: 0;
}

.chat-input-container input {
    flex: 1;
    padding: 0.875rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    font-size: 0.9375rem;
    color: var(--text-primary);
    transition: all 0.2s;
}

.chat-input-container input:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--bg-primary);
}

#chatSendBtn {
    width: 48px;
    height: 48px;
    background: var(--gradient-blue);
    border: none;
    border-radius: 12px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

#chatSendBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
}

#chatSendBtn:active {
    transform: translateY(0);
}

/* Desktop/Tablet Bottom Nav Optimization */
@media (min-width: 769px) {
    .mobile-bottom-nav {
        max-width: 600px;
        left: 50%;
        transform: translateX(-50%);
        border-radius: 16px 16px 0 0;
        border-left: 1px solid var(--border);
        border-right: 1px solid var(--border);
    }
    
    .mobile-bottom-nav .nav-item {
        padding: 0.75rem;
    }
    
    .mobile-bottom-nav .nav-item span {
        font-size: 0.8125rem;
    }
    
    .mobile-bottom-nav .nav-item i {
        font-size: 1.375rem;
    }
    
    /* Grid Selector positioning for desktop/tablet */
    .grid-selector-popover {
        left: 50%;
        right: auto;
        transform: translateX(85px) translateY(20px) scale(0.8);
    }
    
    .grid-selector-popover.active {
        transform: translateX(85px) translateY(0) scale(1);
    }
}

/* Tablet Optimizations */
@media (min-width: 769px) and (max-width: 1024px) {
    .gallery-header {
        padding: 2.5rem 2rem;
    }
    
    .gallery-header h1 {
        font-size: 2.25rem;
    }
    
    .modal-image-container {
        padding: 4rem 1.5rem 2rem 1.5rem;
    }
    
    .modal-image {
        max-width: calc(100vw - 3rem);
        max-height: calc(100vh - 6rem);
    }
}

@media (max-width: 768px) {
    /* Prevent horizontal overflow on mobile */
    html, body {
        overflow-x: hidden;
        width: 100%;
        max-width: 100vw;
    }
    
    .site-header {
        padding: 1rem;
        width: 100%;
        max-width: 100vw;
        position: sticky;
        top: 0;
        z-index: 100;
    }
    
    .header-container {
        width: 100%;
        padding: 0;
    }
    
    .header-nav {
        gap: 0.5rem;
    }
    
    .upload-btn-header span {
        display: none;
    }
    
    .upload-btn-header {
        padding: 0.5rem;
        width: 32px;
        height: 32px;
        justify-content: center;
        font-size: 0.875rem;
    }
    
    .gallery-header {
        padding: 2rem 1rem;
    }
    
    .gallery-header h1 {
        font-size: 2rem;
    }
    
    .gallery-grid {
        gap: 0;
        width: 100%;
        max-width: 100%;
        overflow: hidden;
    }
    
    .photo-card {
        aspect-ratio: 1 / 1;
        /* Mobile: 3 columns by default (can be changed by grid selector) */
        flex: 0 0 33.3333%;
        max-width: 33.3333%;
    }
    
    .photo-overlay {
        background: linear-gradient(180deg, rgba(30, 64, 175, 0) 0%, rgba(30, 64, 175, 0.9) 100%);
    }
    
    .overlay-icon {
        font-size: 2.5rem;
    }
    
    .overlay-text {
        font-size: 0.875rem;
    }
    
    /* Grid Selector Mobile */
    .grid-selector-popover {
        bottom: 5rem;
        right: auto;
        left: 50%;
        transform: translateX(-25%) translateY(20px) scale(0.8);
        width: 90px;
    }
    
    .grid-selector-popover.active {
        transform: translateX(-25%) translateY(0) scale(1);
    }
    
    /* Add padding to container for bottom nav */
    .container {
        padding: 2rem 0 6rem;
        width: 100%;
        max-width: 100vw;
    }
    
    .site-logo {
        font-size: 1.5rem;
    }
    
    /* Upload panel slides up from bottom on mobile */
    .upload-panel {
        top: auto;
        bottom: -100%;
        right: auto;
        left: 0;
        max-width: 100%;
        height: 90vh;
        max-height: 90vh;
        border-radius: 24px 24px 0 0;
        transition: bottom 0.3s ease;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15), 0 -2px 8px rgba(0, 0, 0, 0.1);
    }
    
    .upload-panel.active {
        bottom: 0;
        right: auto;
    }
    
    .upload-panel-handle {
        display: block;
        flex-shrink: 0;
    }
    
    .upload-panel-header {
        padding: 0.75rem 1rem 1rem;
    }
    
    .upload-scrollable {
        padding: 1rem;
    }
    
    .upload-sticky-footer {
        padding: 1rem;
    }
    
    .upload-dropzone {
        padding: 2rem 1rem;
    }
    
    .upload-queue {
        max-height: 300px;
        padding-right: 0.25rem;
    }
    
    /* Modal/Lightbox Mobile Optimizations */
    .modal-content {
        margin: 0;
        border-radius: 0;
        width: 100vw;
        height: 100vh;
    }
    
    .modal-image-container {
        width: 100vw;
        height: 100vh;
        padding: 4rem 1rem 6rem 1rem;
    }
    
    .modal-image {
        max-width: calc(100vw - 2rem);
        max-height: calc(100vh - 10rem);
        width: auto;
        height: auto;
    }
    
    .modal-info-overlay {
        padding: 1.5rem 1rem 6rem;
    }
    
    .modal-action-btn {
        min-width: 120px;
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }
    
    .modal-action-btn span {
        display: none;
    }
    
    .modal-action-btn i {
        font-size: 1.25rem;
    }
    
    .modal-close {
        width: 44px;
        height: 44px;
        top: 0.75rem;
        right: 0.75rem;
        font-size: 1.25rem;
    }
    
    .modal-nav {
        width: 48px;
        height: 48px;
        font-size: 1.25rem;
    }
    
    .modal-nav-prev {
        left: 0.5rem;
    }
    
    .modal-nav-next {
        right: 0.5rem;
    }
    
    .container {
        padding: 2rem 1rem 6rem;
    }
    
    .site-footer {
        padding: 1.5rem 1rem 5rem;
        margin-bottom: 0;
        width: 100%;
        max-width: 100vw;
        box-sizing: border-box;
    }
}

@media (max-width: 480px) {
    .gallery-header {
        padding: 2rem 1rem;
    }
    
    .gallery-header h1 {
        font-size: 1.75rem;
    }
    
    .gallery-stats {
        font-size: 0.9375rem;
    }
    
    .photo-card {
        aspect-ratio: 1 / 1;
    }
    
    .modal-nav {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
    
    .modal-close {
        width: 40px;
        height: 40px;
        font-size: 1.125rem;
    }
    
    .modal-info-overlay .uploader-avatar {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
    
    .modal-info-overlay .uploader-name {
        font-size: 1rem;
    }
    
    .modal-info-overlay .photo-caption {
        font-size: 0.875rem;
    }
    
    .modal-action-btn {
        flex: 1;
        max-width: none;
    }
    
    .upload-item {
        padding: 0.75rem;
    }
    
    .upload-item-thumb {
        width: 50px;
        height: 50px;
    }
}

/* Landscape mobile optimization */
@media (max-width: 768px) and (orientation: landscape) {
    .modal-content {
        flex-direction: row;
    }
    
    .modal-image-container {
        width: 100vw;
        height: 100vh;
        padding: 2rem 1rem;
    }
    
    .modal-image {
        max-width: calc(100vw - 2rem);
        max-height: calc(100vh - 4rem);
    }
}

