body {
    display: flex;
    justify-content: center;
    background-color: rgb(203, 203, 203);
}

#uploader-wrapper {
    width: 95%;
    max-width: 1800px;
    margin: 20px auto;
    font-family: system-ui, -apple-system, sans-serif;
    border: 2px solid #ddd;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    background: #fff;
    overflow: hidden;
    transition: all 0.4s ease;
    position: relative;
}

#uploader-wrapper.drag-over {
    border-color: #007bff;
    background-color: #f0f7ff;
    transform: scale(1.005);
}

.form-shrunk {
    transform: scale(0.85);
    filter: blur(4px);
    pointer-events: none;
}

#title-page-section {
    padding: 25px 30px;
    background: #fdfdfd;
    border-bottom: 2px solid #eee;
    display: flex;
    align-items: center;
    gap: 25px;
}

.title-label {
    font-weight: bold;
    color: #444;
    width: 100px;
    font-size: 0.9rem;
    text-transform: uppercase;
}

input[name="page_title"] {
    width: 350px;
    padding: 12px;
    border: 2px solid #007bff;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    outline: none;
}

#history-sidebar {
    position: fixed;
    left: -340px;
    /* Increased slightly to ensure it's fully hidden including padding */
    top: 0;
    width: 300px;
    height: 100%;
    background: #1e1e1e;
    /* Slightly lighter than pure black for depth */
    color: #f8f9fa;
    z-index: 1000;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 25px;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
    overflow-y: auto;
    box-sizing: border-box;
    /* Crucial: includes padding in the 300px width */
}

#history-sidebar.open {
    left: 0;
}

.history-toggle {
    position: fixed;
    left: 20px;
    bottom: 20px;
    z-index: 1001;
    background: #495057;
    /* Matches your high-contrast file button */
    color: #fff;
    border: 1px solid #6c757d;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    padding: 10px 15px;
    border-radius: 50px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: bold;
    transition: all 0.2s ease;
}

.history-toggle:hover {
    background: #212529;
    transform: translateY(-2px);
}

.history-item {
    background: #2d2d2d;
    border-radius: 8px;
    padding: 14px;
    margin-bottom: 12px;
    font-size: 0.85rem;
    border-left: 4px solid #007bff;
    /* Matching your "Left" theme color */
    transition: background 0.2s ease;
}

.history-url {
    font-family: 'Courier New', Courier, monospace;
    color: #adb5bd;
    /* Subdued color for the URL so the Title pops */
    font-size: 0.75rem;
    word-break: break-all;
    display: block;
    margin-top: 5px;
    padding: 4px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

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

.hist-btn {
    background: #444;
    color: #fff;
    border: none;
    padding: 4px 8px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.7rem;
}

.close-sidebar {
    background: #333;
    color: #fff;
    border: 1px solid #444;
    border-radius: 4px;
    padding: 2px 8px;
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1;
    transition: all 0.2s ease;
}

.close-sidebar:hover {
    background: #444;
    border-color: #007bff;
    /* Highlights with your theme color */
    color: #007bff;
}

/* Optional: Hide the main floating toggle when the sidebar is open 
   to reduce visual clutter */
#history-sidebar.open~.history-toggle {
    opacity: 0;
    pointer-events: none;
}

.btn-copied {
    background-color: #28a745 !important;
    /* Success Green */
    border-color: #1e7e34 !important;
    transform: scale(0.98);
    /* Slight "pressed" effect */
}

