:root {
    --bg-primary: #ffffff;
    --text-primary: #262626;
    --border-color: #dbdbdb;
    --modal-bg: rgba(0, 0, 0, 0.85);
    --navbar-bg: #f8f9fa;
    --navbar-text: #262626;
}

[data-theme="dark"] {
    --bg-primary: #141414;
    --text-primary: #ffffff;
    --border-color: #363636;
    --modal-bg: rgba(0, 0, 0, 0.95);
    --navbar-bg: #1a1a1a;
    --navbar-text: #ffffff;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: background-color 0.3s, color 0.3s;
}

.theme-switch {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1000;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
    padding: 1rem;
}

.gallery-item {
    position: relative;
    padding-bottom: 100%;
    cursor: pointer;
    overflow: hidden;
    border-radius: 3px;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.5s ease forwards;
}

.gallery-item-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s;
}

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

.image-actions {
    display: flex;
    gap: 1rem;
}

.delete-image {
    opacity: 0.5;
    transition: opacity 0.3s;
}

.delete-image:hover {
    opacity: 1;
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.gallery-item img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.gallery-item:hover img {
    transform: scale(1.05);
}

/* Loading Indicator Styles */
#loading-indicator {
    margin: 2rem 0;
    text-align: center;
    opacity: 0;
    transition: all 0.3s ease-in-out;
    width: 100%;
    grid-column: 1 / -1;
    display: none;
    transform: translateY(20px);
}

#loading-indicator.loading {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.loading-spinner {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem 3rem;
    background: var(--bg-primary);
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    border: 2px solid var(--border-color);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    }
    50% {
        box-shadow: 0 12px 32px rgba(13, 110, 253, 0.25);
    }
    100% {
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    }
}

.spinner-border {
    width: 4rem;
    height: 4rem;
    color: #0d6efd;
    border-width: 0.25rem;
    animation: spinner-border 1s linear infinite;
}

.loading-text {
    color: var(--text-primary);
    font-size: 0.9rem;
    margin-top: 1rem;
    font-weight: 500;
}

/* Modal Styles */
.modal {
    background-color: var(--modal-bg);
}

.modal-content {
    background-color: transparent;
    border: none;
}

.modal-dialog {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 60px);
    margin: 30px auto;
}

.modal-body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px;
    padding: 0;
}

.modal-image {
    max-height: 85vh;
    max-width: 95%;
    object-fit: contain;
    margin: auto;
}

.modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.8);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    z-index: 1060;
    cursor: pointer;
    transition: background-color 0.3s;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 1);
}

.modal-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.8);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.modal-prev {
    left: 10px;
}

.modal-next {
    right: 10px;
}

.modal-nav:hover {
    background: rgba(255, 255, 255, 1);
}

.modal-controls {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1060;
    background: rgba(0, 0, 0, 0.5);
    padding: 10px;
    border-radius: 20px;
}

.slideshow-toggle {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.4);
    padding: 8px 16px;
    border-radius: 20px;
    transition: all 0.3s ease;
}

.slideshow-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.6);
}

.slideshow-toggle:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.5);
}

.slideshow-toggle.active {
    background: rgba(255, 255, 255, 0.4);
    border-color: rgba(255, 255, 255, 0.8);
}

/* Navbar Styles */
.navbar {
    background-color: var(--navbar-bg) !important;
    transition: background-color 0.3s;
}

.navbar-light .navbar-brand,
.navbar-light .navbar-nav .nav-link {
    color: var(--navbar-text);
}

/* Form Switch Styles */
.form-check-input {
    background-color: var(--border-color);
    border-color: var(--text-primary);
}

.form-check-input:checked {
    background-color: #0d6efd;
    border-color: #0d6efd;
}

.form-check-label {
    color: var(--text-primary);
}

.upload-area {
    border: 2px dashed var(--border-color);
    padding: 2rem;
    text-align: center;
    margin: 2rem 0;
    border-radius: 8px;
}

.upload-area.dragover {
    background-color: rgba(0, 123, 255, 0.1);
    border-color: #007bff;
}
