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

:root {
    /* Darkroom palette - deep black with warm amber safelight */
    --bg: #0a0908;
    --surface: #12110f;
    --surface-2: #1a1917;
    --border: #2a2725;
    --text: #e5e2df;
    --text-muted: #857f78;
    --accent: #c4785a;
    --accent-hover: #d4896b;
    --accent-glow: rgba(196, 120, 90, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.5;
}

a {
    color: var(--accent);
    transition: color 0.2s;
}

a:hover {
    color: var(--accent-hover);
}

/* Modals */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.8);
    z-index: 1002;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-content {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2rem;
    width: 100%;
    max-width: 400px;
    position: relative;
}

.modal-sm {
    max-width: 320px;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
}

.modal-close:hover { color: var(--text); }

.modal-buttons {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
}

.modal-buttons .btn { flex: 1; }

/* Auth Card */
.auth-card {
    text-align: center;
}

.auth-card h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.auth-card .subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 2rem;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.auth-form input {
    padding: 0.875rem 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-2);
    color: var(--text);
    font-size: 1rem;
    text-align: center;
}

.auth-form input:focus {
    outline: none;
    border-color: var(--accent);
}

.otp-message {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.auth-hint {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 0.5rem;
}

.error-message {
    color: #ef4444;
    font-size: 0.9rem;
    margin-top: 1rem;
}

#main-header, #app-section > header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
}

#main-header {
    border-bottom: none;
}

.header-logo {
    display: none; /* Hidden on landing page - logo shown in center */
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
    color: var(--text);
}

.has-images .header-logo {
    display: flex; /* Show header logo when viewing images */
}

.header-logo-icon {
    width: 28px;
    height: 28px;
}

.header-logo-text {
    font-size: 0.95rem;
    font-weight: 500;
    letter-spacing: 0.15em;
    color: var(--text);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-left: auto; /* Push to right */
}

#user-email {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
}

main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1rem;
}

.hidden { display: none !important; }

/* Upload Area */
.upload-area {
    max-width: 520px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2rem 1.5rem;
}

.logo {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.logo-icon {
    width: 80px;
    height: 80px;
    flex-shrink: 0;
}

.logo-text {
    text-align: left;
}

.logo h1 {
    font-size: 2rem;
    font-weight: 300;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text);
    margin-bottom: 0.3rem;
    line-height: 1.1;
    white-space: nowrap;
}

.logo .tagline {
    font-size: 1rem;
    color: var(--text-muted);
    font-weight: 400;
}

.drop-zone {
    width: 100%;
    border: 2px dashed var(--border);
    border-radius: 16px;
    padding: 4rem 3rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.drop-zone:hover, .drop-zone.dragover {
    border-color: var(--accent);
    background: var(--accent-glow);
}

.drop-zone.uploading {
    pointer-events: none;
    border-color: var(--accent);
    background: var(--accent-glow);
}

.drop-zone.uploading .drop-zone-content {
    display: none;
}

.drop-zone .upload-indicator {
    display: none;
}

.drop-zone.uploading .upload-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.upload-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.upload-indicator p {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin: 0;
}

/* Upload progress bar */
.upload-progress {
    width: 200px;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 0.75rem;
}

.upload-progress-bar {
    width: 25%;
    height: 100%;
    background: var(--accent);
    border-radius: 2px;
    animation: upload-slide 1.8s ease-in-out infinite;
}

@keyframes upload-slide {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(400%); }
}

/* Page-wide drag overlay */
.drag-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 9, 8, 0.95);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 1.5rem;
    pointer-events: none;
}

.drag-overlay.visible {
    display: flex;
}

.drag-overlay-icon {
    width: 80px;
    height: 80px;
    color: var(--accent);
    opacity: 0.9;
}

.drag-overlay-text {
    font-size: 1.5rem;
    color: var(--text);
    font-weight: 300;
    letter-spacing: 0.05em;
}

.drag-overlay-hint {
    font-size: 1rem;
    color: var(--text-muted);
}

.drop-zone p {
    color: var(--text);
    margin-bottom: 0.75rem;
    font-size: 1.1rem;
}

.drop-zone .browse-hint {
    color: var(--text-muted);
    font-size: 1rem;
}

.browse-link {
    color: var(--accent);
    cursor: pointer;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s;
}

.browse-link:hover {
    border-bottom-color: var(--accent);
}

.formats {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 1rem;
}

.anon-notice {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 1.75rem;
    opacity: 0.5;
}

