:root {
    --bg-color: #ffffff;
    --text-color: #333333;
    --primary-color: #007bff;
    --secondary-color: #6c757d;
    --card-bg: #f8f9fa;
    --border-color: #dee2e6;
    --header-height: 60px;
    --font-family: 'Ploni', sans-serif;

    /* New Global Colors */
    --color-yellow: #FFCE00;
    --color-background: #151515;
    --color-background-secondary: #2D2D2F;
    --color-border-gray: #C1C1C1;
    --color-white: #FBFBFB;
    --color-error: #EC0505;
    --color-success: #10C844;

    --header-bg: rgba(248, 249, 250, 0.5);
    /* Light mode transparency */
}

@font-face {
    font-family: 'Ploni';
    src: url('../fonts/ploni-ultralight-aaa.eot');
    src: url('../fonts/ploni-ultralight-aaa.eot?#iefix') format('embedded-opentype'),
        url('../fonts/ploni-ultralight-aaa.woff2') format('woff2'),
        url('../fonts/ploni-ultralight-aaa.woff') format('woff');
    font-weight: 200;
    font-style: normal;
}

@font-face {
    font-family: 'Ploni';
    src: url('../fonts/ploni-light-aaa.eot');
    src: url('../fonts/ploni-light-aaa.eot?#iefix') format('embedded-opentype'),
        url('../fonts/ploni-light-aaa.woff2') format('woff2'),
        url('../fonts/ploni-light-aaa.woff') format('woff');
    font-weight: 300;
    font-style: normal;
}

@font-face {
    font-family: 'Ploni';
    src: url('../fonts/ploni-regular-aaa.eot');
    src: url('../fonts/ploni-regular-aaa.eot?#iefix') format('embedded-opentype'),
        url('../fonts/ploni-regular-aaa.woff2') format('woff2'),
        url('../fonts/ploni-regular-aaa.woff') format('woff');
    font-weight: 400;
    font-style: normal;
}

@font-face {
    font-family: 'Ploni';
    src: url('../fonts/ploni-medium-aaa.eot');
    src: url('../fonts/ploni-medium-aaa.eot?#iefix') format('embedded-opentype'),
        url('../fonts/ploni-medium-aaa.woff2') format('woff2'),
        url('../fonts/ploni-medium-aaa.woff') format('woff');
    font-weight: 500;
    font-style: normal;
}

@font-face {
    font-family: 'Ploni';
    src: url('../fonts/ploni-demibold-aaa.eot');
    src: url('../fonts/ploni-demibold-aaa.eot?#iefix') format('embedded-opentype'),
        url('../fonts/ploni-demibold-aaa.woff2') format('woff2'),
        url('../fonts/ploni-demibold-aaa.woff') format('woff');
    font-weight: 600;
    font-style: normal;
}

@font-face {
    font-family: 'Ploni';
    src: url('../fonts/ploni-bold-aaa.eot');
    src: url('../fonts/ploni-bold-aaa.eot?#iefix') format('embedded-opentype'),
        url('../fonts/ploni-bold-aaa.woff2') format('woff2'),
        url('../fonts/ploni-bold-aaa.woff') format('woff');
    font-weight: 700;
    font-style: normal;
}

@font-face {
    font-family: 'Ploni';
    src: url('../fonts/ploni-ultrabold-aaa.eot');
    src: url('../fonts/ploni-ultrabold-aaa.eot?#iefix') format('embedded-opentype'),
        url('../fonts/ploni-ultrabold-aaa.woff2') format('woff2'),
        url('../fonts/ploni-ultrabold-aaa.woff') format('woff');
    font-weight: 800;
    font-style: normal;
}

@font-face {
    font-family: 'Ploni';
    src: url('../fonts/ploni-black-aaa.eot');
    src: url('../fonts/ploni-black-aaa.eot?#iefix') format('embedded-opentype'),
        url('../fonts/ploni-black-aaa.woff2') format('woff2'),
        url('../fonts/ploni-black-aaa.woff') format('woff');
    font-weight: 900;
    font-style: normal;
}

[data-theme="dark"] {
    --bg-color: #121212;
    --text-color: #e0e0e0;
    --primary-color: #375a7f;
    --secondary-color: #adb5bd;
    --card-bg: #1e1e1e;
    --border-color: #333333;

    --header-bg: rgba(30, 30, 30, 0.5);
    /* Dark mode transparency */
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-family);
    margin: 0;
    padding: 0;
    transition: background-color 0.3s, color 0.3s;
    direction: rtl;
    /* Hebrew support */
}

