/* ========================================================
   INITIAL UPLOAD ZONE LAYOUT
   ======================================================== */
.tool-container {
    max-width: 800px;
    margin: 80px auto;
    padding: 0 20px;
}

.tool-header {
    text-align: center;
    margin-bottom: 40px;
}

.tool-header h1 {
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.tool-header p {
    color: #6b778c;
}

.upload-card {
    background: #ffffff;
    border-radius: 8px;
    padding: 30px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.04);
    border: 1px solid #dfe1e6;
}

.drop-zone {
    border: 2px dashed #e52521;
    border-radius: 8px;
    padding: 60px 20px;
    text-align: center;
    cursor: pointer;
    background: #fafbfc;
    transition: all 0.3s ease;
}

.drop-zone:hover {
    background: #fdf3f3;
    border-color: #b91c1c;
}

.upload-icon {
    font-size: 3.5rem;
    color: #e52521;
    margin-bottom: 15px;
}

/* ========================================================
   PREMIUM DOUBLE-COLUMN WORKSPACE VIEW (Fixed Height App)
   ======================================================== */
.split-workspace {
    display: grid;
    grid-template-columns: 320px 1fr;
    height: calc(100vh - 80px); /* Fill entire screen below header */
    background-color: #f4f5f7;
    overflow: hidden;
}

/* --- Left Sidebar: Thumbnails Panel --- */
.preview-sidebar {
    background: #ffffff;
    border-right: 1px solid #dfe1e6;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #dfe1e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #ffffff;
    z-index: 10;
}

.sidebar-header h4 {
    font-size: 1rem;
    color: #172b4d;
    margin: 0;
}

.sidebar-header .badge {
    background: #ebecf0;
    color: #42526e;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
}

/* FIXED: Smooth Scrollable Grid Wrapper */
.thumbnail-scroll-grid {
    flex-grow: 1;
    overflow-y: auto; /* Vertically scroll active */
    max-height: calc(100vh - 145px); /* Keeps borders inside view bounds */
    padding: 20px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    background: #fafbfc;
}

/* Custom Scrollbar styling for professional UI look */
.thumbnail-scroll-grid::-webkit-scrollbar {
    width: 6px;
}
.thumbnail-scroll-grid::-webkit-scrollbar-track {
    background: #fafbfc;
}
.thumbnail-scroll-grid::-webkit-scrollbar-thumb {
    background: #c1c7d0;
    border-radius: 4px;
}
.thumbnail-scroll-grid::-webkit-scrollbar-thumb:hover {
    background: #a5adba;
}

.thumb-wrapper {
    background: #fff;
    border: 1px solid #dfe1e6;
    border-radius: 6px;
    padding: 12px;
    text-align: center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.02);
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.thumb-wrapper:hover {
    border-color: #e52521;
    transform: translateY(-2px);
}

.thumb-wrapper canvas {
    max-width: 100%;
    height: auto;
    border: 1px solid #ebecf0;
    border-radius: 4px;
}

.thumb-page-num {
    margin-top: 10px;
    font-size: 0.82rem;
    font-weight: 600;
    color: #6b778c;
}

/* --- Right Control Panel: Operations --- */
.control-panel {
    padding: 30px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
    height: 100%;
}

.file-meta-bar {
    background: #ffffff;
    border: 1px solid #dfe1e6;
    padding: 15px 20px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 6px rgba(9, 30, 66, 0.02);
}

.file-meta-bar span i {
    color: #e52521;
    margin-right: 8px;
}

.clear-btn-cross {
    background: none;
    border: none;
    color: #6b778c;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    transition: color 0.2s ease;
}

.clear-btn-cross:hover {
    color: #e52521;
}

.operations-box {
    background: #ffffff;
    border: 1px solid #dfe1e6;
    border-radius: 8px;
    padding: 30px;
    box-shadow: 0 4px 12px rgba(9, 30, 66, 0.03);
}

.operations-box h3 {
    font-size: 1.2rem;
    color: #172b4d;
    margin-bottom: 20px;
}

.config-card-option {
    border: 1px solid #dfe1e6;
    background: #fafbfc;
    border-radius: 6px;
    padding: 20px;
    margin-bottom: 15px;
    transition: all 0.2s ease;
}

.config-card-option.active-opt {
    border-color: #e52521;
    background: #ffffff;
    box-shadow: 0 4px 10px rgba(229, 37, 33, 0.02);
}

.opt-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    color: #172b4d;
    cursor: pointer;
}

.opt-label input[type="radio"] {
    accent-color: #e52521;
    width: 16px;
    height: 16px;
}

.opt-body {
    margin-top: 15px;
    padding-left: 26px;
}

.opt-body input[type="text"] {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid #dfe1e6;
    border-radius: 6px;
    outline: none;
    font-family: inherit;
    font-size: 0.95rem;
    transition: border-color 0.2s ease;
}

.opt-body input[type="text"]:focus {
    border-color: #e52521;
}

.help-text {
    color: #6b778c;
    font-size: 0.82rem;
    margin-top: 6px;
    line-height: 1.4;
}

.help-text-muted {
    color: #7a869a;
    font-size: 0.88rem;
    margin: 0;
    line-height: 1.5;
}

.merge-checkbox-row {
    margin-top: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.merge-checkbox-row input[type="checkbox"] {
    accent-color: #e52521;
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.merge-checkbox-row label {
    font-size: 0.9rem;
    font-weight: 500;
    color: #172b4d;
    cursor: pointer;
    user-select: none;
}

.run-split-action {
    width: 100%;
    padding: 15px;
    font-size: 1.1rem;
    margin-top: 10px;
}

/* ========================================================
   GLOBAL LAYOUT HELPERS & ALERTS
   ======================================================== */
.hidden-element {
    display: none !important;
}

.status-box {
    padding: 15px;
    border-radius: 6px;
    text-align: center;
    font-weight: 500;
}
.status-box.error { background: #fdeaea; color: #e52521; }
.status-box.success { background: #eaf6ed; color: #107c41; }

/* Responsive adjustments */
@media (max-width: 768px) {
    .split-workspace {
        grid-template-columns: 1fr;
        height: auto;
    }
    .preview-sidebar {
        height: 350px;
        border-right: none;
        border-bottom: 1px solid #dfe1e6;
    }
    .thumbnail-scroll-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        max-height: 100%;
    }
}