#info-section {
    background: #1a1a1a;
    color: #fff;
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stat-box {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-box b {
    color: #00d4ff;
    font-size: 1.2rem;
}

.upload-row {
    padding: 18px 30px;
    border-bottom: 1px solid #eee;
    border-left: 6px solid transparent;
    transition: border-color 0.25s ease, background-color 0.25s ease, transform 0.1s ease;
}

.row-success {
    border-left-color: #28a745 !important;
    background-color: #f3faf4 !important;
}

.row-failed {
    border-left-color: #dc3545 !important;
    background-color: #fff5f5 !important;
}

.row-main {
    display: flex;
    gap: 25px;
    align-items: center;
}

input[name="titles[]"] {
    width: 350px;
    flex: none;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 0.95rem;
    background: linear-gradient(to right, #e3f2fd 0%, #fff 0%);
}

input[type="file"] {
    flex: 1;
    font-size: 0.9rem;
    color: #6c757d;
}

input[type="file"]::file-selector-button {
    margin-right: 20px;
    /* This creates the gap you're looking for */
    padding: 4px 8px;
    /* Makes the button itself look better */
    background-color: #495057;
    /* Dark Slate Gray */
    color: #ffffff;
    /* Pure White Text */
    border: 1px solid #343a40;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s;
}

input[type="file"]::file-selector-button:hover {
    background-color: #212529;
    /* Near Black on hover */
    border-color: #000000;
}

.remove-btn {
    background: #ff4d4d;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
}

.metadata {
    margin-left: 55px;
    margin-top: 8px;
    font-size: 0.8rem;
    display: flex;
    gap: 12px;
    align-items: center;
    min-height: 24px;
}

.meta-tag {
    background: #eee;
    color: #444;
    padding: 2px 10px;
    border-radius: 4px;
    border: 1px solid #ccc;
}

.token-container {
    display: flex;
    justify-content: center;
    padding: 25px;
    background: #fff;
    border-top: 1px solid #eee;
}

.token-field {
    width: 400px;
    text-align: center;
    padding: 12px;
    /* Neutral border and text */
    border: 1px solid #ced4da;
    color: #495057;
    background-color: #f8f9fa;

    font-weight: 500;
    border-radius: 8px;
    outline: none;
    transition: all 0.2s ease-in-out;
}

/* Subtle "Active" state when clicking */
.token-field:focus {
    border-color: #007bff;
    background-color: #fff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

/* Placeholder should be even lighter */
.token-field::placeholder {
    color: #adb5bd;
    font-weight: 400;
}

.token-field.is-invalid {
    border-color: #dc3545 !important;
    color: #dc3545 !important;
    background-color: #fff5f5;
}

.status-msg {
    font-weight: 700;
    font-size: 0.75rem;
    margin-left: 10px;
    padding: 2px 8px;
    border-radius: 4px;
}

.status-msg.ok {
    color: #28a745;
    border: 1px solid #28a745;
}

.status-msg.err {
    color: #dc3545;
    border: 1px solid #dc3545;
    background: #fff;
}

.btn-group {
    padding: 20px 30px;
    background: #f8f9fa;
    display: flex;
    justify-content: center;
    gap: 15px;
}

.btn {
    padding: 12px 28px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.8rem;
}

.btn-upload {
    background: #007bff;
    color: white;
    width: 100%;
    max-width: 400px;
}

#modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 100;
    align-items: center;
    justify-content: center;
}

#success-modal {
    width: 100%;
    background: #fff;
    padding: 50px 0;
    text-align: center;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.4);
}

.url-box {
    display: inline-block;
    padding: 15px 40px;
    background: #f8f9fa;
    border: 2px dashed #007bff;
    border-radius: 8px;
    font-weight: bold;
    margin: 20px 0;
    font-family: monospace;
    font-size: 1.5rem;
    color: #007bff;
}

.btn-home {
    background: #6c757d;
    color: white;
    padding: 8px 20px;
    font-size: 0.7rem;
    opacity: 0.8;
    margin-top: 20px;
}

.counter {
    width: 30px;
    font-weight: bold;
    color: #999;
}

/* Selection Group Container */
.selection-group {
    display: flex;
    gap: 12px;
    margin: 0 15px;
    align-items: center;
    border-left: 1px solid #ddd;
    padding-left: 15px;
}

/* Label Styling */
.selection-label {
    font-size: 0.75rem;
    font-weight: bold;
    color: #555;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.2s;
}

.selection-label:hover {
    background: #f0f0f0;
}

/* Highlight the row if either L or R is checked */
.upload-row:has(.cb-left:checked),
.upload-row:has(.cb-right:checked) {
    background-color: #fffdec;
    /* Light highlight */
    border-left-color: #ffd700;
}

/* Specific highlight for Left vs Right */
/* Highlighting the active selections */
.upload-row:has(.cb-left:checked) {
    border-left: 6px solid #007bff !important;
    background-color: #f0f7ff;
}

.upload-row:has(.cb-right:checked) {
    border-left: 6px solid #ffc107 !important;
    /* Material Design Amber/Gold */
    background-color: #fffdec;
    /* Very light cream */
}

.selection-label:has(input:checked) {
    background: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border: 1px solid #ddd;
}

#toolbar-section {
    padding: 10px 30px;
    background: #f1f1f1;
    border-bottom: 1px solid #ddd;
    display: flex;
    align-items: center;
    gap: 20px;
}

.toolbar-item {
    display: flex;
    align-items: center;
}

.toggle-container {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    user-select: none;
}

.toggle-container input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #007bff;
    /* Matches your primary blue */
}

.toggle-container:hover {
    color: #333;
}

.label-note {
    font-size: 0.65rem;
    color: #888;
    text-transform: none;
    font-weight: normal;
    margin-top: 2px;
    opacity: 0.6;
    margin-left: 5px;
    font-weight: 400;
}

/* The Spinner Animation */
@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Spinner Element */
.spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    border-top-color: #00d4ff;
    /* Match your blue theme */
    animation: spin 0.8s linear infinite;
    vertical-align: middle;
    margin-right: 8px;
}

/* Row-level loading state */
.upload-row.is-loading {
    background: rgba(0, 212, 255, 0.05);
    transition: background 0.3s ease;
}