#fileInput {
    display: none;
}

label[for="fileInput"] {
    display: inline-block;
    padding: 12px 28px;
    background: #007bff;
    color: white;
    font-family: 'Segoe UI', sans-serif;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 18px;
    font-weight: 600;
    max-width: 90%; /* Prevent button from being too wide */
    text-align: center;
    white-space: normal; /* Allow text wrapping if needed */
    line-height: 1.2;
}

label[for="fileInput"]:hover {
    background: #0056b3;
    transform: scale(1.05);
}

.file-container.drag-over {
    background-color: rgba(0, 123, 255, 0.2);
    border: 2px dashed #007bff;
    transform: scale(1.01);
}

.file-container, .preview-container {
    position: relative;  /* Add this to fix absolute positioning context */
    height: 100%;       /* Ensure container takes full height */
}

#preview {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    overflow-y: auto;
    max-height: 100%;
    border-style: none;
    border-radius: 20px;
}

.sortable-list {
    list-style: none;
    padding: 0;
}

.sortable-item {
    margin: 5px 0;
    padding: 10px;
    background: rgba(255, 255, 255, .6);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 93%;
    height: auto;
    transition: ease-in-out 0.2s;
    overflow-wrap: break-word;
    word-break: break-word;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

#fileList > .sortable-item {
    margin: 5px 0;
    margin-right: 0;
    padding: 10px;
    height: auto;
}

#fileList .sortable-item:hover {
    transform: scale(1.02);
    background-color: #DDD;
}

#preview .sortable-item {
    flex-direction: column;
}

.sortable-ghost {
    opacity: .6;
}

.sortable-drag {
    background: #f0f0f0;
    visibility: hidden;
}

.drag-handle {
    background: rgba(255, 255, 255, .7);
    border-style: none;
    border-radius: 15px;
    transition: .2s all ease-in-out;
}

.drag-handle:hover {
    background: rgba(225, 225, 225, .7);
}

#fileList {
    list-style-type: none;
    padding: 0;
    margin: 0;
    width: 100%;
}

.page-count-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
}

.page-count {
    background: rgba(255, 255, 255, .6);
    padding: 5px 10px;
    border-style: none;
    border-radius: 5px;
    width: fit-content;
    z-index: 2 !important;
    margin-top: 5px;
}

/* Drop zone and preview zone indicators */
.file-container .drop-zone-indicator,
.preview-container .preview-zone-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: rgba(0, 95, 195, 0.6);
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 0;
    width: 100%;  /* Ensure indicator spans container width */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Make plus icon clickable */
.plus-icon-clickable {
    pointer-events: auto;
    cursor: pointer;
    display: block;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.plus-icon-clickable:hover {
    transform: scale(1.1);
    color: rgba(0, 95, 195, 0.8);
}

.plus-icon-clickable:active {
    transform: scale(0.95);
}

/* When plus icon is disabled (files present) */
.plus-icon-clickable[style*="pointer-events: none"] {
    opacity: 0.5;
    cursor: default;
}

.plus-icon-clickable[style*="pointer-events: none"]:hover {
    transform: none;
    color: rgba(0, 95, 195, 0.6);
}

.drop-zone-indicator i, .preview-zone-indicator i {
    font-size: 72px;
    display: block;
    margin-bottom: 10px;
}

.drop-zone-indicator span, .preview-zone-indicator span {
    font-size: 18px;
    white-space: nowrap;
    color: rgba(0, 95, 195, 0.6);
    display: block;
    padding: 0 10px; /* Add horizontal padding for better spacing */
    max-width: 90%; /* Limit width to prevent edge cutoff */
}

/* Mobile responsive text adjustments */
@media (max-width: 480px) {
    .drop-zone-indicator span, .preview-zone-indicator span {
        white-space: normal; /* Allow text wrapping on mobile */
        font-size: 16px; /* Slightly smaller on mobile */
        line-height: 1.3; /* Better line spacing */
        padding: 0 15px; /* More padding on mobile */
        max-width: 85%; /* More conservative width */
    }
    
    label[for="fileInput"] {
        padding: 10px 20px; /* Reduce padding on mobile */
        font-size: 16px; /* Slightly smaller text */
        max-width: 85%; /* Ensure it fits on screen */
    }
}

/* Extra narrow screens (very skinny phones) */
@media (max-width: 360px) {
    .drop-zone-indicator span, .preview-zone-indicator span {
        font-size: 14px; /* Even smaller text */
        padding: 0 20px; /* More padding to prevent cutoff */
        max-width: 80%; /* More conservative width */
        line-height: 1.4; /* Better readability */
    }
    
    .drop-zone-indicator i, .preview-zone-indicator i {
        font-size: 60px; /* Smaller icon on very narrow screens */
        margin-bottom: 8px; /* Less margin */
    }
    
    label[for="fileInput"] {
        padding: 8px 16px; /* Smaller padding */
        font-size: 15px; /* Smaller text */
        max-width: 80%; /* More conservative width */
    }
}

/* Ultra narrow screens (iPhone 5/SE landscape, etc.) */
@media (max-width: 320px) {
    .drop-zone-indicator span, .preview-zone-indicator span {
        font-size: 13px; /* Small but readable */
        padding: 0 25px; /* Maximum padding to prevent cutoff */
        max-width: 75%; /* Very conservative width */
        text-align: center; /* Ensure center alignment */
    }
    
    .drop-zone-indicator i, .preview-zone-indicator i {
        font-size: 50px; /* Smaller icon */
        margin-bottom: 6px; /* Less margin */
    }
    
    label[for="fileInput"] {
        padding: 6px 12px; /* Minimal padding */
        font-size: 14px; /* Smaller text */
        max-width: 75%; /* Very conservative width */
        border-radius: 15px; /* Slightly smaller border radius */
    }
}

.file-container:has(#fileList:not(:empty)) .drop-zone-indicator,
.preview-container:has(#preview:not(:empty)) .preview-zone-indicator {
    opacity: 0;
}

.move-up-btn,
.move-down-btn {
    background: rgba(0, 123, 255, 0.1);
    border: none;
    border-radius: 8px;
    color: #007bff;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    margin: 0 4px;
    transition: all 0.2s ease;
}

.move-up-btn:hover:not(:disabled),
.move-down-btn:hover:not(:disabled) {
    background: rgba(0, 123, 255, 0.2);
    transform: scale(1.1);
}

.move-up-btn:disabled,
.move-down-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* Simplified animations for file swapping */
#fileList .moving-up {
    animation: moveUp 0.3s ease-in-out;
}

#fileList .moving-down {
    animation: moveDown 0.3s ease-in-out;
}

.upgrade-message {
    font-size: 0.85em;
    color: #666;
    background: rgba(255, 255, 255, 0.8);
    padding: 0;
    margin: 0;
    border-radius: 4px;
    opacity: 0;
    height: 0;
    overflow: hidden;
    transform: translateY(-5px);
    transition: all 0.3s ease;
    cursor: pointer;
    text-align: center;
}

.upgrade-message.show {
    opacity: 1;
    height: auto;
    padding: 4px 8px;
    transform: translateY(0);
}

.upgrade-message:hover {
    background: rgba(255, 255, 255, 0.9);
    color: #333;
}

.upgrade-message i {
    margin-right: 4px;
    color: #007bff;
}

