/* UploadFolder.css */

/* 1. SURGICAL SHIELD: 
   This safely undoes the global 'div { width: 100%; overflow: hidden; }' rule 
   ONLY inside our modal, without breaking JavaScript toggles. */
#uploadFolderModal div,
#uploadFolderModal span,
#uploadFolderModal input,
#uploadFolderModal button,
#uploadFolderModal svg {
    width: auto;
    overflow: visible;
    box-sizing: border-box;
    position: static;
    /* Reverts the global position: relative */
}

/* 2. Base Overlay */
#uploadFolderOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    z-index: 99999;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    animation: uploadFolderFadeIn 0.3s forwards;
    box-sizing: border-box;
}

.uploadFolderModal {
    background: #ffffff;
    width: 90%;
    max-width: 800px;
    height: 80vh;
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
    display: flex;
    /* NO !important here so JS can control it */
    flex-direction: column;
    overflow: hidden !important;
    transform: scale(0.9);
    animation: uploadFolderPopIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: #333;
    position: relative;
}

.uploadFolderContent {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100% !important;
    padding: 24px;
}

/* 3. Header */
.uploadFolderHeader {
    margin-bottom: 20px;
    width: 100% !important;
}

.uploadFolderHeaderTop {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    width: 100% !important;
}

.uploadFolderTitle {
    font-size: 24px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 8px 0 !important;
    line-height: 1.2;
}

.uploadFolderCloseIcon {
    font-size: 24px;
    color: #999;
    cursor: pointer;
    line-height: 1;
    padding: 4px;
    transition: color 0.2s;
}

.uploadFolderCloseIcon:hover {
    color: #333;
}

.uploadFolderDescription {
    color: #666;
    font-size: 14px;
    width: 100% !important;
}

/* 4. Top Status (JS Toggled) */
.uploadFolderTopStatus {
    margin-top: 16px;
    background: #f8f9fa;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid #eee;
    width: 100% !important;
}

.uploadFolderStatusInfo {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    font-weight: 600;
    color: #555;
    margin-bottom: 6px;
    width: 100% !important;
}

.uploadFolderGlobalProgress {
    height: 6px;
    background: #eee;
    border-radius: 3px;
    overflow: hidden !important;
    margin-top: 8px;
    width: 100% !important;
}

