:root {
    /* Layout & Sizes */
    --width-max: 1600px;
    --width-ultrawide: 1900px;
    --sidebar-width: 320px;
    --sidebar-width-wide: 330px;
    --radius-lg: 12px;
    --radius-xl: 18px;
    --sidebar-offset: 80px;

    /* Typography */
    --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-mono: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;

    /* Animation */
    --transition-fast: 0.2s ease-out;
    --transition-slower: 0.35s ease-out;
    --transition-slowest: 0.5s ease-out;

    /* Backgrounds (Sepia Tint) */
    --bg: #0c0b0a;
    --bg-black: #030200;
    --bg-alt: #14120e;
    --bg-card: #1f1b14;
    --bg-radial-start: #2b2416;
    --bg-header-end: #211c14;
    --bg-tooltip: rgba(20, 15, 10, 0.96);

    /* Text */
    --text: #f5f4f2;
    --text-white: #ffffff;
    --text-light: #e6e3de;
    --text-sidebar: #f5f2eb;
    --muted: #c9c2b0;

    /* Primary accent family (Amber/Gold) */
    --accent: #ffb703;
    --accent-soft: rgba(255, 183, 3, 0.35);
    --accent-muted: #b38000;
    --accent-bright: #ffce47;
    --accent-mid: #8f6507;
    --accent-deep: #5f4306;
    --accent-border: #c59212;
    --accent-ink: #2a1a00;
    --focus-ring: rgba(255, 183, 3, 0.6);

    /* Borders & Shadows */
    --border: #423822;
    --border-card: rgba(255, 255, 255, 0.05);
    --border-sidebar: rgba(255, 255, 255, 0.07);
    --border-code: #2e2a22;
    --shadow-soft: 0 10px 30px rgba(20, 15, 0, 0.7);
    --shadow-header: 0 8px 20px rgba(15, 10, 0, 0.6);
    --shadow-tooltip: 0 12px 30px rgba(25, 20, 5, 0.85);

    /* Compatibility aliases used by existing styles */
    --card: var(--bg-card);
    --panel: #221d15;
    --primary: var(--accent);
    --primary-dark: var(--accent-muted);
    --text-muted: var(--muted);
    --danger: #9b6f09;
    --success: #c68f10;
    --overlay: rgba(12, 9, 5, 0.9);
    --header-height: 64px;
}

@media (min-width: 2000px) {
    :root {
        --width-max: var(--width-ultrawide);
        --sidebar-width: var(--sidebar-width-wide);
    }
}

*,
*::before,
*::after {
    box-sizing: border-box;
    scroll-padding-top: 160px;
}

html {
    -webkit-text-size-adjust: 100%;
    scrollbar-width: thin;
    scrollbar-color: var(--muted) transparent;
    width: 100vw;
    overflow-x: hidden;
}

html,
body {
    height: 100%;
    overflow-x: hidden;
}


[x-cloak] {
    display: none !important;
}

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: radial-gradient(circle at top, var(--bg-radial-start) 0, var(--bg) 45%, var(--bg-black) 100%);
    background-attachment: fixed;
    background-repeat: no-repeat;
    background-size: cover;
    background-color: var(--bg-black);
    color: var(--text);
    font-family: var(--font-sans);
    line-height: 1.6;
    padding-top: var(--header-height);
}

main {
    width: 100%;
    max-width: var(--width-max);
    margin: 0 auto;
    padding: 1.5rem;
    transition: max-width var(--transition-slower);
    flex: 1;
    min-width: 0;
}


.app-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: linear-gradient(90deg, var(--bg), var(--bg-header-end));
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    z-index: 1000;
    box-shadow: var(--shadow-header);
}

.nav-brand {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--primary);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.nav-links {
    display: flex;
    gap: 1rem;
    align-items: baseline;
}

.nav-btn {
    background: transparent;
    color: var(--text-muted);
    border: none;
    font-size: 0.85rem;
    cursor: pointer;
    padding: 0 0 0.3rem;
    border-radius: 0;
    transition: color var(--transition-fast);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    position: relative;
}

.nav-btn::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    height: 2px;
    width: 0;
    background: var(--accent);
    transition: width var(--transition-fast);
}

