/* ==================== Global Styles ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #ffffff;
    --primary-dark: #e5e5e5;
    --secondary-color: #9ca3af;
    --danger-color: #ef4444;
    --success-color: #10b981;
    --bg: #000000; /* page background */
    --surface: #0a0a0a; /* cards, panels */
    --surface-light: #141414;
    --muted: #6b7280; /* secondary text */
    --text-primary: #ffffff; /* main text */
    --text-secondary: #9ca3af;
    --border-color: rgba(255,255,255,0.08);
    --shadow: 0 6px 18px rgba(0,0,0,0.8);
    --shadow-lg: 0 20px 40px rgba(0,0,0,0.9);
}

/* Accessibility & spacing tweaks */
html { font-size: 16px; }
body { font-size: 1rem; }
.container { max-width: 1180px; padding: 0 24px; }
.main-content { padding: 48px 20px; }
h1, .gallery-header h1 { line-height: 1.1; }
h1 { font-size: 2.25rem; }
h2 { font-size: 1.55rem; }
.btn { padding: 10px 18px; border-radius: 10px; }
.image-wrapper { height: 260px; }
.gallery-image-wrapper img, .image-wrapper img { transition: transform 0.4s ease; }
.gallery-info p, .image-desc { font-size: 0.98rem; }

/* Increase contrast for text on surfaces */
.upload-section, .images-section, .gallery-item, .image-card, .auth-box, .lightbox-content { color: var(--text-primary); }


body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: radial-gradient(ellipse at top, rgba(255,255,255,0.03) 0%, transparent 50%),
                radial-gradient(ellipse at bottom, rgba(255,255,255,0.02) 0%, transparent 50%),
                var(--bg);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-tap-highlight-color: transparent;
}

body.modal-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
}

html, body {
    height: 100%;
}

body {
    display: flex;
    flex-direction: column;
}

.main-content {
    flex: 1;
    padding: 40px 20px;
}

/* ==================== Container ==================== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ==================== Navbar ==================== */
.navbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 2px 10px rgba(0,0,0,0.5);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(20px);
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
}

