body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: #1a1a1a;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
}

.navbar {
    position: static;
    background-color: #2d2d2d;
    border-bottom: 1px solid #404040;
    margin-bottom: 0;
    padding: 0 15px;
    height: 90px;
    min-height: 56px;
    display: flex;
    align-items: center;
}

.navbar .container-fluid {
    display: flex;
    align-items: center;
    height: 100%;
    padding: 0;
}

.navbar .metadata-container {
    display: flex;
    align-items: center;
    max-width: 70%;
    height: 100%;
}

.navbar-expand-md .navbar-collapse {
    justify-content: center;
}

.dropdown-toggle {
    color: #fff;
    background-color: transparent;
    border: 1px solid rgb(255 255 255 / 10%);
}

.dropdown-toggle:hover {
    background-color: rgb(255 255 255 / 10%);
}

.dropdown-menu {
    background-color: #2d2d2d;
    border: 1px solid #404040;
}

.dropdown-item {
    color: #e0e0e0;
}

.dropdown-item:hover {
    background-color: #404040;
    color: #fff;
}

.mobile-controls {
    width: 100%;
    padding: 10px;
}

.mobile-controls .dropdown-menu {
    width: 100%;
    max-height: 300px;
}

.comparison-name {
    font-weight: bold;
    margin-right: 10px;
}

.show-name {
    margin: 0 10px;
}

.metadata-container .tags {
    margin-left: 10px;
}

.metadata-container .badge {
    margin: 0 2px;
}

.comparison-container {
    max-width: 100%;
    margin: 0 auto;
    text-align: center;
    position: relative;
}

.comparison-container:not(.fit-mode) {
    padding: 0;
}

.metadata-form {
    margin: 20px 0;
    padding: 20px;
    background: #2d2d2d;
    color: #e0e0e0;
    box-shadow: 0 2px 4px rgb(0 0 0 / 10%);
    border-radius: 8px;
    border: 1px solid #404040;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.form-group input {
    width: 100%;
    padding: 8px;
    border: 1px solid #404040;
    background-color: #333;
    color: #e0e0e0;
    border-radius: 4px;
}

.form-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 20px;
    margin-bottom: 15px;
}

.main-field {
    flex: 1;
    min-width: 250px;
    margin-bottom: 0;
}

.optional-fields {
    display: flex;
    gap: 15px;
}

.hidden-field {
    margin-top: -5px;
    margin-bottom: 20px;
    padding-left: 10px;
    border-left: 2px solid #404040;
    transition: all 0.3s ease;
}

.form-check {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.form-check-input {
    margin-right: 8px;
    width: 18px;
    min-width: 18px;
    height: 18px;
    cursor: pointer;
}

.form-check-input[type="radio"] {
    border-radius: 50% !important;
    width: 18px;
    height: 18px;
}

.form-check-input[type="radio"]:checked {
    background-size: 12px;
}

.form-check-label {
    color: #fff;
    cursor: pointer;
    user-select: none;
}

#show-name-container,
#tags-container {
    transition: all 0.3s ease;
    margin-left: 25px;
}

.tag {
    display: inline-block;
    padding: 4px 8px;
    margin: 2px;
    background: #e9ecef;
    border-radius: 4px;
    font-size: 0.9em;
}

.upload-area {
    border: 2px dashed #404040;
    border-radius: 8px;
    padding: 40px;
    text-align: center;
    background-color: #2d2d2d;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 20px 0;
}

.upload-area:hover {
    border-color: #666;
    background-color: #333;
}

.upload-area.dragover {
    border-color: #2196f3;
    background-color: #e3f2fd;
    box-shadow: 0 0 10px rgb(33 150 243 / 30%);
}

.upload-area p {
    color: #e0e0e0;
    font-size: 1.1em;
    margin: 0;
}

#upload-button {
    display: block;
    background-color: #2196f3;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 1.1em;
    cursor: pointer;
    margin: 20px auto;
    transition: all 0.3s ease;
}

#upload-button:hover {
    background-color: #1976d2;
    transform: translateY(-1px);
}

#upload-button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.progress-bar-container {
    width: 100%;
    margin-top: 15px;
}

