* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #f4f4f4;
    color: #111;
    line-height: 1.6;
    height: 100vh;
    overflow: hidden;
}

.container {
    max-width: 1200px;
    margin: 20px auto;
    padding: 20px 20px 0 20px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    height: calc(100vh - 40px);
    display: flex;
    flex-direction: column;
}

main {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    overflow: hidden;
    padding-bottom: 20px;
}

header {
    text-align: center;
    margin-bottom: 30px;
}

header h1 {
    font-size: 24px;
    margin-bottom: 10px;
}

header p {
    color: #666;
    font-size: 14px;
}

.upload-zone {
    border: 2px dashed #000;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    border-radius: 8px;
    transition: background-color 0.2s;
    background-color: #fafafa;
}

.upload-zone:hover, .upload-zone.dragover {
    background-color: #eaeaea;
}

.file-batches-container {
    flex-grow: 1;
    overflow-y: auto;
    padding-right: 10px;
}

.file-batches-container::-webkit-scrollbar {
    width: 6px;
}
.file-batches-container::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

.upload-batch {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px dashed #ddd;
}
.upload-batch:last-child {
    border-bottom: none;
}
.upload-batch-header {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 15px;
    color: #444;
}

.file-list {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
}

.file-item {
    display: flex;
    flex-direction: column;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background-color: #fafafa;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    min-height: 140px;
}

.file-item:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transform: translateY(-2px);
    border-color: #bbb;
}

.file-item.selected {
    border-color: #007bff;
    background-color: #f0f7ff;
}

.file-checkbox {
    position: absolute;
    top: 10px;
    right: 10px;
}

.file-select-cb {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.file-info {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    margin-top: 5px;
    margin-bottom: 15px;
    width: 100%;
    word-wrap: break-word;
    padding-right: 20px; /* space for checkbox */
}

.file-name {
    font-weight: bold;
    margin-bottom: 8px;
    font-size: 14px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
    min-height: 2.8em; /* fixed height for 2 lines */
}

.file-status {
    font-size: 12px;
    color: #666;
    margin-top: auto; /* push status to bottom of info */
}

.file-action {
    width: 100%;
    margin-top: auto; /* push action button to absolute bottom */
}

.btn-download {
    display: block;
    text-align: center;
    background-color: #000;
    color: #fff;
    border: none;
    padding: 10px 16px;
    cursor: pointer;
    border-radius: 4px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.2s;
}

.btn-download:hover {
    background-color: #333;
}

@media (max-width: 1024px) {
    .file-list {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .file-list {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .container {
        margin: 0;
        border-radius: 0;
        height: 100vh;
    }
    .file-list {
        grid-template-columns: 1fr;
    }
}

.spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #000;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
    display: inline-block;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