a {
    color: var(--primary-color);
    text-decoration: none;
}

.container {
    margin-right: 0px;
    margin-left: 0px;
    width: auto;
    /* Fix horizontal scroll */
    padding: 0px;
}

#select-form {
    margin-right: 30px;
    margin-left: 30px;
    margin-top: 20px;
    margin-bottom: 30px;
}

@media (max-width: 600px) {
    #select-form {
        margin-right: 5px;
        margin-left: 5px;
    }

    .actions {
        margin-right: 20px;
        margin-left: 20px;
    }
}

/* Header */
.sticky-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 30px;
    background-color: var(--header-bg);
    border-bottom: 0px;
    height: 50px;
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(15px);
}

.header-right {
    display: flex;
    justify-content: flex-start;
    align-items: flex-end;
    gap: 15px;
}

.header-logo {
    width: 120px;
    transition: .2s;
}

.project-title {
    font-size: 18px;
    font-weight: 500;
    line-height: 0.6em;
    color: var(--text-color);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    /* Prevent interaction when hidden */
}

.project-title.visible {
    opacity: 1;
    pointer-events: auto;
}

.header-left {
    display: flex;
    flex-direction: row;
    gap: 20px;
    align-items: center;
}

.social-icons {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 30px;
}

.social-icon {
    display: block;
    /* Width handled by img selectors below */
}

.social-icon img {
    display: block;
    transition: 0.2s;
}

/* Specific Icon Sizes */
.social-icon img[src*="whatsapp"] {
    width: 20px;
}

.social-icon img[src*="youtube"] {
    width: 21px;
}

.social-icon img[src*="instagram"] {
    width: 20px;
}

.social-icon img[src*="tiktok"] {
    width: 20px;
}

/* Dark mode: Make icons and logo white */
[data-theme="dark"] .social-icon img,
[data-theme="dark"] .theme-toggle img,
[data-theme="dark"] .header-logo {
    filter: brightness(0) invert(1);
}

/* Hover effects: Yellow color */
.social-icon:hover img,
.theme-toggle:hover img {
    /* Filter for #FFCE00 */
    /*   filter: invert(71%) sepia(95%) saturate(755%) hue-rotate(359deg) brightness(103%) contrast(106%) !important;*/
    opacity: 0.7;
}

/* Button hover effect */
button:hover,
.btn:hover {
    background-color: var(--color-yellow);
    color: black;
    /* Ensure text is readable on yellow */
    transition: 0.2s;
}

.header-separator {
    width: 1.5px;
    height: 15px;
    background: var(--color-border-gray);
    border-radius: 100px;
    opacity: 0.5;
}

.theme-toggle {
    background: none;
    border: 0;
    color: var(--text-color);
    padding: 0;
    margin: 0;
    cursor: pointer;
    width: 25px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.theme-toggle:hover {
    background: none !important;
}

.theme-toggle img {
    width: 20px;
    /* Base size */
    height: auto;
    display: block;
    transition: 0.2s;
}

/* Specific Theme Toggle Sizes */
.theme-toggle img[src*="sun"] {
    width: 21px;
}

.theme-toggle img[src*="moon"] {
    width: 17px;
}

/* Forms */
input,
button,
select {
    padding: 10px;
    margin: 5px 0;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--bg-color);
    color: var(--text-color);
}

button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    cursor: pointer;
}

button:hover {
    opacity: 0.9;
}

.actions {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    margin-right: 30px;
    margin-left: 30px;

}

/* Grid */
.gallery-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    /* JS also accounts for this, but CSS handles visual gap if flex */
    /* JS sets widths, so no grid-template-columns needed */
    width: 100%;
    margin-top: 20px;
    align-content: flex-start;
}

/* Remove CSS Grid Media Queries for columns - handled by JS */

.gallery-item {
    position: relative;
    overflow: hidden;
    margin: 0;
    padding: 0;
    /* Width and height set by JS */
}

.gallery-item img {
    /* Dimensions set by JS */
    display: block;
    cursor: pointer;
    transition: transform 0.3s;
}