.anon-notice a {
    color: var(--accent);
    text-decoration: none;
}

.anon-notice a:hover {
    text-decoration: underline;
}

/* Expiry Warning Banner (gallery mode) */
.gallery-expiry-warning {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 0.625rem 1rem;
    background: rgba(196, 120, 90, 0.12);
    border-bottom: 1px solid rgba(196, 120, 90, 0.2);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.gallery-expiry-warning .expiry-warning-icon {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    color: var(--accent);
}

.gallery-expiry-warning .expiry-warning-text {
    font-size: 0.85rem;
    color: var(--text);
}

.gallery-expiry-warning .expiry-warning-text strong {
    color: var(--accent);
    font-weight: 600;
}

.gallery-expiry-warning .expiry-warning-text a {
    color: var(--accent);
    text-decoration: none;
}

.gallery-expiry-warning .expiry-warning-text a:hover {
    text-decoration: underline;
}

/* Responsive */
@media (max-width: 640px) {
    .gallery-expiry-warning {
        flex-wrap: wrap;
        padding: 0.5rem 0.75rem;
        gap: 0.375rem;
    }
    
    .gallery-expiry-warning .expiry-warning-text {
        font-size: 0.8rem;
    }
    
    .gallery-expiry-warning .expiry-warning-icon {
        display: none;
    }
}

#file-input { display: none; }

/* Gallery mode - when images are loaded */
.has-images .upload-area {
    min-height: auto;
    padding: 0;
    margin-bottom: 1.5rem;
}

.has-images .logo {
    display: none;
}

.has-images #main-header {
    position: relative;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
}

/* Removed duplicate center logo - now using header-logo on left only */

.has-images .drop-zone {
    display: none;
}

.has-images .anon-notice {
    display: none;
}

/* Gallery */
.gallery-section { margin-top: 2rem; }

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

#image-count {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.gallery-actions {
    display: flex;
    gap: 0.75rem;
}

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

.gallery-item {
    position: relative;
    aspect-ratio: 1;
    background: var(--surface);
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s;
}

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

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery-item .overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(transparent 60%, rgba(0,0,0,0.7));
    opacity: 0;
    transition: opacity 0.2s;
    display: flex;
    align-items: flex-end;
    padding: 0.75rem;
}

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

.gallery-item .filename {
    font-size: 0.8rem;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

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

.gallery-item .item-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    border-radius: 4px;
    padding: 0.4rem;
    cursor: pointer;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-item .item-btn:hover {
    background: rgba(255,255,255,0.3);
}

.gallery-item .item-btn svg {
    width: 16px;
    height: 16px;
}

.gallery-item.processing {
    position: relative;
}

.gallery-item.processing::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-item .spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.gallery-item .processing-label {
    position: absolute;
    bottom: 0.75rem;
    left: 0.75rem;
    right: 0.75rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@keyframes spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Buttons */
.btn {
    padding: 0.6rem 1.2rem;
    border-radius: 6px;
    border: none;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-sm {
    padding: 0.4rem 0.875rem;
    font-size: 0.8rem;
}

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

.btn-primary:hover { background: var(--accent-hover); }

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

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

/* Unified Viewer */
.viewer {
    position: fixed;
    inset: 0;
    background: var(--bg);
    z-index: 1000;
    display: flex;
}

.viewer-close {
    position: absolute;
    top: 1rem;
    left: 1rem;
    background: rgba(255,255,255,0.1);
    border: none;
    color: var(--text);
    font-size: 1.5rem;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.viewer-close:hover { background: rgba(255,255,255,0.15); }

.viewer-fullscreen {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(255,255,255,0.1);
    border: none;
    color: var(--text);
    width: 40px;
    height: 40px;
    border-radius: 8px;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.viewer-fullscreen svg {
    width: 20px;
    height: 20px;
}

.viewer-fullscreen:hover { background: rgba(255,255,255,0.15); }

/* Image loader */
.image-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 120px;
    height: 3px;
    background: rgba(255,255,255,0.1);
    border-radius: 2px;
    overflow: hidden;
    z-index: 5;
}



.loader-bar {
    width: 25%;
    height: 100%;
    background: var(--accent);
    border-radius: 2px;
    animation: loader-slide 1.8s ease-in-out infinite;
}

@keyframes loader-slide {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(400%); }
}

.viewer-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.08);
    border: none;
    color: var(--text);
    font-size: 1.5rem;
    padding: 1.5rem 0.75rem;
    cursor: pointer;
    z-index: 10;
    border-radius: 8px;
    transition: background 0.2s;
}

.viewer-prev { left: 1rem; }
.viewer-next { right: 340px; }
.viewer-nav:hover { background: rgba(255,255,255,0.15); }

/* Hide nav arrows when single image */
.viewer.single-image .viewer-nav {
    display: none;
}

.viewer-main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4rem;
    padding-right: 340px;
    position: relative;
}

