body {
    font-family: 'Segoe UI', Arial, sans-serif;
    background: #e8ecef;
    margin: 0px; /* Changed from 0px to 0 */
    color: #333;
}

/* Ensure content is centered and has max width */
body > h1,
body > h2,
body > div,
body > button {
    max-width: 900px; /* Max width for main content */
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box; /* Include padding/border in width */
}

h1, h2 {
    color: #2c3e50;
    text-align: center;
    margin-bottom: 20px;
}

#comp-dropZone {
    border: 3px dashed #6c757d;
    padding: 20px;
    text-align: center;
    background: #f8f9fa;
    margin-bottom: 20px;
    cursor: pointer;
    border-radius: 8px;
    display: block;
}

#comp-dropZone label {
    display: block;
    cursor: pointer;
    font-size: 16px;
    color: #495057;
}

#comp-dropZone:hover {
    background: #e9ecef;
}

#comp-dropZone.dragover {
    border-color: #007bff;
    background: #e7f1ff;
}

.comp-hidden {
    display: none !important;
}

#comp-fileGrid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

@media (max-width: 600px) {
    #comp-fileGrid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    }
}

.comp-file-card {
    border: 1px solid #dee2e6;
    padding: 12px;
    background: #fff;
    border-radius: 8px;
    text-align: center;
    transition: background 0.2s;
    display: flex; /* Make card a flex container */
    flex-direction: column; /* Stack content vertically */
    justify-content: space-between; /* Space out content vertically */
}

.comp-file-card:hover {
    background: #f1f3f5;
}

.comp-file-card img,
.comp-file-card video {
    max-width: 110px;
    max-height: 110px;
    object-fit: contain; /* Use contain to ensure full image is visible */
    margin: 0 auto 8px auto; /* Center image/video */
    cursor: pointer;
    border-radius: 4px;
}

.comp-file-card p {
    margin: 5px 0;
    font-size: 13px;
    color: #343a40;
    word-break: break-word; /* Allow long filenames to break */
}

.comp-file-card .comp-status {
    color: #6c757d;
    font-size: 11px;
}

.comp-file-card .comp-status.comp-failed {
    color: #dc3545;
}

.comp-file-card .comp-size-initial,
.comp-file-card .comp-size-compressed {
    font-size: 11px;
    color: #495057;
}

.comp-file-card .comp-size-initial::after {
    content: " | ";
}

/* Progress bar styles */
.comp-file-card .comp-progress-bar-container {
    width: 100%;
    background-color: #e9ecef;
    border-radius: 5px;
    height: 6px;
    margin-top: 5px;
    overflow: hidden;
}

.comp-file-card .comp-progress-bar {
    height: 100%;
    width: 0%;
    background-color: #007bff;
    border-radius: 5px;
    transition: width 0.1s ease-in-out; /* Smooth progress updates */
}


.comp-file-card .comp-download-btn,
.comp-file-card .comp-remove-btn {
    padding: 6px 12px;
    margin-top: 8px;
    margin-right: 5px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    transition: background 0.2s;
}