@media (max-width: 400px) {
    .gallery-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.gallery-item {
    position: relative;
    overflow: hidden;
    margin: 0;
    padding: 0;
    width: 100%;
    /* Fill grid cell */
    /* Enforce uniform aspect ratio */
}

.gallery-item img {
    width: 100%;
    height: 100%;
    /* Crop to fill */
    display: block;
    cursor: pointer;
    transition: transform 0.3s;
}

/* Overlay */
.overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    /* 60% opacity black on hover */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 10px;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
    /* Let clicks pass through to image for lightbox, but enable for buttons */
}

.gallery-item:hover .overlay {
    opacity: 1;
}

@media (max-width: 600px) {
    .overlay {
        display: none !important;
    }

    .gallery-item.selected .overlay {
        display: flex !important;
    }
}

/* Selection State */
.gallery-item.selected .overlay {
    opacity: 1;
    background: rgba(0, 0, 0, 0.5);
    /* 50% opacity black */
    pointer-events: none;
    /* Keep overlay non-interactive but visible */
}

/* New Gallery Action Icons Container */
.gallery-icon-container {
    position: absolute;
    bottom: 15px;
    left: 15px;
    display: flex;
    gap: 15px;
}

.action-icon {
    width: 18px;
    height: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
    pointer-events: auto;
    /* Ensure clickable */
}

.action-icon:hover {
    opacity: 0.7;
    transform: none;
}

.action-icon img {
    width: 100%;
    height: 100%;
    filter: invert(1);
    /* Make icons white */
    object-fit: contain;
}

/* Lightbox */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2100;
    /* Higher than snackbar (2000) */
}

.lightbox.active {
    display: flex;
}

.lightbox img#lightbox-img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
}

/* Lightbox Controls (Close + Download) */
.lightbox-controls {
    position: absolute;
    top: 20px;
    left: 20px;
    display: flex;
    gap: 30px;
    background: rgba(0, 0, 0, 0.5);
    padding: 10px;
    border-radius: 30px;
    z-index: 2101;
    align-items: center;
    flex-direction: row-reverse;
}


.lightbox-control-icon {
    cursor: pointer;
    transition: transform 0.2s;
    display: block;
}

.lightbox-control-icon.btn-download {
    width: 18px;
    height: 18px;
}

.lightbox-control-icon.btn-close {
    width: 16px;
    height: 16px;
}

.lightbox-control-icon:hover {
    transform: scale(1.1);
}

.lightbox-control-icon img {
    width: 100%;
    height: 100%;
    filter: invert(1);
    transition: filter 0.3s;
}

/* Lightbox Close Hover - Global Red */
.lightbox-control-icon.btn-close:hover img {
    filter: invert(12%) sepia(96%) saturate(6288%) hue-rotate(357deg) brightness(95%) contrast(116%) !important;
}



/* Mobile Responsiveness */
@media (max-width: 768px) {
    .admin-dashboard {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        margin-bottom: 20px;
    }

    .sidebar {
        width: 100%;
        height: auto;
        margin-bottom: 20px;
    }

    .lightbox-nav {
        font-size: 30px;
        padding: 10px;
    }

    .lightbox-nav.prev {
        right: 10px;
        left: auto;
    }

    .lightbox-nav.next {
        left: 10px;
        right: auto;
    }
}

@media (max-width: 600px) {

    .social-icons,
    .header-separator {
        display: none !important;
    }
}

/* Admin Dashboard */
.admin-dashboard {
    display: flex;
    gap: 20px;
}

.sidebar {
    width: 250px;
    background: var(--card-bg);
    padding: 20px;
    height: calc(100vh - var(--header-height) - 40px);
}

.main-content {
    flex: 1;
}

/* Upload Zone */
.upload-zone {
    border: 2px dashed var(--border-color);
    padding: 40px;
    text-align: center;
    margin-bottom: 20px;
    cursor: pointer;
}

.upload-zone.dragover {
    background-color: rgba(0, 123, 255, 0.1);
    border-color: var(--primary-color);
}

/* Selection Mode */
.select-checkbox {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 10;
    width: 20px;
    height: 20px;
}

/* Selection Visuals */
.selection-tick {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    display: none;
    pointer-events: none;
    z-index: 5;
}

.selection-tick img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: invert(1);
    /* Make icon white */
}