.nav-btn:hover {
    color: var(--text);
}

.nav-btn.active {
    color: var(--text);
}

.nav-btn:hover::after,
.nav-btn.active::after {
    width: 100%;
}


button {
    cursor: pointer;
    border: none;
    font-family: inherit;
    transition: all var(--transition-fast);
}

select,
input[type="text"] {
    background: var(--card);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 10px 14px;
    border-radius: var(--radius-lg);
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
}

select:focus,
input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 1px var(--focus-ring);
}

select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}


.btn-view,
.btn-save,
.select-btn {
    padding: 10px 20px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.9rem;
    transition:
        filter 0.2s,
        background-color 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.btn-view {
    background: rgba(255, 183, 3, 0.12);
    color: var(--text-white);
    border: 1px solid rgba(255, 183, 3, 0.45);
}

.btn-view:hover {
    background: rgba(255, 183, 3, 0.22);
    color: var(--text-white);
    border-color: var(--accent);
}

.btn-save {
    background: #c68f10;
    color: var(--text-white);
    border: 1px solid #e5ae2c;
}

.btn-save.danger {
    background: #9b6f09;
    color: var(--text-white);
    border-color: var(--accent-border);
}

.btn-save:hover {
    filter: none;
    background: #d79d1b;
    color: var(--text-white);
    border-color: var(--accent-bright);
}

.btn-save.danger:hover {
    background: #b8840d;
    color: var(--text-white);
    border-color: var(--accent-bright);
}

.btn-save:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    filter: none;
    background: rgba(255, 183, 3, 0.1);
    border-color: rgba(255, 183, 3, 0.28);
    color: rgba(255, 255, 255, 0.72);
}

.select-btn {
    background: #9e7008;
    color: var(--text-white);
    border: 1px solid #c48f10;
    margin-right: 10px;
}

.select-btn.active {
    background: rgba(255, 183, 3, 0.16);
    border: 1px solid rgba(255, 183, 3, 0.45);
    color: var(--text-white);
}

.btn-link {
    background: transparent;
    color: var(--text-muted);
    text-decoration: underline;
    font-size: 0.9rem;
}

.btn-link:hover {
    color: var(--primary);
}

.btn-block {
    width: 100%;
    display: flex;
    margin-bottom: 6px;
}

.btn-icon-clear {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    padding: 5px;
    transition: color 0.2s;
}

.btn-icon-clear:hover {
    color: var(--primary);
}

.text-muted {
    color: var(--text-muted);
}


.view-section {
    display: none; 
    padding: 0;
}

.view-section.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: var(--width-max);
    margin: 0 auto 20px;
    padding: 0 10px;
    flex-wrap: wrap;
    gap: 15px;
}

.sticky-header {
    position: sticky;
    top: 0;
    background: linear-gradient(180deg, rgba(10, 10, 10, 0.95), rgba(10, 10, 10, 0.78));
    border-radius: var(--radius-lg);
    z-index: 100;
    padding: 10px;
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(6px);
}

.header-controls {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-grow: 1;
    flex-wrap: wrap;
}

.header-controls .tag-widget {
    flex-grow: 1;
    min-width: 200px;
}


.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 15px;
    max-width: var(--width-max);
    margin: 0 auto;
    padding: 0 10px;
}

.gallery-item {
    background: var(--card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    aspect-ratio: 4/3;
    border: 1px solid var(--border);
    position: relative;
    transition:
        transform var(--transition-fast),
        border-color var(--transition-fast),
        box-shadow var(--transition-fast);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    content-visibility: auto;
    contain-intrinsic-size: 240px 180px;
}


.gallery-item:nth-child(4n + 1) {
    background-color: #1c1812;
}
.gallery-item:nth-child(4n + 2) {
    background-color: #231d14;
}
.gallery-item:nth-child(4n + 3) {
    background-color: #2a2115;
}
.gallery-item:nth-child(4n + 4) {
    background-color: #18130d;
}

.gallery-item img,
.gallery-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: transparent;
    display: block;
    opacity: 1;
    transition: opacity 0.3s ease-in-out;
}

