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

*,
*::before,
*::after {
    box-sizing: border-box;
}

:root {
    --primary: #ffffff;
    --secondary: #f8f9fa;
    --accent: #d32f2f;
    --accent-hover: #c62828;
    --accent-light: rgba(211, 47, 47, 0.1);
    --bg: #ffffff;
    --surface: #f8f9fa;
    --surface-elevated: #ffffff;
    --text-primary: #1a1a1a;
    --text-secondary: #4a4a4a;
    --text-tertiary: #6a6a6a;
    --border: #e0e0e0;
    --border-light: #f0f0f0;
    --success: #4caf50;
    --danger: #f44336;
    --vibrant-blue: #2196f3;
    --vibrant-green: #4caf50;
    --vibrant-purple: #9c27b0;
    --transition: cubic-bezier(0.4, 0, 0.2, 1);
}

html {
    overflow-x: hidden;
    max-width: 100vw;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: 
        radial-gradient(circle at 20% 30%, rgba(211, 47, 47, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(33, 150, 243, 0.08) 0%, transparent 50%),
        linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    max-width: 100vw;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

/* Header */
.header {
    position: relative;
    min-height: 35vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 50%, #f8f9fa 100%);
    padding: 2rem clamp(1rem, 4vw, 2rem);
    overflow: hidden;
    max-width: 100vw;
}

.header::before {
    content: '';
    position: absolute;
    inset: 0;
    background: 
        linear-gradient(135deg, rgba(179, 27, 27, 0.08) 0%, rgba(179, 27, 27, 0.05) 50%, rgba(179, 27, 27, 0.08) 100%);
    pointer-events: none;
    z-index: 1;
}

.header::before {
    content: '';
    position: absolute;
    inset: 0;
    background: 
        linear-gradient(135deg, rgba(179, 27, 27, 0.08) 0%, rgba(179, 27, 27, 0.05) 50%, rgba(179, 27, 27, 0.08) 100%);
    pointer-events: none;
    z-index: 1;
}

.header::after {
    content: '';
    position: absolute;
    inset: 0;
    background: 
        radial-gradient(circle at 30% 40%, rgba(179, 27, 27, 0.06) 0%, transparent 50%),
        radial-gradient(circle at 70% 60%, rgba(179, 27, 27, 0.04) 0%, transparent 50%);
    pointer-events: none;
    z-index: 1;
    animation: pulse 8s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.05);
    }
}

.header-content {
    position: relative;
    z-index: 2;
    text-align: center;
    max-width: 800px;
    width: 100%;
    padding: 0 clamp(1rem, 4vw, 2rem);
    box-sizing: border-box;
    animation: fadeInUp 0.8s ease-out;
}

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

.title {
    font-size: clamp(2.5rem, 8vw, 5rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 0.5rem;
    color: #B31B1B;
    position: relative;
    display: inline-block;
    animation: titleSlide 1s ease-out 0.2s both;
    transition: transform 0.3s ease;
}

.title:hover {
    transform: translateY(-2px);
}

.title::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, #B31B1B, transparent);
    animation: underlineExpand 1s ease-out 0.8s forwards;
    transition: width 0.3s ease;
}

.title:hover::after {
    width: 100%;
}

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

@keyframes underlineExpand {
    to {
        width: 80%;
    }
}

.subtitle {
    font-size: clamp(1rem, 3vw, 1.5rem);
    font-weight: 500;
    color: #4a4a4a;
    margin-bottom: 0.5rem;
    animation: fadeInUp 1s ease-out 0.4s both;
    letter-spacing: 0.02em;
    transition: color 0.3s ease;
}

.subtitle:hover {
    color: #B31B1B;
}

.meta {
    font-size: 0.875rem;
    color: #6a6a6a;
    font-weight: 400;
    animation: fadeInUp 1s ease-out 0.6s both;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.meta::before,
.meta::after {
    content: '•';
    color: #B31B1B;
    font-size: 0.5rem;
    opacity: 0.6;
}

/* Navigation */
.nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.95);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(20px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
}

.nav-content {
    max-width: 1600px;
    margin: 0 auto;
    padding: 1rem clamp(1rem, 4vw, 2rem);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
    width: 100%;
    box-sizing: border-box;
}

.nav-btn {
    padding: 0.5rem 1rem;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s var(--transition);
    font-family: inherit;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    min-height: 36px;
}