.gallery-item.selected .overlay {
    opacity: 1;
    background: rgba(0, 0, 0, 0.5);
}

.gallery-item.selected .gallery-icon-container {
    display: none;
}

.gallery-item.selected .selection-tick {
    display: block;
}

/* Custom Loader (Load More) */
.custom-loader {
    display: none;
    /* Toggled via JS */
    justify-content: center;
    align-items: center;
    width: 100%;
}

.loader-content {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 8px;
    /* User specified gap */
}

.loader-text {
    font-size: 16px;
    /* User specified size */
    font-weight: 400;
    color: var(--text-color);
    /* Adapt to theme */
    font-family: 'Ploni', sans-serif;
    line-height: 1;
}

/* Theme Adaptation for Lottie */
/* Assuming loading.json is dark/black by default. Invert for dark mode (white text). */
[data-theme="dark"] lottie-player {
    filter: invert(1);
    opacity: 0.8;
    /* Slight dim for better look on dark */
}

/* Selection Snackbar */
.selection-snackbar {
    position: fixed;
    width: 500px;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--header-bg);
    color: var(--text-color);
    padding: 15px;
    padding-right: 25px;
    border-radius: 50px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 30px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    z-index: 2000;
    direction: rtl;
    backdrop-filter: blur(15px);
}


.snackbar-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.close-selection {
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.close-selection:hover {
    opacity: 1;
}

.close-selection img {
    width: 14px;
    height: 14px;
    transition: filter 0.3s;
}

/* Invert icons in dark mode */
[data-theme="dark"] .close-selection img,
[data-theme="dark"] .btn-download-selected img {
    filter: invert(1);
}

[data-theme="light"] .close-selection img,
[data-theme="light"] .btn-download-selected img {
    filter: none;
}

/* Close button hover effect - Global Red #EC0505 */
.close-selection:hover img {
    /* Generated filter for #EC0505 starting from black */
    filter: invert(12%) sepia(96%) saturate(6288%) hue-rotate(357deg) brightness(95%) contrast(116%) !important;
    opacity: 1;
}

#selection-count {
    font-size: 18px;
    font-weight: 400;
    line-height: 1em;
}

.btn-download-selected {
    background-color: var(--bg-color);
    border-radius: 30px;
    padding: 10px 20px;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 16px;
    margin: 0;
    flex-direction: row-reverse;
    font-family: 'Ploni';
    line-height: 0em;

}

.btn-download-selected img {
    width: 15px;
    height: 15px;
    transition: filter 0.2s;
}

.btn-download-selected:hover {
    background-color: var(--color-yellow);
    color: black;
}

.btn-download-selected:hover img {
    filter: brightness(0) !important;
    /* Turn icon black on hover regardless of theme */
}

@media (max-width: 600px) {
    .selection-snackbar {
        width: calc(100% - 25px);
        bottom: 0;
        left: 50%;
        transform: translateX(-50%);
        border-radius: 0px;
        padding: 15px;
    }
}

/* Hero Section */
.gallery-hero {
    position: relative;
    width: 100%;
    height: 400px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 30px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    padding-top: 70px;
    margin-top: -70px;
}

/* Reduced height on mobile */
@media (max-width: 600px) {
    .gallery-hero {
        height: 250px;
    }
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1;
}

.hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
    color: var(--color-white);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    padding: 20px;
}

.hero-title {
    font-size: 48px;
    font-weight: 700;
    margin: 0;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

@media (max-width: 600px) {
    .hero-title {
        font-size: 32px;
    }
}

.hero-date {
    font-size: 18px;
    opacity: 0.9;
    font-weight: 300;
    margin-top: -5px;
}

.hero-download-btn {
    background-color: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(15px);
    color: var(--color-white);
    padding: 12px 20px;
    border-radius: 50px;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
    font-size: 18px;
    font-weight: 500;
    margin-top: 15px;
    line-height: 1em;
    flex-direction: row-reverse;
}

.hero-download-btn:hover {
    background-color: var(--color-yellow);
    border-color: var(--color-yellow);
    color: black;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 206, 0, 0.3);
}

.hero-download-btn img {
    filter: invert(1);
    width: 16px;
    transition: filter 0.3s ease;
    margin-bottom: 2px;
}

.hero-download-btn:hover img {
    filter: invert(0);
    /* Black icon on hover */
}