.progress-text {
    margin-top: 5px;
    color: #e0e0e0;
    font-size: 0.9em;
}

.comparison-column {
    margin: 10px;
    padding: 15px;
    background: #2d2d2d;
    border: 1px solid #404040;
    border-radius: 4px;
    width: calc((100% - (var(--column-count, 2) - 1) * 20px) / var(--column-count, 2));
    min-width: 200px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 2px 4px rgb(0 0 0 / 10%);
}

.column-controls {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 10px;
}

.column-controls button {
    margin-left: 5px;
}

.column-controls button[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}

.column-controls button[disabled]:hover {
    background-color: #dc3545;
}

.column-files {
    width: 100%;
    height: 100%;
    min-height: 120px;
    display: grid;
    grid-template-rows: auto;
    gap: 15px;
    padding: 10px;
}

.current-row {
    border: 2px solid #2196f3;
}

.image-viewer {
    width: 100%;
    position: relative;
    background: #1a1a1a;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    margin-top: 0;
    padding: 0 0 20px;
    scroll-padding-top: 0;
}

.comparison-image {
    position: relative;
    transition:
        object-fit 0.3s ease,
        transform 0.2s ease-in-out;
    cursor: move;
    transform-origin: center center;
    margin-top: 0;
    margin-left: 0;
    margin-right: 0;
}

.comparison-image.fit {
    max-width: 100%;
    max-height: calc(
        100vh - 76px
    ); /* Fallback for browsers that might not support dvh */

    max-height: calc(100dvh - 76px);
    margin: 0 !important;

    /* transform: none !important; */
    cursor: pointer;
    object-fit: contain;
    position: relative;
    top: 0;
    left: 0;
    padding: 0;
}

.navigation-dots {
    margin: 20px 0;
}

.column-navigation {
    margin: 10px 0;
    display: flex;
    justify-content: center;
}

.dot {
    height: 12px;
    width: 12px;
    margin: 0 5px;
    background-color: #bbb;
    border-radius: 50%;
    display: inline-block;
    cursor: pointer;
    transition: background-color 0.3s;
}

.dot.active {
    background-color: #717171;
}

.image-counter {
    font-size: 1.2em;
    color: #666;
    margin: 10px 0;
}

.upload-instructions {
    padding: 15px;
    background: #2d2d2d;
    border-radius: 5px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #e0e0e0;
}

.upload-instructions code {
    background: #404040;
    padding: 2px 5px;
    border-radius: 3px;
    color: #0f0;
}

.comparison-group {
    margin: 20px 0;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
}

.group-files {
    display: flex;
    gap: 10px;
    flex-direction: column;
}

.file-preview {
    text-align: center;
    margin-bottom: 15px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
    max-width: 100%;
    position: relative;
    cursor: pointer;
    transition: all 0.2s ease;
}

.file-preview:hover img {
    opacity: 0.7;
}

.replace-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgb(0 0 0 / 70%);
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.file-dragover .replace-overlay {
    opacity: 1 !important;
    background-color: rgb(33 150 243 / 80%);
}

.file-preview:hover .replace-overlay {
    opacity: 1;
}

.file-label {
    margin-top: 5px;
    font-size: 0.9em;
    color: #666;
    white-space: nowrap;
    max-width: 100%;
}

.error-message {
    color: #ff6b6b;
    margin: 10px 0 15px;
    padding: 10px;
    background: #ffebee;
    border-radius: 4px;
}

.row-navigation {
    margin: 10px 0;
    text-align: center;
}

.column-indicator {
    display: inline-block;
    height: 12px;
    width: 12px;
    margin: 0 5px;
    background-color: #bbb;
    border-radius: 50%;
    cursor: pointer;
    transition: background-color 0.3s;
}

.column-indicator.active {
    background-color: #717171;
}

.column-management {
    margin: 20px 0;
    text-align: center;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    border-radius: 0.2rem;
}

.btn-danger {
    background-color: #dc3545;
    color: white;
}

#add-column-btn {
    margin: 10px 0;
}

#add-row-btn {
    margin: 10px 0;
}