.nav-btn:hover {
    background: var(--accent-light);
    color: var(--accent);
    border-color: var(--accent);
}

.nav-btn.active {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
    color: var(--text-primary);
    border-color: var(--accent);
    box-shadow: 0 4px 12px rgba(211, 47, 47, 0.4);
}

.nav-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    width: 100%;
    max-width: 100%;
}

.tag-btn {
    padding: 0.375rem 0.75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.8125rem;
    font-weight: 400;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s var(--transition);
    font-family: inherit;
    text-transform: capitalize;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    min-height: 32px;
}

.tag-btn:hover {
    background: var(--accent-light);
    color: var(--accent);
    border-color: var(--accent);
}

.tag-btn.active {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
    color: var(--text-primary);
    border-color: var(--accent);
    box-shadow: 0 2px 8px rgba(211, 47, 47, 0.3);
}


/* Main */
.main {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0.5rem clamp(1rem, 4vw, 2rem);
    width: 100%;
    box-sizing: border-box;
}

.gallery-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0;
}

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

.stats-label {
    color: var(--text-tertiary);
    font-weight: 400;
}

.select-mode-btn {
    padding: 0.5rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s var(--transition);
    font-family: inherit;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.select-mode-btn:hover {
    background: var(--accent-light);
    border-color: var(--accent);
    color: var(--accent);
}

.select-mode-btn:hover {
    background: var(--surface);
    border-color: var(--accent);
}

.select-mode-btn.active {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
    border-color: var(--accent);
    box-shadow: 0 4px 12px rgba(211, 47, 47, 0.3);
}

.selection-toolbar {
    display: none;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--surface-elevated);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 2rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.selection-toolbar.show {
    display: flex;
}

.selection-info {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.selection-actions {
    display: flex;
    gap: 0.5rem;
}

.action-btn {
    padding: 0.5rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s var(--transition);
    font-family: inherit;
}

.action-btn:hover {
    background: var(--accent-light);
    border-color: var(--accent);
    color: var(--accent);
}

.action-btn.delete {
    background: linear-gradient(135deg, var(--danger) 0%, #d32f2f 100%);
    border-color: var(--danger);
    color: white;
    box-shadow: 0 4px 12px rgba(244, 67, 54, 0.3);
}

.action-btn.delete:hover {
    background: linear-gradient(135deg, #d32f2f 0%, #c62828 100%);
    box-shadow: 0 6px 16px rgba(244, 67, 54, 0.5);
    transform: translateY(-2px);
}

.action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Gallery Grid */
.gallery-container {
    position: relative;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr));
    gap: 1rem;
    animation: fadeIn 0.4s var(--transition);
    width: 100%;
    box-sizing: border-box;
}

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


.gallery-item {
    position: relative;
    aspect-ratio: 4/3;
    overflow: hidden;
    border-radius: 8px;
    background: var(--surface);
    cursor: pointer;
    border: 1px solid var(--border);
    transition: all 0.3s var(--transition);
    will-change: transform;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.gallery-item::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, transparent 0%, rgba(0, 0, 0, 0.4) 100%);
    opacity: 0;
    transition: opacity 0.3s var(--transition);
    z-index: 2;
    pointer-events: none;
}

.gallery-item:hover {
    transform: translateY(-4px);
    border-color: var(--accent);
    box-shadow: 0 12px 24px rgba(211, 47, 47, 0.3), 0 0 20px rgba(211, 47, 47, 0.1);
}

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

.gallery-item img,
.gallery-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.5s var(--transition);
}

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

.gallery-item.selected {
    border-color: var(--accent);
    border-width: 2px;
    box-shadow: 0 0 0 2px rgba(211, 47, 47, 0.5), 0 4px 12px rgba(211, 47, 47, 0.3);
}

.gallery-item-checkbox {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 10;
    width: 24px;
    height: 24px;
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid var(--accent);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s var(--transition);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.gallery-item.selection-mode .gallery-item-checkbox {
    opacity: 1;
}

.gallery-item-checkbox input {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--accent);
}

.gallery-item-tag-btn {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    z-index: 10;
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--accent);
    font-size: 0.75rem;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.gallery-item:hover .gallery-item-tag-btn {
    opacity: 1;
}

.gallery-item-tag-btn:hover {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(211, 47, 47, 0.5);
}