.nav-brand {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.nav-menu {
    display: flex;
    gap: 20px;
    align-items: center;
}

.nav-menu a {
    text-decoration: none;
    color: var(--text-secondary);
    transition: color 0.18s ease, transform 0.12s ease;
    font-weight: 600;
}

.nav-menu a:hover {
    color: var(--text-primary);
    transform: translateY(-2px);
}

.instagram-link {
    background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 700;
}

.instagram-link:hover {
    transform: translateY(-2px) scale(1.05);
}

.username {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* ==================== Buttons ==================== */
.btn {
    padding: 10px 18px;
    border: none;
    border-radius: 10px;
    font-size: 0.98rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.18s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    color: var(--text-primary);
    background: transparent;
    border: 1px solid transparent;
}

.btn-primary {
    background: linear-gradient(90deg, var(--text-primary), var(--primary-dark));
    color: #000;
    box-shadow: 0 6px 20px rgba(255,255,255,0.15);
    font-weight: 700;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

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

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background-color: #dc2626;
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.875rem;
}

/* ==================== Auth Forms ==================== */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: radial-gradient(1200px 400px at 10% 10%, rgba(255,255,255,0.03), transparent 10%),
                radial-gradient(800px 300px at 90% 90%, rgba(255,255,255,0.02), transparent 10%),
                var(--bg);
    padding: 20px;
}

.auth-box {
    background: var(--surface-light);
    padding: 36px;
    border-radius: 14px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 460px;
    animation: slideUp 0.28s ease;
    border: 1px solid var(--border-color);
}

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

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.auth-header h1 {
    font-size: 1.75rem;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.auth-header p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.form-group input,
.form-group textarea,
.form-group select {
    padding: 12px 14px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.18s ease;
    background: var(--surface);
    color: var(--text-primary);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--text-primary);
    box-shadow: 0 0 0 3px rgba(255,255,255,0.1);
}

.form-group small {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.error-message {
    background-color: rgba(239,68,68,0.12);
    color: #fca5a5;
    padding: 12px 14px;
    border-radius: 8px;
    border-left: 4px solid rgba(239,68,68,0.6);
    margin-bottom: 20px;
    font-size: 0.95rem;
}

.success-message {
    background-color: rgba(16,185,129,0.12);
    color: #6ee7b7;
    padding: 12px 14px;
    border-radius: 8px;
    border-left: 4px solid rgba(16,185,129,0.6);
    margin-bottom: 20px;
    font-size: 0.95rem;
}

.auth-footer {
    text-align: center;
    margin-top: 20px;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.auth-footer a {
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

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

.gallery-link {
    text-align: center;
    margin-top: 12px;
}

.gallery-link a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.18s ease;
}

.gallery-link a:hover {
    color: var(--text-primary);
}

/* ==================== Dashboard ==================== */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 30px;
    margin-top: 30px;
}

.upload-section,
.images-section {
    background: var(--surface-light);
    padding: 28px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
}

.upload-section h2,
.images-section h2 {
    margin-bottom: 20px;
    color: var(--text-primary);
    font-size: 1.5rem;
}

.upload-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.upload-form input[type="file"] {
    padding: 20px;
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.upload-form input[type="file"]:hover {
    border-color: var(--text-primary);
    background-color: var(--surface-light);
}

.upload-form input[type="file"]:focus {
    outline: none;
    border-color: var(--text-primary);
    box-shadow: 0 0 0 3px rgba(255,255,255,0.1);
}

/* ==================== Images Grid (Dashboard) ==================== */
.images-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.image-card {
    background: var(--surface-light);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.24s ease;
    box-shadow: var(--shadow);
    cursor: grab;
}

.image-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-4px);
    border-color: rgba(255,255,255,0.15);
}

.image-card.dragging {
    opacity: 0.6;
    transform: scale(0.98);
    cursor: grabbing;
}

.image-wrapper {
    width: 100%;
    height: 200px;
    overflow: hidden;
    background-color: var(--surface);
}

.image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

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

.image-info {
    padding: 14px;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    color: var(--text-primary);
}

.image-title {
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    word-break: break-word;
    white-space: normal;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.image-desc {
    color: var(--text-secondary);
    font-size: 0.9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    margin-bottom: 10px;
}

.image-date {
    color: #9ca3af;
    font-size: 0.85rem;
    margin-bottom: 10px;
}

.delete-form {
    margin-top: 10px;
}

.delete-form .btn {
    width: 100%;
}

.image-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.image-actions .btn {
    flex: 1;
}

.image-actions .delete-form {
    flex: 1;
    margin: 0;
}

.edit-form {
    padding: 14px;
    background: var(--surface);
    border-top: 1px solid var(--border-color);
    margin-top: 10px;
    border-radius: 0 0 12px 12px;
}

.edit-form .form-group {
    margin-bottom: 12px;
}

.gallery-editor-section .edit-form .form-group {
    margin-bottom: 8px;
}

.edit-form .form-group:last-of-type {
    margin-bottom: 15px;
}

.edit-form label {
    font-size: 0.85rem;
    margin-bottom: 5px;
    display: block;
}

.edit-form input[type="text"],
.edit-form textarea {
    width: 100%;
    font-size: 0.9rem;
    padding: 8px 10px;
}

.edit-actions {
    display: flex;
    gap: 8px;
}

.edit-actions .btn {
    flex: 1;
}

.page-editor-section {
    margin-bottom: 24px;
    padding-bottom: 12px;
}

.page-editor-section h3 {
    margin-bottom: 16px;
    font-size: 1.2rem;
    color: var(--text-primary);
}

.page-editor-card {
    background: var(--surface-light);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}

.page-editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.page-editor-header h4 {
    font-size: 1.05rem;
    color: var(--text-primary);
}

.page-editor-header small {
    color: var(--text-secondary);
    font-weight: 400;
}

.page-current-image {
    margin-top: 10px;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    background: var(--surface);
}

.page-current-image img {
    width: 100%;
    height: auto;
    display: block;
}

.checkbox-label {
    display: flex;
    gap: 8px;
    align-items: center;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 8px;
}

.page-content {
    background: var(--surface-light);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 28px;
    box-shadow: var(--shadow-lg);
    max-width: 980px;
    margin: 0 auto;
}

.page-hero-image {
    border-radius: 14px;
    overflow: hidden;
    margin-bottom: 24px;
    border: 1px solid var(--border-color);
    background: var(--surface);
}

.page-hero-image img {
    width: 100%;
    height: auto;
    display: block;
}

.page-content h1 {
    font-size: 2.2rem;
    margin-bottom: 16px;
}

.page-text {
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.7;
}

.page-text a {
    color: var(--text-primary);
    text-decoration: underline;
}

.page-meta {
    margin-top: 18px;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-state p {
    font-size: 1.1rem;
    margin-bottom: 20px;
}

.empty-state a {
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

.empty-state a:hover {
    color: var(--primary-dark);
}

/* ==================== Gallery Page (Grid) ==================== */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(8, minmax(0, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.gallery-item {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);\n    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
    cursor: pointer;
    aspect-ratio: 1;
    background: var(--surface-light);
}

.gallery-item:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-4px) scale(1.02);
    border-color: rgba(255,255,255,0.2);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
    display: block;
}

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

.gallery-header {
    text-align: center;
    margin-bottom: 50px;
    padding: 20px;
}

/* ==================== Carousel Modal ==================== */
.carousel-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    transition: opacity 0.3s ease;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: none;
}

.carousel-modal * {
    pointer-events: none;
}

.carousel-modal.open {
    opacity: 1;
    pointer-events: all;
    visibility: visible;
}

.carousel-modal.open * {
    pointer-events: auto;
}

.carousel-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.97);
    backdrop-filter: blur(20px);
}