.viewer-image {
    position: relative;
    max-width: 100%;
    max-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.viewer-image img,
.viewer-image canvas {
    max-width: 100%;
    max-height: calc(100vh - 8rem);
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 4px;
}

/* Hide image/canvas while loading */
.viewer-image img.loading,
.viewer-image canvas.loading {
    opacity: 0;
}

.viewer-loading {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    border-radius: 4px;
}

/* Viewer Panel */
.viewer-panel {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 320px;
    background: var(--surface);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

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

.filename-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    min-width: 0;
}

#viewer-filename {
    font-size: 0.85rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rename-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    opacity: 0.6;
    transition: opacity 0.2s, background 0.2s;
}

.rename-btn:hover {
    opacity: 1;
    background: var(--surface-2);
}

.panel-controls {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

/* Original view button active state - now in image toolbar */
#view-original-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.editor-controls {
    width: 320px;
    padding: 1rem;
    overflow-y: auto;
    border-left: 1px solid var(--border);
}

.control-section {
    margin-bottom: 1.5rem;
}

.control-section h3 {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.control-group {
    margin-bottom: 0.75rem;
}

.control-group label {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
    color: var(--text);
}

.control-group label span {
    color: var(--text-muted);
    font-family: monospace;
}

.control-group input[type="range"] {
    width: 100%;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    -webkit-appearance: none;
    appearance: none;
}

.control-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
}

.control-group.checkbox label {
    justify-content: flex-start;
    gap: 0.5rem;
    cursor: pointer;
}

.control-group.checkbox input {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
}

/* Preset Group */
.preset-group {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.preset-group select {
    flex: 1;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface-2);
    color: var(--text);
    font-size: 0.85rem;
    cursor: pointer;
}

.preset-group select:focus {
    outline: none;
    border-color: var(--accent);
}

.preset-group .btn-sm {
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.editor-buttons {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.editor-buttons .btn { flex: 1; }

/* Save Preset Form */
.save-preset-form {
    margin-top: 1rem;
}

.save-preset-form input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface-2);
    color: var(--text);
    font-size: 0.9rem;
}

.save-preset-form input:focus {
    outline: none;
    border-color: var(--accent);
}

/* Responsive - Tablet */
@media (max-width: 900px) {
    .viewer-main {
        padding-right: 280px;
    }
    
    .viewer-panel {
        width: 260px;
    }
    
    .viewer-next {
        right: 280px;
    }
}