.gallery-media-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(120deg, rgba(255, 183, 3, 0.06), rgba(255, 183, 3, 0.02) 45%, rgba(255, 183, 3, 0.08));
}


.gallery-item:hover {
    transform: translateY(-3px);
    border-color: var(--primary);
    box-shadow: var(--shadow-soft);
}

.gallery-item.selected {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary);
}

.select-checkbox {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 22px;
    height: 22px;
    background: rgba(20, 14, 7, 0.72);
    border: 2px solid var(--text-muted);
    border-radius: 4px;
    z-index: 10;
    display: none; 
}


.gallery-item.selected .select-checkbox,
.bulk-mode .select-checkbox {
    display: block;
}

.gallery-item.selected .select-checkbox {
    background: var(--primary);
    border-color: var(--primary);
}

.gallery-item.selected .select-checkbox::after {
    content: "✓";
    color: var(--accent-ink);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: bold;
    font-size: 14px;
}

.delete-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    background: rgba(25, 16, 8, 0.78);
    border: 1px solid #b8840d;
    border-radius: 50%;
    color: var(--danger);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 10;
}

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

.gallery-dim-label {
    position: absolute;
    right: 8px;
    bottom: 8px;
    z-index: 9;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.55);
    color: var(--text-white);
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: 0.01em;
    pointer-events: none;
    backdrop-filter: blur(1px);
}

.delete-btn:hover {
    background: #d8a21f;
    color: var(--accent-ink);
}

.delete-btn svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
}


.loading-sentinel {
    height: 80px;
    width: 100%;
    margin-top: 30px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--muted);
}

.loading-sentinel.end {
    border-top: 1px solid var(--border);
    margin-top: 50px;
    padding-top: 20px;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}


.tag-widget {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding: 6px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    min-height: 42px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.22);
    transition:
        border-color 0.2s,
        box-shadow 0.2s;
}

.tag-widget:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 1px var(--focus-ring);
}

.tw-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tw-input-wrapper {
    display: flex;
    flex-grow: 1;
    align-items: center;
}

.tw-input-wrapper input {
    border: none;
    background: transparent;
    padding: 0 8px;
    height: 100%;
    min-width: 80px;
    flex-grow: 1;
}

.tw-input-wrapper input:focus {
    box-shadow: none;
}

.tw-cloud-btn {
    background: transparent;
    color: var(--text-muted);
    padding: 4px;
    display: flex;
    align-items: center;
    border-radius: 4px;
}

.tw-cloud-btn:hover {
    color: var(--primary);
    background: rgba(255, 183, 3, 0.12);
}

.tag-chip {
    background: #8f6507;
    color: var(--text-white);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.tag-chip .close {
    cursor: pointer;
    opacity: 0.6;
    font-size: 1.1rem;
    line-height: 0.8;
    user-select: none;
}

.tag-chip .close:hover {
    opacity: 1;
}


.modal,
.lightbox {
    display: flex; 
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--overlay);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
    padding: 12px;
}


#tagCloudModal {
    z-index: 2100;
}

.modal-content,
.bulk-modal {
    background: var(--card);
    padding: 16px;
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 500px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-soft);
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 80vh;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border-bottom: 1px solid var(--border);
    padding: 0 2px 8px;
    margin: 0 0 4px;
}

.modal-header h3 {
    margin: 0;
    line-height: 1.2;
}

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

.settings-field-header {
    display: block;
    margin: 0 0 6px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.close-modal {
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
    color: var(--muted);
    padding: 2px 4px;
}

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


.cloud-tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    overflow-y: auto;
    padding: 2px;
    max-height: 60vh;
}

.cloud-tag {
    background: var(--accent-deep);
    color: var(--text-light);
    padding: 6px 12px;
    border-radius: 20px;
    cursor: pointer;
    border: 1px solid var(--accent-muted);
    font-size: 0.9rem;
    user-select: none;
}

.cloud-tag:hover {
    border-color: var(--accent-border);
    background: #78580a;
}

.cloud-tag.selected {
    background: var(--accent);
    color: var(--accent-ink);
    border-color: var(--accent-bright);
    box-shadow: 0 0 0 1px rgba(255, 183, 3, 0.45), 0 0 18px rgba(255, 183, 3, 0.18);
    font-weight: 700;
}