.carousel-modal-content {
    position: relative;
    width: 90vw;
    max-width: 1100px;
    height: 85vh;
    display: flex;
    flex-direction: column;
    gap: 20px;
    z-index: 1001;
    touch-action: pan-y pinch-zoom;
}

.carousel-modal-close {
    position: absolute;
    top: -50px;
    right: 0;
    width: 40px;
    height: 40px;
    background: var(--surface-light);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: white;
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 1002;
    -webkit-tap-highlight-color: transparent;
}

.carousel-modal-close:hover {
    background: var(--text-primary);
    color: #000;
    transform: scale(1.1);
    border-color: var(--text-primary);
}

.carousel-modal-wrapper {
    position: relative;
    flex: 1;
    background: var(--surface);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    touch-action: pan-y;
}

.carousel-modal-track {
    display: flex;
    height: 100%;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    touch-action: pan-y;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.carousel-modal-track:active {
    cursor: grabbing;
}

.carousel-modal-slide {
    flex: 0 0 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.carousel-modal-slide img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
    user-select: none;
    -webkit-user-drag: none;
    pointer-events: auto;
    transition: transform 0.2s ease-out;
    transform-origin: center center;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.carousel-modal-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background: rgba(20,20,20,0.9);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    backdrop-filter: blur(10px);
    -webkit-tap-highlight-color: transparent;
}

.carousel-modal-btn:hover {
    background: var(--text-primary);
    color: #000;
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 8px 20px rgba(255,255,255,0.2);
    border-color: var(--text-primary);
}

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

.carousel-modal-prev {
    left: 15px;
}

.carousel-modal-next {
    right: 15px;
}

.carousel-modal-info {
    background: var(--surface-light);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
}

.carousel-modal-info h3 {
    font-size: 1.3rem;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.carousel-modal-info p {
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 15px;
}

.carousel-meta {
    display: flex;
    gap: 10px;
    align-items: center;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.carousel-meta span {
    color: var(--text-primary);
    font-weight: 600;
}

.carousel-modal-indicators {
    display: flex;
    gap: 10px;
    justify-content: center;
    padding: 10px;
}

.carousel-modal-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.3);
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0;
}

.carousel-modal-indicator:hover {
    background: rgba(255,255,255,0.6);
}

.carousel-modal-indicator.active {
    background: var(--text-primary);
    transform: scale(1.3);
}

.gallery-header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    color: var(--text-primary);
    letter-spacing: -0.5px;
    font-weight: 700;
}

.gallery-header p {
    font-size: 1.25rem;
    color: var(--text-secondary);
    font-weight: 400;
}

/* Duplicate removed - see line ~478 for main .gallery-item styles */

/* ==================== Footer ==================== */
.footer {
    background: transparent;
    border-top: 1px solid var(--border-color);
    padding: 30px 20px;
    text-align: center;
    color: var(--text-secondary);
    margin-top: auto;
}