.footer {
    background-color: #2d2d2d !important;
    border-top: 1px solid #404040;
}

.footer .text-muted,
.footer .fab {
    color: #e0e0e0 !important;
}

.footer a:hover .fab {
    color: #fff !important;
}

.drag-handle {
    cursor: grab;
    padding: 5px;
    margin-right: 5px;
    color: #aaa;
    background: #333;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
}

.drag-handle:hover {
    color: white;
    background: #444;
}

.comparison-column.dragging {
    opacity: 0.5;
    border: 2px dashed #666;
}

.comparison-column.drag-over {
    border: 2px dashed #3498db;
}

.row-columns > .comparison-column {
    flex-basis: 0;
    flex-grow: 1;
}

#preview.reordering .comparison-column {
    transition: transform 0.2s ease;
}

.column-controls-bar {
    display: flex;
    flex-direction: row;
    width: 100%;
    margin-bottom: 10px;
    gap: 15px;
    padding-bottom: 5px;
}

.column-header {
    display: flex;
    flex: 1;
    min-width: 200px;
    max-width: calc(100% / var(--column-count, 2));
    width: calc((100% - (var(--column-count, 2) - 1) * 20px) / var(--column-count, 2));
    align-items: center;
    padding: 8px;
    margin: 10px;
    background: #2d2d2d;
    border-radius: 4px 4px 0 0;
    justify-content: space-between;
    box-shadow: 0 2px 4px rgb(0 0 0 / 10%);
}

.row-container {
    display: flex;
    flex-direction: column;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #444;
    width: 100%;
}

.row-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding: 5px;
    background: #2d2d2d;
    border-radius: 4px;
}

.row-columns {
    display: flex;
    flex-flow: row nowrap;
    gap: 15px;
    padding-bottom: 10px;
    width: 100%;
}

.column-controls-bar > .column-header {
    flex-basis: 0;
    flex-grow: 1;
}

.cell-drop-zone {
    width: 100%;
    height: 90px;
    border: 2px dashed #555;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background-color: #333;
    position: relative;
    margin-bottom: 10px;
}

.cell-drop-zone:hover {
    border-color: #777;
    background-color: #3a3a3a;
}

.cell-drop-zone.cell-dragover {
    border-color: #2196f3;
    background-color: #1e1e1e;
    box-shadow: 0 0 10px rgb(33 150 243 / 30%);
}

.drop-instructions {
    text-align: center;
    color: #aaa;
}

.drop-instructions i {
    font-size: 24px;
    margin-bottom: 10px;
}

.remove-file-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    z-index: 10;
    opacity: 0.7;
    cursor: pointer;
}

.remove-file-btn:hover {
    opacity: 1;
}

#preview {
    display: flex;
    flex-direction: column;
    width: 100%;
    padding: 15px;
    background: #1a1a1a;
    border-radius: 8px;
    margin: 20px 0;
    overflow-x: auto;
}

.expiration-options {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 15px;
    margin-top: 5px;
}

.expiration-days-container {
    display: flex;
    align-items: center;
}

.form-select {
    padding: 8px;
    border: 1px solid #404040;
    background-color: #333;
    color: #e0e0e0;
    border-radius: 4px;
}

.expiration-info {
    margin-left: 10px;
    display: inline-block;
}

.expiration-info .badge {
    background-color: #17a2b8;
}

#rename-column-modal .modal-content {
    background-color: #2d2d2d;
    color: #e0e0e0;
}

#name-preview {
    background-color: #1a1a1a;
    padding: 10px;
    border-radius: 4px;
}

.login-container {
    max-width: 400px;
    margin: 50px auto;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 0 10px rgb(0 0 0 / 30%);
    background-color: #2d2d2d;
}

.card {
    padding: 20px;
    background-color: #2d2d2d;
    border: 1px solid #404040;
    border-radius: 8px;
    box-shadow: 0 0 10px rgb(0 0 0 / 30%);
}

.admin-container {
    max-width: 800px;
    margin: 50px auto;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 0 10px rgb(0 0 0 / 30%);
    background-color: #2d2d2d;
    color: #e0e0e0;
}