.lightbox-content {
    display: grid;
    grid-template-columns: 1fr 350px;
    width: 95%;
    max-width: 1600px;
    height: 90vh;
    background: var(--card);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-soft);
}

.lightbox-media-area {
    background: var(--bg-black);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.lightbox-media-area img,
.lightbox-media-area video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.lightbox-sidebar {
    background: var(--panel);
    border-left: 1px solid var(--border);
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    position: relative;
    z-index: 10;
}

.close-lightbox {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 40px;
    height: 40px;
    background: rgba(25, 17, 8, 0.7);
    border-radius: 50%;
    color: var(--text-white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    cursor: pointer;
    z-index: 100;
}

.close-lightbox:hover {
    background: var(--primary);
    color: var(--accent-ink);
}

.lb-section-title {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
    margin-bottom: 4px;
}

.lb-meta-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 5px 15px;
    font-size: 0.9rem;
}

.lb-meta-label {
    color: var(--text-muted);
    font-weight: 500;
}

.lb-meta-value {
    font-family: monospace;
    word-break: break-all;
}

.inkplate-simulated {
    filter: grayscale(100%) contrast(110%) brightness(95%)
        url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='grain'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='matrix' values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.60 0'/%3E%3CfeBlend in='SourceGraphic' mode='multiply'/%3E%3C/filter%3E%3C/svg%3E#grain");
}


.uploader-container {
    max-width: 1000px;
    margin: 0 auto;
    background: var(--card);
    padding: 2rem;
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-card);
    box-shadow: var(--shadow-soft);
}

.upload-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
}

#dropZone {
    border: 2px dashed var(--border);
    border-radius: 8px;
    padding: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    min-height: 350px;
    background: rgba(255, 183, 3, 0.04);
    transition: all 0.2s;
    cursor: pointer;
    position: sticky;
    top: 20px;
}

#dropZone.hover {
    border-color: var(--primary);
    background: rgba(255, 183, 3, 0.13);
}

.hidden-input {
    display: none;
}

.upload-controls {
    display: flex;
    flex-direction: column;
    gap: 15px;
    min-width: 0;
}


#pendingScroll {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 10px;
    margin-bottom: 10px;
    scrollbar-width: thin;
    scrollbar-color: var(--primary) var(--bg);
}

#uploadedScroll {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 10px;
    margin-bottom: 10px;
    scrollbar-width: thin;
    scrollbar-color: var(--primary) var(--bg);
}

#uploadedContainer {
    margin-top: 16px;
}

.pending-item {
    width: 136px;
    flex-shrink: 0;
    background: #1b1610;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    position: relative;
}

.uploaded-item {
    cursor: pointer;
}

.pending-media {
    position: relative;
    width: 100%;
    height: 96px;
    background: var(--bg-black);
}

.pending-thumb {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: var(--bg-black);
    cursor: zoom-in;
    transition: opacity 0.2s;
}

.pending-controls {
    position: absolute;
    left: 6px;
    right: 6px;
    bottom: 6px;
    display: flex;
    gap: 4px;
    z-index: 10;
    align-items: center;
}

.remove-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    background: rgba(22, 15, 7, 0.85);
    color: var(--accent-bright);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    cursor: pointer;
    font-size: 14px;
    border: 1px solid var(--accent-border);
    z-index: 20;
    transition: transform 0.1s;
    padding: 0;
    line-height: 1;
    pointer-events: auto;
}

.section-label {
    display: block;
    color: var(--text-muted);
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
}

.remove-btn:hover {
    background: #d8a21f;
    color: var(--accent-ink);
    transform: scale(1.1);
}

.mode-select-mini {
    width: calc(100% - 30px);
    min-width: 0;
    padding: 3px 6px;
    font-size: 0.74rem;
    background: rgba(22, 15, 7, 0.9);
    color: var(--text-white);
    border: 1px solid var(--accent-border);
    border-radius: 4px;
}

.rotate-btn {
    width: 26px;
    height: 26px;
    background: rgba(22, 15, 7, 0.9);
    color: var(--text-white);
    border: 1px solid var(--accent-border);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
}

