/* CSS Variables for Light and Dark Mode */
:root {
    --bg-color: #121212;
    --text-color: #e0e0e0;
    --header-bg: #1e1e1e;
    --chat-bg: #181818;
    --input-bg: #252525;
    --border-color: #333333;
    --accent-color: #fbb32c;
    --message-user-bg: #fbb32c;
    --message-user-text: black;
    --message-bot-bg: #2a2a2a;
    --message-bot-text: #e0e0e0;
    --sidebar-bg: #1e1e1e;
    --sidebar-text: #e0e0e0;
    --sidebar-hover-bg: #2a2a2a;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    --highlight-color: #ff4444;
}

[data-theme="light"] {
    --bg-color: #ffffff;
    --text-color: #333333;
    --header-bg: #f8f9fa;
    --chat-bg: #f1f3f5;
    --input-bg: #ffffff;
    --border-color: #dee2e6;
    --accent-color: #fbb32c;
    --message-user-bg: #fbb32c;
    --message-user-text: black;
    --message-bot-bg: #e9ecef;
    --message-bot-text: #333333;
    --sidebar-bg: #f8f9fa;
    --sidebar-text: #333333;
    --sidebar-hover-bg: #e9ecef;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    --highlight-color: #ff4444;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: background-color 0.3s ease, color 0.3s ease;
    min-height: 100vh;
    overflow-x: hidden;
}

.hidden {
    display: none !important;
}

.gallery-card {
    transition: transform 0.5s ease, box-shadow 0.5s ease;
    position: relative;
    background: var(--chat-bg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.gallery-card:hover {
    transform: scale(1.03) translateY(-3px);
    box-shadow: 0 0 15px rgba(251, 179, 44, 0.5);
}

.aspect-square {
    aspect-ratio: 1 / 1;
}

@keyframes cardSpawn {
    0% { opacity: 0; transform: scale(0.9); }
    50% { transform: scale(1.03); }
    100% { opacity: 1; transform: scale(1); }
}

.animate-cardSpawn {
    animation: cardSpawn 0.6s ease-out forwards;
}

.font-montserrat {
    font-family: 'Montserrat', sans-serif;
}

.text-shadow-glow {
    text-shadow: 0 0 6px var(--accent-color);
}

img {
    transition: filter 0.3s ease, transform 0.3s ease;
    width: 100%;
    height: auto;
}

.gallery-card:hover img {
    filter: brightness(1.05) contrast(1.03);
    transform: scale(1.01);
}

.popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.popup:not(.hidden) {
    display: flex;
}

.popup-content {
    background-color: var(--chat-bg);
    color: var(--text-color);
    padding: 20px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    max-width: 400px;
    width: 90%;
    text-align: center;
}

.popup-content p {
    margin: 0 0 20px;
    font-size: 16px;
}

.popup-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.popup-button {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    box-shadow: var(--shadow);
    transition: background-color 0.3s ease, transform 0.1s ease;
}

.disconnect-button {
    background-color: var(--accent-color);
    color: var(--message-user-text);
}

.disconnect-button:hover {
    background-color: #fb762c;
    transform: translateY(-1px);
}

.cancel-button {
    background-color: var(--border-color);
    color: var(--text-color);
}

.cancel-button:hover {
    background-color: #555;
    transform: translateY(-1px);
}

#galleryHeader {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--header-bg);
    padding: 12px 24px;
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    z-index: 10020;
    height: 56px;
}

#galleryHeader .nav-buttons {
    display: flex;
    gap: 8px;
    align-items: center;
}

#galleryHeader .mode-theme,
#galleryHeader .connect-wallet {
    padding: 8px 16px;
    background-color: var(--input-bg);
    color: var(--text-color);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.3s ease, transform 0.1s ease;
}

#galleryHeader .connect-wallet {
    background-color: var(--accent-color);
    color: var(--message-user-text);
}

#galleryHeader .mode-theme:hover {
    background-color: var(--sidebar-hover-bg);
    transform: translateY(-1px);
}

#galleryHeader .connect-wallet:hover {
    background-color: #fb762c;
    transform: translateY(-1px);
}

#galleryHeader .connect-wallet:disabled {
    background-color: #6c757d;
    cursor: not-allowed;
}

#galleryHeader img.logo {
    width: 40px;
    height: 40px;
    background: var(--accent-color);
    padding: 2px;
    border-radius: 7px;
    transition: transform 0.2s ease;
}

#galleryHeader img.logo:hover {
    transform: scale(1.05);
}

.sidebar {
    position: fixed;
    top: 65px;
    left: 0;
    width: 250px;
    height: calc(100vh - 65px);
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    padding: 20px;
    overflow-y: auto;
    transition: transform 0.3s ease;
    transform: translateX(-100%);
    z-index: 950;
    box-shadow: var(--shadow);
}

