/* ========================================
   PDF Compressor Premium Styling
   ======================================== */

.compressor-body {
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    /* Speed up body transition & remove heavy page fade-in delay for instant loading */
    animation: pageFadeIn 0.15s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.compressor-main {
    flex: 1;
    display: flex;
    max-width: 100%;
    overflow: hidden;
    max-height: calc(100vh - 70px);
}

@media (max-width: 1024px) {
    .compressor-main {
        flex-direction: column;
        max-height: none;
    }
}

.tool-container {
    display: flex;
    flex: 1;
    width: 100%;
}

@media (max-width: 1024px) {
    .tool-container {
        flex-direction: column;
    }
}

/* Sidebar Controls */
.control-panel {
    width: 380px;
    background: var(--bg-card);
    border-right: 1px solid var(--border-color);
    padding: 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 24px;
    box-shadow: var(--shadow-sm);
}

@media (max-width: 1024px) {
    .control-panel {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
}

.panel-section {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    padding: 20px;
    border-radius: var(--radius-md);
}

.panel-section h3 {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.panel-section h3 i {
    color: var(--danger);
}

/* Inputs & Ranges */
.input-group {
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.input-group:last-child {
    margin-bottom: 0;
}

.input-group label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.input-group select {
    width: 100%;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    outline: none;
}

.input-group select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.input-group input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--bg-tertiary);
    outline: none;
    margin: 8px 0;
}

.input-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--danger);
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.range-val {
    font-size: 11px;
    font-weight: 700;
    color: var(--danger);
    align-self: flex-end;
    margin-top: -4px;
}

/* Stats panel card */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.stat-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-card.span-all {
    grid-column: span 2;
    align-items: center;
    background: rgba(16, 185, 129, 0.05);
    border-color: rgba(16, 185, 129, 0.2);
}

.stat-card span {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
}

.stat-card strong {
    font-size: 15px;
    font-weight: 800;
}

.success-text {
    color: #10b981;
}

/* Buttons */
.action-btn {
    width: 100%;
    padding: 12px;
    font-size: 14px;
    font-weight: 700;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: white;
}

.action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.run-btn {
    background: linear-gradient(135deg, var(--danger) 0%, #dc2626 100%);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.15);
}

.run-btn:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(239, 68, 68, 0.35);
}

.download-btn {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.15);
}

.download-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.35);
}

/* Progress bar */
.progress-container {
    margin-top: 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}

.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 30%;
    background: var(--danger);
    border-radius: 3px;
    animation: progAnim 1.5s infinite ease-in-out;
}

@keyframes progAnim {
    0% { left: -30%; }
    100% { left: 100%; }
}

.progress-text {
    font-size: 11px;
    font-weight: 700;
    color: var(--danger);
    text-align: center;
}

/* Preview / Workspace Panel */
.preview-panel {
    flex: 1;
    background: var(--bg-tertiary);
    padding: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
}

.upload-dropzone {
    width: 100%;
    max-width: 600px;
    background: var(--bg-card);
    border: 2px dashed #bbb;
    border-radius: var(--radius-lg);
    padding: 60px 40px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.upload-dropzone:hover {
    border-color: var(--danger);
    background: rgba(239, 68, 68, 0.01);
}

.upload-dropzone h2 {
    font-size: 20px;
    font-weight: 800;
}

.upload-dropzone p {
    font-size: 13px;
    color: var(--text-secondary);
}

.browse-btn {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    padding: 10px 24px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
}

.browse-btn:hover {
    border-color: var(--danger);
    background: var(--bg-tertiary);
}

/* Workspace preview */
.workspace-area {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    width: 100%;
    max-width: 900px;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 500px;
    box-shadow: var(--shadow-md);
}

.pdf-page-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
    overflow-y: auto;
    max-height: 550px;
    padding: 10px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.page-thumb-wrapper {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    box-shadow: var(--shadow-sm);
}

body.dark-theme .page-thumb-wrapper {
    background: #1e293b;
}

.page-thumb-canvas {
    max-width: 100%;
    height: 200px;
    object-fit: contain;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.page-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
}

/* Mode Selector styling matching PDF Compressor Red theme */
.mode-selector {
    display: flex;
    background: var(--bg-primary);
    padding: 4px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    gap: 4px;
}

.mode-btn {
    flex: 1;
    padding: 10px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.mode-btn.active {
    background: var(--danger);
    color: white;
    box-shadow: var(--shadow-sm);
}

.input-group-compressor {
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.input-group-compressor label {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
}