.rotate-btn:hover {
    border-color: var(--primary);
    color: var(--text-white);
}


.progress-container {
    width: 100%;
    margin-top: 15px;
    background: #201910;
    border-radius: 8px;
    border: 1px solid var(--border);
    height: 32px;
    position: relative;
    overflow: hidden;
}

.progress-text-back,
.progress-text-front {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
}

.progress-text-back {
    color: var(--text-white);
    z-index: 1;
}

.progress-bar {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: var(--primary);
    width: 0%;
    transition: width 0.2s;
    overflow: hidden;
    z-index: 2;
}

.progress-text-front {
    color: var(--accent-ink);
}


.bulk-toolbar {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%) translateY(100%);
    width: 100%;
    max-width: var(--width-max);
    background: var(--card);
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid var(--border);
    border-bottom: none;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    transition: transform 0.3s;
    z-index: 900;
    box-shadow: 0 -5px 20px rgba(20, 14, 6, 0.65);
}

.bulk-toolbar.show {
    transform: translateX(-50%) translateY(0);
}

.bulk-info {
    font-weight: 600;
    color: var(--primary);
}

.bulk-actions {
    display: flex;
    gap: 10px;
}

.toast {
    visibility: hidden;
    min-width: 300px;
    background-color: #221a12;
    color: var(--text-white);
    text-align: center;
    border-radius: 8px;
    padding: 16px;
    position: fixed;
    z-index: 3000;
    left: 50%;
    transform: translateX(-50%);
    bottom: 30px;
    border: 1px solid #5a4829;
    box-shadow: var(--shadow-tooltip);
    opacity: 0;
    transition:
        opacity 0.3s,
        bottom 0.3s;
}

.toast.show {
    visibility: visible;
    opacity: 1;
    bottom: 50px;
}

.toast.success {
    border-color: var(--success);
    color: var(--success);
}

.toast.error {
    border-color: var(--accent-bright);
    color: var(--accent-bright);
}


@media (max-width: 900px) {
    .lightbox-content {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr auto;
        height: 100vh;
        width: 100%;
        border-radius: 0;
    }

    .lightbox-sidebar {
        height: 50vh;
        border-left: none;
        border-top: 1px solid var(--border);
        order: 2;
    }

    .lightbox-media-area {
        height: 50vh;
        order: 1;
    }

    .close-lightbox {
        top: 10px;
        right: 10px;
        user-select: none;
    }

    .upload-grid {
        grid-template-columns: 1fr;
    }

    #dropZone {
        min-height: 200px;
        position: static;
    }

    .bulk-toolbar {
        border-radius: 0;
        padding: 10px 20px;
        flex-direction: column;
        gap: 10px;
    }

    .bulk-actions {
        width: 100%;
        justify-content: space-between;
    }

    .bulk-actions button {
        flex-grow: 1;
    }
}

@media (max-width: 480px) {
    .header-container,
    .header-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .gallery-grid {
        grid-template-columns: 1fr;
    }

    .btn-view,
    .btn-save,
    .select-btn,
    .btn-link {
        width: 100%;
        display: flex;
        justify-content: center;
        margin-bottom: 10px;
        box-sizing: border-box;
    }

    .header-container .select-btn {
        margin-right: 0;
    }
}

.btn-view.active {
    background: var(--primary);
    color: var(--accent-ink);
    border-color: var(--primary);
}

.error-icon-container {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: var(--danger);
}

.error-icon-container svg {
    animation: error-pulse 1.1s ease-in-out infinite;
}

@keyframes error-pulse {
    0% {
        opacity: 0.55;
        transform: scale(0.92);
    }
    50% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0.55;
        transform: scale(0.92);
    }
}

.lightbox.preview-mode .lightbox-sidebar {
    display: none;
}

.lightbox.preview-mode .lightbox-content {
    grid-template-columns: 1fr;
}

.upload-controls label {
    display: block;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 5px;
}

#dropText {
    font-size: 1.1rem;
    color: var(--text-light);
    pointer-events: none;
    text-align: center;
    line-height: 1.4;
}