/* ==================== Responsive ==================== */
@media (max-width: 768px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .auth-box {
        padding: 30px 20px;
    }

    .gallery-header h1 {
        font-size: 2rem;
    }

    .gallery-header p {
        font-size: 1rem;
    }

    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 15px;
    }

    .carousel-modal-content {
        height: 90vh;
    }

    .carousel-modal-btn {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }

    .carousel-modal-prev {
        left: 10px;
    }

    .carousel-modal-next {
        right: 10px;
    }

    .username {
        display: none;
    }

    .images-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
}

@media (max-width: 480px) {
    .auth-box {
        padding: 25px 15px;
    }

    .auth-header h1 {
        font-size: 1.5rem;
    }

    .gallery-header h1 {
        font-size: 1.5rem;
    }

    .gallery-header p {
        font-size: 0.95rem;
    }

    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 12px;
    }

    .carousel-modal-content {
        width: 95vw;
        height: 92vh;
    }

    .carousel-modal-btn {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }

    .carousel-modal-info {
        padding: 15px;
    }

    .carousel-modal-info h3 {
        font-size: 1.1rem;
    }

    .carousel-modal-indicators {
        gap: 8px;
    }

    .carousel-modal-indicator {
        width: 8px;
        height: 8px;
    }

    .btn {
        padding: 10px 15px;
        font-size: 0.9rem;
    }
}

/* ==================== Lightbox / Zoom ==================== */
.lightbox {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}
.lightbox.open {
    display: flex;
}
.lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(2px);
}
.lightbox-panel {
    position: relative;
    max-width: 1100px;
    width: calc(100% - 40px);
    max-height: calc(100% - 80px);
    margin: 20px;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
}
.lightbox-content {
    background: var(--surface-light);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    display: flex;
    gap: 20px;
    width: 100%;
}
.lightbox-content img {
    width: 60%;
    height: auto;
    object-fit: contain;
    max-height: 80vh;
    background: #000;
}
.lightbox-caption {
    padding: 20px;
    width: 40%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    color: var(--text-primary);
}
.lightbox-caption h3 {
    margin-bottom: 10px;
}
.lightbox-close {
    position: absolute;
    right: 8px;
    top: 8px;
    background: transparent;
    border: none;
    font-size: 32px;
    color: var(--text-primary);
    z-index: 3;
    cursor: pointer;
}
.zoomable { cursor: zoom-in; }

@media (max-width: 800px) {
    .lightbox-content { flex-direction: column; }
    .lightbox-content img { width: 100%; max-height: 60vh; }
    .lightbox-caption { width: 100%; padding: 15px; }
    .lightbox-close { color: #111; }
}

/* ==================== Responsive Design ==================== */

/* Tablets and smaller laptops */
@media (max-width: 1024px) {
    .container {
        max-width: 100%;
        padding: 0 20px;
    }
    
    .gallery-grid {
        grid-template-columns: repeat(6, minmax(0, 1fr));
        gap: 16px;
    }
    
    .images-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        gap: 16px;
    }
    
    h1 { font-size: 2rem; }
    h2 { font-size: 1.4rem; }
}

/* Tablets portrait */
@media (max-width: 768px) {
    .navbar .container {
        flex-direction: column;
        padding: 12px 15px;
        gap: 12px;
    }
    
    .nav-brand {
        font-size: 1.25rem;
        text-align: center;
    }
    
    .nav-menu {
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
    }
    
    .nav-menu a {
        font-size: 0.85rem;
        padding: 6px 12px;
    }
    
    .gallery-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 12px;
    }
    
    .images-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 12px;
    }
    
    .main-content {
        padding: 24px 12px;
    }
    
    .gallery-header {
        margin-bottom: 30px;
        padding: 12px;
    }
    
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.25rem; }
    
    .upload-section, .images-section {
        padding: 20px 15px;
    }
    
    .form-group {
        margin-bottom: 15px;
    }
    
    .auth-box {
        padding: 24px;
        margin: 20px;
    }
    
    /* Carousel mobile optimizations */
    .carousel-modal-content {
        width: 95vw;
        height: 90vh;
        gap: 12px;
    }
    
    .carousel-modal-close {
        top: -45px;
        width: 36px;
        height: 36px;
        font-size: 1.5rem;
    }
    
    .carousel-modal-wrapper {
        border-radius: 12px;
    }
    
    .carousel-modal-btn {
        width: 44px;
        height: 44px;
        font-size: 1.3rem;
    }
    
    .carousel-modal-prev {
        left: 10px;
    }
    
    .carousel-modal-next {
        right: 10px;
    }
    
    .carousel-modal-info {
        padding: 15px;
    }
    
    .carousel-modal-info h3 {
        font-size: 1.1rem;
    }
    
    .carousel-modal-info p {
        font-size: 0.9rem;
    }
    
    .carousel-modal-indicators {
        gap: 8px;
        padding: 8px;
    }
    
    .carousel-modal-indicator {
        width: 8px;
        height: 8px;
    }
}