.invitation-code {
    font-family: monospace;
    background-color: #333;
    padding: 5px 10px;
    border-radius: 4px;
    border: 1px solid #404040;
    color: #e0e0e0;
}

.used-code {
    text-decoration: line-through;
    color: #999;
}

.account-container {
    max-width: 800px;
    margin: 50px auto;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 0 10px rgb(0 0 0 / 30%);
    background-color: #2d2d2d;
    color: #e0e0e0;
}

.comparison-card {
    margin-bottom: 15px;
    border-radius: 5px;
    padding: 15px;
    background-color: #333;
    border: 1px solid #404040;
}

.comparison-card:hover {
    background-color: #3a3a3a;
}

.comparison-title {
    font-weight: bold;
    margin-bottom: 5px;
}

.comparison-meta {
    font-size: 0.9em;
    color: #aaa;
}

.never-expire-badge {
    background-color: #28a745;
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.8em;
}

.toast-container {
    position: fixed;
    display: block !important;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    flex-direction: column;
    gap: 10px;
    max-width: 350px;
}

.toast {
    background-color: #fff;
    display: flex !important;
    color: #333;
    padding: 15px 20px !important;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgb(0 0 0 / 15%);
    align-items: flex-start;
    animation: toast-in 0.3s ease-out forwards;
    margin-bottom: 10px;
}

.toast-content {
    flex: 1;
    display: flex;
    align-items: center;
}

.toast.error {
    border-left: 4px solid #f44336 !important;
    background-color: #fff0f0 !important;
    animation:
        toast-in-error 0.3s ease-out forwards,
        toast-pulse-error 2s infinite;
}

.toast.success {
    border-left: 4px solid #4caf50 !important;
    background-color: #f0fff0 !important;
    animation: toast-in 0.3s ease-out forwards;
}

.toast.warning {
    border-left: 4px solid #ff9800 !important;
    background-color: #fffaf0 !important;
    animation:
        toast-in 0.3s ease-out forwards,
        toast-pulse-warning 2s infinite;
}

.toast-icon {
    margin-right: 10px;
    font-size: 18px;
}

.toast-message {
    font-size: 14px;
    font-weight: 500;
}

.toast .toast-close {
    margin-left: 10px;
    cursor: pointer;
    font-weight: bold;
    font-size: 18px;
    color: #999;
}

@keyframes toast-in {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes toast-out {
    from {
        transform: translateX(0);
        opacity: 1;
    }

    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

@keyframes toast-pulse-error {
    0%,
    100% {
        box-shadow: 0 4px 12px rgb(244 67 54 / 15%);
    }

    50% {
        box-shadow: 0 4px 20px rgb(244 67 54 / 30%);
    }
}

#bbcode-text {
    font-family: monospace;
    color: #fff;
    background-color: #333;
    resize: none;
}

#bbcode-modal .modal-dialog {
    max-width: 800px;
}

.modal-header {
    background-color: #2d2d2d;
    border-bottom: 1px solid #404040;
}

.modal-body {
    background-color: #2e2e2e;
    color: #e0e0e0;
}

.modal-footer {
    background-color: #2d2d2d;
    border-bottom: 1px solid #404040;
}

.btn-group select.btn-secondary:hover {
    background-color: #404040;
    border-color: #505050;
}

.btn-group select.btn-secondary:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgb(255 255 255 / 25%);
}

.btn-group select.btn-secondary option {
    background-color: #212529;
    color: #fff;
    padding: 8px;
}

#image-rendering,
#mobile-image-rendering {
    background-color: #212529;
    color: #fff;
    border: 1px solid #404040;
}

#image-rendering option,
#mobile-image-rendering option {
    background-color: #212529;
    color: #fff;
    padding: 8px;
}

#image-rendering option:hover,
#mobile-image-rendering option:hover {
    background-color: #404040;
}

#preload-indicator {
    z-index: 1000;
    animation: fade-in-out 2s infinite;
}

@keyframes fade-in-out {
    0%,
    100% {
        opacity: 0.7;
    }

    50% {
        opacity: 1;
    }
}