.uploadFolderGlobalProgressBar {
    height: 100%;
    background: var(--main-color, #2d6a4f);
    width: 0;
    transition: width 0.3s ease;
}

/* 5. Steps (JS Toggled) */
.uploadFolderStep {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden !important;
    width: 100% !important;
}

/* Step 1: Select Area */
.uploadFolderSelectArea {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border: 2px dashed #e0e0e0;
    border-radius: 12px;
    margin: 20px 0;
    transition: all 0.3s ease;
    width: 100% !important;
    background: transparent;
    cursor: pointer;
}

.uploadFolderSelectArea:hover {
    border-color: var(--main-color, #2d6a4f);
    background: rgba(45, 106, 79, 0.05);
}

.uploadFolderIcon {
    color: #ccc;
    margin-bottom: 20px;
    transition: transform 0.3s ease;
}

.uploadFolderSelectArea:hover .uploadFolderIcon {
    transform: scale(1.1);
    color: var(--main-color, #2d6a4f);
}

/* 6. Step 2 Toolbar */
.uploadFolderToolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    gap: 16px;
    width: 100% !important;
}

.uploadFolderSearch {
    flex: 1;
    min-width: 200px;
}

.uploadFolderSearch input {
    width: 100% !important;
    height: 40px !important;
    padding: 0 16px !important;
    border-radius: 8px;
    border: 1px solid #e0e0e0 !important;
    font-size: 14px;
    color: #333;
    background: #fff;
    transition: border-color 0.2s;
}

.uploadFolderSearch input:focus {
    outline: none;
    border-color: var(--main-color, #2d6a4f) !important;
}

.uploadFolderActions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 16px;
}

.uploadFolderSwitchWrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.uploadFolderSwitchLabel {
    font-size: 13px;
    color: #333;
    font-weight: 500;
}

/* Toggle Switch */
.uploadFolderToggle {
    width: 36px !important;
    height: 20px !important;
    background: #ccc;
    border-radius: 10px;
    position: relative !important;
    /* Re-apply position relative for the absolute knob */
    cursor: pointer;
    transition: background 0.2s;
    flex-shrink: 0;
}

.uploadFolderToggle.on {
    background: var(--main-color, #2d6a4f);
}

.uploadFolderToggleKnob {
    width: 16px !important;
    height: 16px !important;
    background: #fff;
    border-radius: 50%;
    position: absolute !important;
    top: 2px !important;
    left: 2px !important;
    transition: transform 0.2s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.uploadFolderToggle.on .uploadFolderToggleKnob {
    transform: translateX(16px);
}

/* 7. File Tree */
.uploadFolderTreeContainer {
    flex: 1;
    overflow-y: auto !important;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 10px;
    background: #f9f9f9;
    width: 100% !important;
}

.uploadFolderItem {
    margin-bottom: 2px;
    transition: opacity 0.2s;
    width: 100% !important;
}

.uploadFolderItemHeader {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    background: #fff;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s, opacity 0.2s;
    width: 100% !important;
    min-height: 36px;
    border: none;
}

.uploadFolderItem.excluded>.uploadFolderItemHeader {
    opacity: 0.5;
}

.uploadFolderItemHeader:hover {
    background: #f0f0f0;
}

.uploadFolderChildren {
    width: 100% !important;
}

.uploadFolderChevron {
    display: inline-block;
    width: 20px !important;
    text-align: center;
    font-size: 10px;
    color: #999;
    margin-right: 4px;
    transition: transform 0.2s;
}

.uploadFolderChevron.expanded {
    transform: rotate(0deg);
}

.uploadFolderChevron.collapsed {
    transform: rotate(-90deg);
}

.uploadFolderIconFolder,
.uploadFolderIconFile {
    margin-right: 8px;
    font-size: 16px;
}

.uploadFolderName {
    flex: 1;
    font-size: 14px;
    color: #333;
    white-space: nowrap;
    overflow: hidden !important;
    text-overflow: ellipsis;
}

.uploadFolderSize {
    font-size: 12px;
    color: #999;
    margin-right: 12px;
}

.uploadFolderBadge {
    font-size: 10px;
    background: #ffeb3b;
    color: #8a6d00;
    padding: 2px 6px;
    border-radius: 4px;
    margin-right: 8px;
    font-weight: 600;
}

.uploadFolderItemActions {
    margin-left: auto;
    /* Pushes toggles flush right */
    display: flex;
    align-items: center;
}

/* Progress Bars */
.uploadFolderProgressContainer {
    width: 100px !important;
    height: 16px !important;
    background: #eee;
    border-radius: 8px;
    overflow: hidden !important;
    position: relative !important;
    margin-right: 12px;
}

.uploadFolderProgressBar {
    height: 100% !important;
    background: var(--main-color, #2d6a4f);
    width: 0;
    transition: width 0.3s ease;
}

.uploadFolderProgressBar.completed {
    background: #4caf50;
}

.uploadFolderProgressText {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: #000;
    font-weight: 600;
}

/* 8. Footer */
.uploadFolderFooter {
    margin-top: 20px;
    border-top: 1px solid #eee;
    padding-top: 20px;
    width: 100% !important;
}

.uploadFolderFooterButtons {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    width: 100% !important;
}

/* Buttons */
.uploadFolderBtnPrimary,
.uploadFolderBtnSecondary {
    padding: 10px 24px !important;
    border-radius: 8px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    cursor: pointer;
    transition: all 0.2s;
    border: none !important;
    line-height: normal !important;
    display: inline-block;
    margin: 0;
}

.uploadFolderBtnPrimary {
    background: var(--main-color, #2d6a4f) !important;
    color: #fff !important;
    box-shadow: 0 4px 12px rgba(45, 106, 79, 0.3);
}

.uploadFolderBtnPrimary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(45, 106, 79, 0.4);
}

.uploadFolderBtnPrimary:disabled {
    background: #ccc !important;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.uploadFolderBtnSecondary {
    background: #f5f5f5 !important;
    color: #333 !important;
}

.uploadFolderBtnSecondary:hover {
    background: #e0e0e0 !important;
}

/* Animations */
@keyframes uploadFolderFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes uploadFolderPopIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}