/* Responsive - Mobile (phones only) */
@media (max-width: 640px) {
    /* Gallery improvements */
    .gallery {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    
    .gallery-header {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    #image-count {
        text-align: center;
    }
    
    .gallery-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
    }
    
    .gallery-actions .btn {
        justify-content: center;
    }
    
    /* Viewer mobile layout */
    .viewer-main {
        padding: 3.5rem 0.75rem 1rem;
        padding-bottom: 55vh;
    }
    
    .viewer-panel {
        top: auto;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: auto;
        max-height: 55vh;
        border-left: none;
        border-top: 1px solid var(--border);
        border-radius: 16px 16px 0 0;
    }
    
    .viewer-next {
        right: 0.75rem;
    }
    
    .viewer-fullscreen {
        right: 1rem;
    }
    
    /* Better nav buttons on mobile */
    .viewer-nav {
        padding: 0.75rem 0.5rem;
        font-size: 1.25rem;
        background: rgba(255,255,255,0.12);
        top: 25%;
        transform: translateY(-50%);
    }
    
    .viewer-close {
        width: 36px;
        height: 36px;
        font-size: 1.25rem;
    }
    
    .viewer-fullscreen {
        width: 36px;
        height: 36px;
    }
    
    .viewer-fullscreen svg {
        width: 18px;
        height: 18px;
    }
    
    /* Panel header mobile */
    .panel-header {
        padding: 0.75rem 1rem;
        min-height: 60px;
    }
    
    /* Add drag handle indicator */
    .panel-header::before {
        content: '';
        position: absolute;
        top: 8px;
        left: 50%;
        transform: translateX(-50%);
        width: 36px;
        height: 4px;
        background: var(--border);
        border-radius: 2px;
    }
    
    .viewer-panel .panel-header {
        position: relative;
    }
    
    #viewer-filename {
        font-size: 0.8rem;
        margin-top: 0.25rem;
    }
    
    /* Panel controls mobile */
    .panel-controls {
        padding: 0.75rem 1rem;
    }
    
    .control-section {
        margin-bottom: 1.25rem;
    }
    
    .control-group {
        margin-bottom: 0.875rem;
    }
    
    /* Image toolbar mobile */
    .image-toolbar {
        bottom: 0.75rem;
        right: 0.75rem;
    }
    
    .image-toolbar-btn {
        width: 36px;
        height: 36px;
    }
    
    .image-toolbar-btn svg {
        width: 18px;
        height: 18px;
    }
    
    .crop-actions {
        bottom: 0.75rem;
        right: 0.75rem;
    }
    
    /* Image max height adjustment */
    .viewer-image img,
    .viewer-image canvas {
        max-height: calc(45vh - 4rem);
    }
    
    /* Upload area mobile */
    .upload-area {
        padding: 1.5rem 1rem;
    }
    
    .drop-zone {
        padding: 2rem 1.5rem;
    }
    
    /* Header mobile */
    .has-images #main-header {
        padding: 0.875rem 1rem;
    }
    
    .header-actions {
        gap: 0.5rem;
    }
    
    .header-actions .btn-sm {
        padding: 0.35rem 0.75rem;
        font-size: 0.75rem;
    }
    
    /* Modal mobile */
    .modal {
        padding: 0.75rem;
    }
    
    .modal-content {
        padding: 1.5rem;
    }
    
    .auth-card .subtitle {
        margin-bottom: 1.5rem;
    }
}

/* Footer - minimal */
#site-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0.5rem 1rem;
    z-index: 100;
    pointer-events: none;
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
}

.footer-links {
    display: flex;
    gap: 1.25rem;
    pointer-events: auto;
}

.footer-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.75rem;
    opacity: 0.5;
    transition: opacity 0.2s, color 0.2s;
}

.footer-links a:hover {
    color: var(--accent);
    opacity: 1;
}

.footer-copyright {
    display: none;
}

/* No extra padding needed - footer is transparent */
body {
    padding-bottom: 0;
}

.upload-area {
    min-height: 100vh;
}

/* Small mobile */
@media (max-width: 600px) {
    .footer-links {
        gap: 1rem;
    }
    
    .footer-links a {
        font-size: 0.7rem;
    }
    
    #site-footer {
        padding: 0.5rem 0.75rem;
        padding-bottom: calc(0.5rem + env(safe-area-inset-bottom, 0px));
    }
    
    /* Single column gallery for very small screens */
    .gallery {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Logo adjustments */
    .logo {
        gap: 1.25rem;
    }
    
    .logo-icon {
        width: 60px;
        height: 60px;
    }
    
    .logo h1 {
        font-size: 1.5rem;
    }
    
    .logo .tagline {
        font-size: 0.85rem;
    }
}

/* Public page back navigation */
.public-page-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    padding: 1rem 1.5rem;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    z-index: 100;
}

.public-page-nav a {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    letter-spacing: 0.1em;
}

.public-page-nav a:hover {
    color: var(--accent);
}

.public-page-nav svg {
    width: 16px;
    height: 16px;
}

.public-page-content {
    padding-top: 5rem;
}

/* Extra small screens */
@media (max-width: 350px) {
    .gallery {
        gap: 0.5rem;
    }
    
    .gallery-item .overlay {
        padding: 0.5rem;
    }
    
    .gallery-item .filename {
        font-size: 0.7rem;
    }
    
    .viewer-main {
        padding: 3rem 0.5rem 1rem;
    }
}


/* Rename functionality */
.filename-editable {
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: background 0.2s;
}

.filename-editable:hover {
    background: var(--surface-2);
}

.filename-edit-input {
    background: var(--surface-2);
    border: 1px solid var(--accent);
    border-radius: 4px;
    color: var(--text);
    font-size: 0.85rem;
    padding: 0.25rem 0.5rem;
    width: 100%;
    max-width: 180px;
}

.filename-edit-input:focus {
    outline: none;
    border-color: var(--accent-hover);
}