.comp-file-card .comp-download-btn {
    background: linear-gradient(45deg, #28a745, #34c759);
    color: #fff;
}

.comp-file-card .comp-download-btn:hover {
    background: linear-gradient(45deg, #218838, #2db44a);
}

.comp-file-card .comp-download-btn:disabled {
    background: #adb5bd;
    cursor: not-allowed;
}

.comp-file-card .comp-remove-btn {
    background: linear-gradient(45deg, #dc3545, #ff4d4d);
    color: #fff;
}

.comp-file-card .comp-remove-btn:hover {
    background: linear-gradient(45deg, #c82333, #e63939);
}

/* Main action buttons */
button {
    padding: 12px 24px;
    margin-right: 12px;
    margin-bottom: 10px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    background: linear-gradient(45deg, #007bff, #00a8ff);
    color: #fff;
    font-size: 14px;
    transition: background 0.2s;
}

button:hover {
    background: linear-gradient(45deg, #0056b3, #0086cc);
}

button:disabled {
    background: #adb5bd;
    cursor: not-allowed;
}

/* Compression Options Section Styles */
.comp-options-container {
    background: #f8f9fa;
    border: 1px solid #e0e6ed;
    border-radius: 8px;
    padding: 15px 20px; /* Slightly more horizontal padding */
    margin-bottom: 20px;
    display: grid; /* Use grid for the container to align option groups */
    grid-template-columns: 1fr; /* Default to single column */
    gap: 10px; /* Reduced gap between option groups */
}

/* Adjust for larger screens to have two columns */
@media (min-width: 768px) {
    .comp-options-container {
        grid-template-columns: repeat(2, 1fr); /* Two columns for larger screens */
        gap: 20px; /* More gap between columns */
    }
}

.comp-options-container h3 {
    grid-column: 1 / -1; /* Make heading span all columns */
    margin-top: 0;
    color: #2c3e50;
    border-bottom: 1px solid #e9ecef;
    padding-bottom: 10px;
    margin-bottom: 15px;
    text-align: center; /* Center the heading */
}

.comp-option-group {
    display: flex;
    flex-direction: column; /* Stack label and input vertically by default */
    align-items: flex-start; /* Align items to the start */
    gap: 5px; /* Reduced gap between label/input/span */
    margin-bottom: 5px; /* Reduced bottom margin for compactness */
}

.comp-option-group label {
    font-weight: bold;
    color: #343a40;
    margin-bottom: 2px; /* Small space below label */
}

.comp-option-group input[type="range"],
.comp-option-group input[type="number"],
.comp-option-group select {
    width: 100%; /* Take full width of its parent flex item */
    padding: 8px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
    background-color: #fff;
    box-sizing: border-box; /* Include padding and border in element's total width and height */
    max-width: none; /* Remove previous max-width constraint */
}

.comp-option-group span {
    font-size: 14px;
    color: #555;
    white-space: nowrap; /* Prevent value from wrapping */
    margin-top: 2px; /* Small space above value span */
}

.comp-help-text {
    font-size: 12px;
    color: #6c757d;
    margin-top: 5px;
    flex-basis: auto; /* Reset flex-basis */
    margin-left: 0; /* Reset margin-left */
    width: 100%; /* Ensure it takes full width below the input */
    font-style: italic; /* Make it look like helper text */
}

/* Specific adjustment for groups with value display on larger screens */
@media (min-width: 768px) {
    .comp-option-group.has-value-display {
        flex-direction: row; /* Layout label, input, and span in a row */
        align-items: center;
        flex-wrap: wrap; /* Allow wrapping if content is too wide */
    }
    .comp-option-group.has-value-display label {
        min-width: 120px; /* Give labels some fixed width for alignment */
        margin-right: 10px;
        margin-bottom: 0; /* No bottom margin when in a row */
    }
    .comp-option-group.has-value-display input[type="range"],
    .comp-option-group.has-value-display input[type="number"],
    .comp-option-group.has-value-display select {
        flex-grow: 1;
        max-width: 150px; /* Constrain width of inputs/selects in a row */
    }
    .comp-option-group.has-value-display span {
        margin-left: 10px; /* Space between input and value */
        margin-top: 0;
    }
    .comp-option-group.has-value-display .comp-help-text {
        flex-basis: 100%; /* Help text takes full row width */
        margin-left: calc(120px + 10px); /* Indent under inputs (label-width + label-margin) */
        margin-top: 0; /* Adjust vertical spacing */
    }
}


/* Log Viewer */
#comp-log {
    background-color: #0f0f0f;
    border: 1px solid #ddd;
    color: #27a807;
    font-family: monospace;
    font-size: 0.85rem;
    height: 150px;
    overflow-y: auto;
    padding: 10px;
    margin-top: 15px;
    white-space: pre-wrap;
    line-height: 1.4;
    border-radius: 6px;
    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.05);
}

/* Modal Base */
.comp-modal {
    display: none; /* Hidden by default */
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(2px);
    justify-content: center;
    align-items: center;
}

/* Show modal */
.comp-modal.comp-show {
    display: flex;
}

/* Hide modal */
.comp-hidden {
    display: none !important;
}

/* Modal Content */
.comp-modal-content {
    background-color: #fff;
    margin: auto;
    padding: 20px;
    border-radius: 10px;
    width: 90%;
    max-width: 800px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    position: relative;
    animation: fadeIn 0.3s ease;
}

/* Modal Preview Container */
#comp-modalPreview {
    max-height: 75vh;
    overflow: auto;
    text-align: center;
}

#comp-modalPreview img,
#comp-modalPreview video {
    max-width: 100%;
    max-height: 70vh;
    border-radius: 6px;
}

/* Close Button */
.comp-close {
    position: absolute;
    top: 12px;
    right: 16px;
    font-size: 24px;
    font-weight: bold;
    color: #999;
    cursor: pointer;
    transition: color 0.2s;
}

.comp-close:hover {
    color: #000;
}

/* Fade-in animation */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to   { opacity: 1; transform: translateY(0); }
}