.sidebar.active {
    transform: translateX(0);
}

.sidebar h3 {
    margin: 0 0 15px;
    font-size: 18px;
    color: var(--sidebar-text);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
    font-weight: 500;
}

.sidebar ul {
    list-style: none;
    padding: 0;
    margin: 0 0 20px;
}

.sidebar ul li {
    margin: 8px 0;
}

.sidebar ul li a {
    color: var(--sidebar-text);
    text-decoration: none;
    display: block;
    padding: 10px;
    border-radius: 6px;
    transition: background-color 0.2s ease, color 0.2s ease;
    font-size: 14px;
}

.sidebar ul li a:hover {
    background-color: var(--sidebar-hover-bg);
    color: var(--accent-color);
}

.sidebar i {
    padding-right: 10px;
    color: var(--accent-color);
}

.sidebar-toggle {
    position: fixed;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    width: 30px;
    height: 60px;
    background-color: var(--sidebar-bg);
    border: 1px solid var(--border-color);
    border-right: none;
    border-radius: 0 6px 6px 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--sidebar-text);
    transition: left 0.3s ease, background-color 0.3s ease;
    z-index: 960;
    box-shadow: var(--shadow);
}

.sidebar-toggle:hover {
    background-color: var(--sidebar-hover-bg);
}

.sidebar.active + .sidebar-toggle {
    left: 250px;
}

.sidebar-toggle i {
    transition: transform 0.3s ease;
}

.sidebar.active + .sidebar-toggle i {
    transform: rotate(180deg);
}

.main-list {
    max-width: 1200px;
    margin: 80px auto 20px;
    padding: 0 20px 20px 20px; /* Default padding, no left padding unless sidebar is active */
    width: 100%;
    box-sizing: border-box;
}

.main-list.sidebar-active {
    padding-left: 270px; /* Apply left padding only when sidebar is active */
}

#gallery-section {
    display: grid;
    gap: 16px;
    padding: 0;
}

#gallery-section.desktop {
    grid-template-columns: repeat(3, 1fr); /* 3 columns on desktop */
}

.gallery-card {
    min-height: 300px;
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.gallery-card img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 8px 8px 0 0;
}

.gallery-card .card-content {
    
    padding: 10px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.gallery-card .card-content p{
    line-height: 0.5px;
}
.gallery-card .status {
    
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: var(--accent-color);
    color: var(--message-user-text);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
}

.gallery-card .status.pending {
    background-color: #ff9800; /* Orange for pending */
}

.gallery-card .status.active {
    background-color: var(--accent-color); /* Yellow for active */
}

.gallery-card .status.rejected {
    background-color: #f44336; /* Red for rejected */
}

/* Mobile Styles (≤ 768px) */
@media (max-width: 768px) {
    .sidebar {
        width: 200px;
    }
    .sidebar.active + .sidebar-toggle {
        left: 200px;
    }
    .main-list {
        margin-top: 80px;
        padding: 0 10px 20px 10px; /* Full width on mobile when sidebar is closed */
    }
    .main-list.sidebar-active {
        padding-left: 220px; /* Adjust for sidebar width (200px + 20px) when active */
    }
    #gallery-section {
        grid-template-columns: 1fr; /* 1 column on mobile */
    }
    .gallery-card {
        min-height: 250px;
    }
    #galleryHeader {
        padding: 10px 16px;
        height: 56px;
    }
    #galleryHeader .nav-buttons {
        gap: 4px;
    }
    #galleryHeader .connect-wallet,
    #galleryHeader .mode-theme {
        display: flex !important;
        font-size: 12px;
        padding: 6px 12px;
    }
}

/* Desktop Styles (> 768px) */
@media (min-width: 769px) {
    #gallery-section {
        grid-template-columns: repeat(3, 1fr); /* 3 columns on desktop */
    }
    .main-list {
        padding-left: 270px; /* Default left padding for desktop sidebar */
    }
    .main-list.sidebar-active {
        padding-left: 270px; /* No change when active on desktop */
    }
    .gallery-card {
        min-height: 300px;
    }
}

/* Very Small Screens (≤ 479px) */
@media (max-width: 479px) {
    .main-list {
        padding: 0 5px 20px 5px; /* Full width on very small screens */
    }
    .main-list.sidebar-active {
        padding-left: 220px; /* Adjust for sidebar */
    }
    #gallery-section {
        grid-template-columns: 1fr; /* Ensure 1 column */
        gap: 8px;
    }
    .gallery-card {
        min-height: 200px;
    }
    #galleryHeader .nav-buttons {
        gap: 2px;
    }
    #galleryHeader .connect-wallet,
    #galleryHeader .mode-theme {
        font-size: 10px;
        padding: 4px 8px;
    }
}