/* Mobile devices */
@media (max-width: 480px) {
    .navbar .container {
        padding: 10px;
    }
    
    .nav-brand {
        font-size: 1.1rem;
    }
    
    .nav-menu {
        gap: 8px;
    }
    
    .nav-menu a {
        font-size: 0.75rem;
        padding: 5px 10px;
    }
    
    .instagram-link svg {
        display: none;
    }
    
    .gallery-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
    }
    
    .images-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }
    
    .gallery-item {
        border-radius: 8px;
    }
    
    .main-content {
        padding: 20px 10px;
    }
    
    .container {
        padding: 0 12px;
    }
    
    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.1rem; }
    
    .gallery-header {
        margin-bottom: 20px;
        padding: 8px;
    }
    
    .upload-section, .images-section {
        padding: 15px 10px;
        border-radius: 10px;
    }
    
    .form-group label {
        font-size: 0.9rem;
    }
    
    .form-group input,
    .form-group textarea,
    .form-group select {
        font-size: 0.9rem;
        padding: 10px;
    }
    
    .btn {
        padding: 8px 14px;
        font-size: 0.85rem;
    }
    
    .btn-small {
        padding: 6px 10px;
        font-size: 0.75rem;
    }
    
    .auth-box {
        padding: 20px;
        margin: 10px;
    }
    
    .image-card {
        border-radius: 10px;
    }
    
    .image-wrapper {
        height: 180px;
    }
    
    .image-info {
        padding: 10px;
    }
    
    .image-title {
        font-size: 0.9rem;
    }
    
    .image-desc {
        font-size: 0.85rem;
    }
    
    /* Carousel mobile optimizations */
    .carousel-modal-content {
        width: 100vw;
        height: 100vh;
        max-width: 100vw;
        gap: 0;
    }
    
    .carousel-modal-close {
        top: 10px;
        right: 10px;
        width: 40px;
        height: 40px;
        font-size: 1.8rem;
        background: rgba(20,20,20,0.95);
        border-radius: 50%;
    }
    
    .carousel-modal-wrapper {
        border-radius: 0;
        flex: 1;
    }
    
    .carousel-modal-btn {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
        background: rgba(20,20,20,0.8);
        border-radius: 50%;
    }
    
    .carousel-modal-prev {
        left: 8px;
    }
    
    .carousel-modal-next {
        right: 8px;
    }
    
    .carousel-modal-info {
        padding: 12px 15px;
        border-radius: 0;
        background: rgba(20,20,20,0.98);
        backdrop-filter: blur(10px);
    }
    
    .carousel-modal-info h3 {
        font-size: 1rem;
        margin-bottom: 8px;
    }
    
    .carousel-modal-info p {
        font-size: 0.85rem;
        line-height: 1.5;
        margin-bottom: 10px;
    }
    
    .carousel-meta {
        font-size: 0.8rem;
        gap: 8px;
        flex-wrap: wrap;
    }
    
    .carousel-modal-indicators {
        gap: 6px;
        padding: 6px;
    }
    
    .carousel-modal-indicator {
        width: 7px;
        height: 7px;
    }
    
    .carousel-modal-indicator.active {
        transform: scale(1.2);
    }
    
    .footer {
        padding: 15px;
        font-size: 0.85rem;
    }
}

/* Very small mobile devices */
@media (max-width: 360px) {
    .gallery-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 6px;
    }
    
    .nav-menu a {
        font-size: 0.7rem;
        padding: 4px 8px;
    }
    
    h1 { font-size: 1.3rem; }
    
    .main-content {
        padding: 15px 8px;
    }
}