.gallery-item-tags {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    z-index: 3;
    max-width: calc(100% - 3rem);
}

.gallery-item-tag {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.6875rem;
    font-weight: 500;
    white-space: nowrap;
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 6px rgba(211, 47, 47, 0.4);
}

.gallery-item-title {
    display: none;
}

/* Loading */
.loading {
    display: none;
    justify-content: center;
    align-items: center;
    padding: 4rem;
}

.loading.show {
    display: flex;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-right-color: var(--vibrant-blue);
    border-bottom-color: var(--vibrant-purple);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    box-shadow: 0 0 20px rgba(211, 47, 47, 0.3);
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Lightbox */
.lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
}

.lightbox.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(20px);
    animation: fadeIn 0.3s var(--transition);
}

.lightbox-close {
    position: absolute;
    top: 2rem;
    right: 2rem;
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.2s var(--transition);
    z-index: 1001;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.lightbox-close:hover {
    background: white;
    border-color: var(--accent);
    color: var(--accent);
    transform: rotate(90deg);
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 56px;
    height: 56px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s var(--transition);
    z-index: 1001;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.lightbox-nav:hover {
    background: white;
    border-color: var(--accent);
    color: var(--accent);
    transform: translateY(-50%) scale(1.1);
}

.lightbox-nav.prev {
    left: 2rem;
}

.lightbox-nav.next {
    right: 2rem;
}

.lightbox-content {
    position: relative;
    z-index: 1000;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: zoomIn 0.3s var(--transition);
    overflow-y: auto;
    padding: 2rem clamp(0.5rem, 2vw, 1rem);
    box-sizing: border-box;
    width: 100%;
}

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.lightbox-media {
    max-width: 100%;
    max-height: 70vh;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.lightbox-media img,
.lightbox-media video {
    max-width: 100%;
    max-height: 70vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.lightbox-info {
    margin-top: 1.5rem;
    text-align: center;
    color: white;
    flex-shrink: 0;
    padding-bottom: 1rem;
}

.lightbox-filename {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 1rem;
}

.lightbox-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 1rem;
}

.lightbox-tag {
    background: linear-gradient(135deg, rgba(211, 47, 47, 0.3) 0%, rgba(211, 47, 47, 0.2) 100%);
    color: white;
    padding: 0.375rem 0.75rem;
    border-radius: 4px;
    font-size: 0.8125rem;
    font-weight: 500;
    border: 1px solid rgba(211, 47, 47, 0.4);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 8px rgba(211, 47, 47, 0.2);
}

.edit-tags-btn {
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, rgba(211, 47, 47, 0.3) 0%, rgba(211, 47, 47, 0.2) 100%);
    border: 1px solid rgba(211, 47, 47, 0.5);
    color: white;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s var(--transition);
    font-family: inherit;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 12px rgba(211, 47, 47, 0.2);
}

.edit-tags-btn:hover {
    background: linear-gradient(135deg, rgba(211, 47, 47, 0.5) 0%, rgba(211, 47, 47, 0.4) 100%);
    border-color: rgba(211, 47, 47, 0.8);
    box-shadow: 0 6px 16px rgba(211, 47, 47, 0.4);
    transform: translateY(-2px);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2000;
}

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

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    animation: fadeIn 0.3s var(--transition);
}

.modal-content {
    position: relative;
    z-index: 2001;
    background: var(--surface-elevated);
    border: 1px solid var(--border);
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    animation: zoomIn 0.3s var(--transition);
}

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

.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
}

.modal-close {
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: var(--accent-light);
    color: var(--accent);
    transform: rotate(90deg);
}

.modal-body {
    padding: 1.5rem;
}

.modal-filename {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    word-break: break-word;
}

.tag-options {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.tag-checkbox {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s var(--transition);
}

.tag-checkbox:hover {
    background: var(--accent-light);
    border-color: var(--accent);
}

.tag-checkbox input {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--accent);
}

.tag-checkbox span {
    font-size: 0.875rem;
    color: var(--text-primary);
    text-transform: capitalize;
}

.modal-footer {
    display: flex;
    gap: 0.75rem;
    padding: 1.5rem;
    border-top: 1px solid var(--border);
    justify-content: flex-end;
}

.btn-primary,
.btn-secondary {
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s var(--transition);
    font-family: inherit;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(211, 47, 47, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--accent-hover) 0%, #ff5252 100%);
    box-shadow: 0 6px 16px rgba(211, 47, 47, 0.5);
    transform: translateY(-2px);
}

