:root {
    --primary-color-light: #29b6f6; /* light blue lighten-1 */
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #f4f7f9;
    color: #333;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
}

#uploader-container {
    width: 100%;
    max-width: 600px;
    background-color: #ffffff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

#uploader-container h1 {
    text-align: center;
    color: #333;
    margin-bottom: 20px;
}

.upload-target-container {
    margin-bottom: 20px;
    text-align: center;
}

.upload-target-container p {
    margin-bottom: 10px;
    color: #555;
    font-size: 1.1em;
}

.radio-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
}

.radio-buttons label {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 8px 15px;
    border: 1px solid #ccc;
    border-radius: 20px;
    transition: all 0.3s ease;
}

.radio-buttons label:hover {
    background-color: #f0f0f0;
}

.radio-buttons input[type="radio"] {
    display: none; /* Hide the default radio button */
}

.radio-buttons input[type="radio"] + span {
    position: relative;
    padding-left: 25px;
}

.radio-buttons input[type="radio"] + span::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    border: 1px solid #ccc;
    border-radius: 50%;
    background: #fff;
}

.radio-buttons input[type="radio"]:checked + span::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #007bff;
}

h1 {
    text-align: center;
    font-size: 1.8rem;
    margin-top: 0;
    margin-bottom: 25px;
    color: #2c3e50;
}

#drop-zone {
    border: 2px dashed #dce4e9;
    border-radius: 6px;
    padding: 50px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.3s, background-color 0.3s;
}

#drop-zone.dragover {
    border-color: #3498db;
    background-color: #f8f9fa;
}

#drop-zone p {
    margin: 0;
    font-size: 1rem;
    color: #7f8c8d;
}

#file-list {
    margin-top: 25px;
}

.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid #ecf0f1;
    transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}

.file-item.fading-out {
    opacity: 0;
    transform: scale(0.95);
}

.file-item:last-child {
    border-bottom: none;
}

.file-name {
    flex-grow: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: 20px;
}

.progress-container {
    width: 200px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.progress-bar-wrapper {
    flex-grow: 1;
    height: 10px;
    background-color: #ecf0f1;
    border-radius: 5px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    width: 0;
    background-color: #27ae60;
    border-radius: 4px;
    transition: width 0.4s ease-in-out;
}

.progress-bar.error {
    background-color: #e74c3c;
}

.progress-percent {
    font-size: 0.9rem;
    width: 45px; /* Fixed width to prevent layout shifts */
    text-align: right;
    color: #7f8c8d;
}

.status-message {
    font-size: 0.85rem;
    color: #3498db; /* Blue to match completed bar */
    text-align: right;
    padding-top: 4px;
    display: none; /* Hide by default */
}

/* --- Completion Styles --- */
.file-item.completed .progress-bar {
    background-color: #3498db; /* Change bar to blue */
}

/* --- File Item Layout --- */
.file-item {
    background: #fff;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    position: relative;
    display: flex;
    flex-direction: column;
}

/* File name styling */
.file-name {
    font-size: 16px;
    font-weight: 600;
    color: #2c3e50;
    margin: 0 0 12px 0;
    padding: 0;
    line-height: 1.3;
    word-break: break-word;
    order: 1; /* Ensure file name is first */
}

/* Progress bar container */
.progress-container {
    width: 100%;
    margin: 0;
    padding: 0;
    order: 2; /* Ensure progress is after file name */
}

/* Progress bar container */
.progress-container {
    width: 100%;
    margin: 0;
    padding: 0;
    order: 2; /* Ensure progress is after file name */
}

/* Progress bar wrapper */
.progress-bar-wrapper {
    height: 12px;
    background-color: #f0f0f0;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
    margin: 0;
    position: relative;
}

/* Progress bar */
.progress-bar {
    height: 100%;
    width: 0%;
    min-width: 0%;
    background-color: #4CAF50; /* Green by default */
    border-radius: 6px;
    transition: width 0.2s ease-out, background-color 0.3s ease;
    display: block;
    position: relative;
    z-index: 1;
}

/* Progress bar animation */
.progress-bar.uploading {
    background-color: #4CAF50;
}

.progress-bar.completed {
    background-color: #2196F3;
}

.progress-bar.error {
    background-color: #f44336;
}

/* Progress bar animation */
.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        to right,
        rgba(255, 255, 255, 0.2) 0%,
        rgba(255, 255, 255, 0.5) 50%,
        rgba(255, 255, 255, 0.2) 100%
    );
    background-size: 200% 100%;
    animation: shimmer 2s infinite;
    border-radius: 6px;
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* Progress info container */
.progress-info {
    text-align: center;
    margin: 12px 0 0 0;
    padding: 0;
    font-size: 15px;
    color: #2c3e50;
    line-height: 1.5;
    display: block;
    clear: both; /* Ensure it appears below the progress bar */
    width: 100%;
}

/* Progress percentage */
.progress-percent {
    font-weight: 600;
    color: #2c3e50;
    font-size: 16px;
    display: block;
    margin: 8px 0 4px 0;
    text-align: center;
    width: 100%;
}

/* Upload speed and time remaining */
.upload-speed {
    color: #7f8c8d;
    font-size: 14px;
    font-weight: 500;
    display: block;
    margin-top: 0;
}

/* Clearfix for the progress container */
.progress-container::after {
    content: "";
    display: table;
    clear: both;
}

/* Progress percentage */
.progress-percent {
    font-weight: 600;
    color: #2c3e50;
    font-size: 16px;
}

/* Upload speed and time remaining */
.upload-speed {
    color: #7f8c8d;
    font-size: 14px;
    font-weight: 500;
    display: block;
    margin-top: 0;
}

/* Completed state */
.file-item.completed .progress-bar {
    background-color: #3498db; /* Blue when complete */
}

.file-item.completed .progress-bar::after {
    animation: none; /* Stop shimmer animation when complete */
    background: rgba(255, 255, 255, 0.2);
}

/* Error state */
.progress-bar.error {
    background-color: #e74c3c; /* Red for errors */
}

.progress-bar.error::after {
    animation: none;
    background: rgba(255, 255, 255, 0.3);
}

.file-item.completed .progress-percent {
    display: none; /* Hide the percentage */
}

.file-item.completed .status-message {
    display: block; /* Show the 'Finished' message */
}

/* --- Error Styles --- */
.file-item.error .status-message {
    display: block;
    color: #e74c3c; /* Red for errors */
}

.file-item.error .progress-percent {
    display: none;
}

#upload-button {
    display: block;
    width: 100%;
    padding: 12px;
    margin-top: 25px;
    background-color: #27ae60;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s;
}

#upload-button:hover {
    background-color: #229954;
}

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