/* Crop overlay */
.crop-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 15;
    pointer-events: auto;
}

.crop-box {
    position: absolute;
    border: 2px dashed var(--accent);
    background: transparent;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5);
    cursor: move;
    pointer-events: auto;
}

/* Crop handles */
.crop-handle {
    position: absolute;
    width: 12px;
    height: 12px;
    background: var(--accent);
    border: 2px solid white;
    border-radius: 2px;
    pointer-events: auto;
}

.crop-handle-nw { top: -6px; left: -6px; cursor: nw-resize; }
.crop-handle-ne { top: -6px; right: -6px; cursor: ne-resize; }
.crop-handle-sw { bottom: -6px; left: -6px; cursor: sw-resize; }
.crop-handle-se { bottom: -6px; right: -6px; cursor: se-resize; }
.crop-handle-n { top: -6px; left: 50%; transform: translateX(-50%); cursor: n-resize; }
.crop-handle-s { bottom: -6px; left: 50%; transform: translateX(-50%); cursor: s-resize; }
.crop-handle-e { top: 50%; right: -6px; transform: translateY(-50%); cursor: e-resize; }
.crop-handle-w { top: 50%; left: -6px; transform: translateY(-50%); cursor: w-resize; }

/* Image toolbar - overlaid on image area */
.image-toolbar {
    position: absolute;
    bottom: 1rem;
    right: calc(320px + 1rem); /* Account for panel width */
    display: flex;
    gap: 0.5rem;
    z-index: 20;
    pointer-events: auto;
}

.image-toolbar-btn {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: rgba(30, 30, 30, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    backdrop-filter: blur(8px);
}

.image-toolbar-btn:hover {
    background: rgba(50, 50, 50, 0.9);
    border-color: rgba(255, 255, 255, 0.25);
}

.image-toolbar-btn svg {
    width: 20px;
    height: 20px;
}

.image-toolbar-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

/* Hide toolbar when in crop mode */
.viewer-main.crop-mode .image-toolbar {
    display: none;
}

/* Crop action buttons */
.crop-actions {
    position: absolute;
    bottom: 1rem;
    right: calc(320px + 1rem); /* Same position as image-toolbar */
    display: flex;
    gap: 0.5rem;
    z-index: 25;
    pointer-events: auto;
}

.crop-actions .btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    backdrop-filter: blur(8px);
}

/* Crop mode styles */
.viewer-image.crop-mode {
    cursor: crosshair;
}

.viewer-image.crop-mode img,
.viewer-image.crop-mode canvas {
    cursor: crosshair;
}
/* Toast notifications */
.toast-container {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}

.toast {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.75rem 1.25rem;
    color: var(--text);
    font-size: 0.9rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    pointer-events: auto;
    animation: toastIn 0.3s ease-out;
    max-width: 90vw;
}

.toast.toast-out {
    animation: toastOut 0.25s ease-in forwards;
}

.toast-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.toast-success .toast-icon {
    color: #4ade80;
}

.toast-error .toast-icon {
    color: #f87171;
}

.toast-info .toast-icon {
    color: var(--accent);
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateY(1rem);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes toastOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-0.5rem);
    }
}

/* Toast in viewer context */
.viewer .toast-container {
    bottom: 1rem;
}

/* Draft indicator */
.draft-indicator {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8rem;
    color: var(--accent);
    margin-right: auto;
}

.draft-indicator svg {
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.editor-buttons {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

#cancel-draft-btn {
    font-size: 0.8rem;
    padding: 0.4rem 0.8rem;
}

/* Delete All Modal */
.btn-danger {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--bg);
}

.btn-danger:hover:not(:disabled) {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}

.btn-danger:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.delete-all-warning {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1.25rem;
    line-height: 1.5;
}

.delete-all-form label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--text);
}

.delete-all-form label strong {
    color: var(--accent);
    font-family: monospace;
}

.delete-all-form input {
    width: 100%;
    padding: 0.75rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 1rem;
    font-family: monospace;
    text-align: center;
    letter-spacing: 0.1em;
}

.delete-all-form input:focus {
    outline: none;
    border-color: var(--accent);
}

/* Initial loading state - prevent flash */
body.loading #upload-section,
body.loading #gallery-section {
    opacity: 0;
    pointer-events: none;
}

body:not(.loading) #upload-section,
body:not(.loading) #gallery-section {
    opacity: 1;
    transition: opacity 0.15s ease;
}