.btn-secondary {
    background: var(--surface);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--surface-elevated);
}

/* Responsive - Tablet */
@media (max-width: 1024px) {
    .nav-content {
        grid-template-columns: 1fr;
        gap: 1rem;
        padding: 1rem;
    }
    
    .nav-tags {
        order: -1;
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .main {
        padding: 1.5rem;
    }
    
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(min(200px, 100%), 1fr));
        gap: 1rem;
    }
    
    .gallery-controls {
        flex-wrap: wrap;
        gap: 1rem;
    }
    
    .selection-toolbar {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .selection-actions {
        flex-wrap: wrap;
        justify-content: center;
    }
}

/* Responsive - Mobile */
@media (max-width: 768px) {
    .header {
        min-height: 40vh;
        padding: 2rem 1rem;
    }
    
    .title {
        font-size: clamp(2rem, 10vw, 3rem);
    }
    
    .subtitle {
        font-size: clamp(0.875rem, 4vw, 1.125rem);
    }
    
    .meta {
        font-size: 0.75rem;
    }
    
    .nav-content {
        padding: 0.75rem 1rem;
        gap: 0.75rem;
    }
    
    .nav-btn {
        padding: 0.375rem 0.75rem;
        font-size: 0.8125rem;
        flex-shrink: 0;
    }
    
    .nav-tags {
        gap: 0.375rem;
        width: 100%;
    }
    
    .tag-btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
        flex-shrink: 0;
    }
    
    .main {
        padding: 1rem;
    }
    
    .gallery-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }
    
    .gallery-stats {
        text-align: center;
    }
    
    .select-mode-btn {
        width: 100%;
        justify-content: center;
    }
    
    .gallery-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
        width: 100%;
    }
    
    .gallery-item {
        border-radius: 6px;
    }
    
    .gallery-item-tag {
        font-size: 0.625rem;
        padding: 0.125rem 0.375rem;
    }
    
    .gallery-item-tag-btn {
        width: 28px;
        height: 28px;
        font-size: 0.625rem;
        top: 0.5rem;
        right: 0.5rem;
    }
    
    .gallery-item-checkbox {
        width: 20px;
        height: 20px;
        top: 0.5rem;
        left: 0.5rem;
    }
    
    .selection-toolbar {
        padding: 0.75rem;
    }
    
    .selection-info {
        text-align: center;
    }
    
    .selection-actions {
        flex-direction: column;
    }
    
    .action-btn {
        width: 100%;
    }
    
    .lightbox-content {
        max-width: 95vw;
        max-height: 95vh;
        padding: 1rem clamp(0.5rem, 2vw, 1rem);
        width: 100%;
    }
    
    .lightbox-media {
        max-height: 60vh;
    }
    
    .lightbox-media img,
    .lightbox-media video {
        max-height: 60vh;
    }
    
    .lightbox-info {
        margin-top: 1rem;
        padding-bottom: 0.5rem;
    }
    
    .lightbox-filename {
        font-size: 0.8125rem;
        margin-bottom: 0.75rem;
    }
    
    .lightbox-tags {
        margin-bottom: 0.5rem;
    }
    
    .lightbox-nav {
        width: 36px;
        height: 36px;
    }
    
    .lightbox-nav.prev {
        left: 0.5rem;
    }
    
    .lightbox-nav.next {
        right: 0.5rem;
    }
    
    .lightbox-close {
        top: 0.5rem;
        right: 0.5rem;
        width: 36px;
        height: 36px;
        font-size: 1.25rem;
    }
    
    .lightbox-info {
        padding: 0 1rem;
    }
    
    .lightbox-tags {
        gap: 0.375rem;
    }
    
    .lightbox-tag {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
    }
    
    .modal-content {
        width: 95%;
        max-height: 90vh;
        margin: 1rem;
    }
    
    .tag-options {
        max-height: 50vh;
        overflow-y: auto;
    }
    
    .modal-header {
        padding: 1rem;
    }
    
    .modal-header h3 {
        font-size: 1.125rem;
    }
    
    .modal-body {
        padding: 1rem;
    }
    
    .modal-footer {
        padding: 1rem;
        flex-direction: column;
    }
    
    .btn-primary,
    .btn-secondary {
        width: 100%;
    }
    
    .tag-options {
        gap: 0.5rem;
    }
    
    .tag-checkbox {
        padding: 0.5rem;
    }
    
    .tag-checkbox span {
        font-size: 0.8125rem;
    }
}

/* Responsive - Small Mobile */
@media (max-width: 480px) {
    .header {
        min-height: 35vh;
        padding: 1.5rem 1rem;
    }
    
    .title {
        font-size: clamp(1.75rem, 12vw, 2.5rem);
        margin-bottom: 0.25rem;
    }
    
    .title::after {
        height: 2px;
        bottom: -6px;
    }
    
    .subtitle {
        font-size: clamp(0.75rem, 5vw, 1rem);
    }
    
    .meta {
        font-size: 0.6875rem;
        flex-wrap: wrap;
        gap: 0.25rem;
    }
    
    .meta::before,
    .meta::after {
        display: none;
    }
    
    .nav-content {
        padding: 0.5rem;
    }
    
    .nav-btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
        min-height: 32px;
        flex-shrink: 0;
    }
    
    .tag-btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.6875rem;
        min-height: 28px;
        flex-shrink: 0;
    }
    
    .main {
        padding: 0.75rem;
    }
    
    .gallery-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
        width: 100%;
    }
    
    .gallery-item {
        border-radius: 4px;
    }
    
    .lightbox-content {
        max-width: 100vw;
        max-height: 100vh;
        padding: 0.5rem;
        width: 100%;
    }
    
    .lightbox-media {
        max-height: 55vh;
    }
    
    .lightbox-media img,
    .lightbox-media video {
        max-height: 55vh;
    }
    
    .lightbox-nav {
        width: 32px;
        height: 32px;
    }
    
    .lightbox-nav svg {
        width: 16px;
        height: 16px;
    }
    
    .lightbox-nav.prev {
        left: 0.25rem;
    }
    
    .lightbox-nav.next {
        right: 0.25rem;
    }
    
    .lightbox-close {
        width: 32px;
        height: 32px;
        font-size: 1.125rem;
        top: 0.25rem;
        right: 0.25rem;
    }
    
    .lightbox-info {
        margin-top: 0.75rem;
        padding: 0 0.5rem 0.5rem;
    }
    
    .lightbox-filename {
        font-size: 0.75rem;
        margin-bottom: 0.5rem;
    }
    
    .lightbox-tags {
        gap: 0.25rem;
        margin-bottom: 0.25rem;
    }
    
    .lightbox-tag {
        font-size: 0.6875rem;
        padding: 0.1875rem 0.375rem;
    }
    
    .modal-content {
        width: 95%;
        max-height: 85vh;
        margin: 0.5rem;
    }
    
    .modal-header {
        padding: 0.75rem;
    }
    
    .modal-header h3 {
        font-size: 1rem;
    }
    
    .modal-body {
        padding: 0.75rem;
    }
    
    .modal-footer {
        padding: 0.75rem;
    }
}

/* Responsive - Large Desktop */
@media (min-width: 1440px) {
    .nav-content {
        padding: 1.25rem 3rem;
    }
    
    .main {
        padding: 3rem;
    }
    
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
        gap: 1.5rem;
    }
    
    .lightbox-content {
        max-width: 85vw;
    }
    
    .lightbox-media {
        max-height: 75vh;
    }
    
    .lightbox-media img,
    .lightbox-media video {
        max-height: 75vh;
    }
}

/* Responsive - Landscape Mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .header {
        min-height: 30vh;
        padding: 1.5rem;
    }
    
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }
    
    .lightbox-media {
        max-height: 75vh;
    }
    
    .lightbox-media img,
    .lightbox-media video {
        max-height: 75vh;
    }
    
    .lightbox-content {
        padding: 1rem 0.5rem;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .gallery-item-tag-btn {
        opacity: 1;
    }
    
    .nav-btn:hover,
    .tag-btn:hover {
        background: var(--surface-elevated);
    }
    
    .gallery-item:hover {
        transform: none;
    }
    
    .gallery-item:active {
        transform: scale(0.98);
    }
}

/* Footer */
.footer {
    background: var(--surface);
    border-top: 1px solid var(--border);
    color: var(--text-secondary);
    text-align: center;
    padding: 2rem;
    margin-top: 4rem;
}

/* Hidden */
.hidden {
    display: none !important;
}
