/* OpenList Container */
.openlist-container {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    overflow: hidden;
    margin-bottom: 20px;
    max-width: 100%;
    position: relative;
}

.openlist-container.openlist-locked {
    min-height: 260px;
}

.openlist-container.openlist-locked > :not(.openlist-auth-overlay):not(.openlist-notice-overlay) {
    display: none;
}

/* Search Bar */
.openlist-search-wrapper {
    margin-left: auto;
}

.openlist-search {
    display: flex;
    padding: 0;
    background: transparent;
    border-bottom: none;
    align-items: center;
}

.openlist-search-input {
    width: 200px;
    height: 32px;
    padding: 0 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    margin-right: 8px;
    font-size: 13px;
    color: #374151;
    background-color: #eef2f7;
    background: #eef2f7;
    transition: all 0.2s;
    box-sizing: border-box;
}

.openlist-search-input:focus {
    outline: none;
    border-color: #3b82f6;
    background-color: #fff;
    background: #fff;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.openlist-container .openlist-search-input {
    background-color: #eef2f7 !important;
    background: #eef2f7 !important;
}

.openlist-container .openlist-search-input:focus {
    background-color: #fff !important;
    background: #fff !important;
}

.openlist-search-btn {
    height: 32px;
    padding: 0 16px;
    background: #3b82f6;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.openlist-search-btn:hover {
    background: #2563eb;
}

/* Breadcrumbs */
.openlist-breadcrumbs {
    padding: 12px 16px;
    background: #fff;
    border-bottom: 1px solid #f3f4f6;
    font-size: 14px;
    color: #6b7280;
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    overflow: hidden;
}

.openlist-breadcrumb-scroll {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    margin-right: 8px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    position: relative;
    padding-left: 14px;
}

.openlist-breadcrumb-scroll::-webkit-scrollbar {
    display: none;
}

.openlist-breadcrumb-scroll::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 14px;
    pointer-events: none;
    background: linear-gradient(to right, rgba(255, 255, 255, 1), rgba(255, 255, 255, 0));
}

.openlist-search-wrapper {
    flex-shrink: 0;
}

.openlist-breadcrumb-item {
    cursor: pointer;
    color: #4b5563;
    transition: color 0.2s;
    font-weight: 500;
}

.openlist-breadcrumb-item:hover {
    color: #3b82f6;
}

.openlist-container .openlist-breadcrumb-item i.fa-home,
.openlist-container .openlist-breadcrumb-item i.fa-home::before {
    color: #4b5563 !important;
    background: none !important;
    background-image: none !important;
    -webkit-text-fill-color: currentColor !important;
    -webkit-background-clip: initial !important;
    background-clip: initial !important;
}

.openlist-breadcrumb-separator {
    margin: 0 8px;
    color: #9ca3af;
    font-size: 12px;
}

/* Header */
.openlist-header {
    display: flex;
    padding: 12px 16px;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    font-weight: 600;
    font-size: 13px;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* List Items */
.openlist-files {
    max-height: 600px;
    overflow-y: auto;
    background: #fff;
}

.openlist-item {
    display: flex;
    padding: 14px 16px;
    border-bottom: 1px solid #f3f4f6;
    align-items: center;
    transition: background-color 0.15s;
    cursor: pointer;
    font-size: 14px;
    color: #374151;
}

.openlist-item:last-child {
    border-bottom: none;
}

.openlist-item:hover {
    background-color: #f0f9ff;
}

/* Columns */
.openlist-col-name {
    flex: 1;
    display: flex;
    align-items: center;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    margin-right: 16px;
    min-width: 0; /* Important for flex child truncation */
}

.openlist-col-name i {
    margin-right: 12px;
    font-size: 20px;
    color: #9ca3af;
    width: 24px;
    min-width: 24px; /* Fix icon width */
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0; /* Prevent icon shrinking */
}

.openlist-name-text {
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Specific Icon Colors */
.openlist-col-name i.fa-folder { color: #f59e0b; }
.openlist-col-name i.fa-file-pdf { color: #ef4444; }
.openlist-col-name i.fa-file-word { color: #3b82f6; }
.openlist-col-name i.fa-file-excel { color: #10b981; }
.openlist-col-name i.fa-file-image { color: #8b5cf6; }
.openlist-col-name i.fa-file-video { color: #ec4899; }
.openlist-col-name i.fa-file-audio { color: #f97316; }
.openlist-col-name i.fa-file-archive { color: #6366f1; }
.openlist-col-name i.fa-file-code { color: #64748b; }

.openlist-col-size {
    width: 100px;
    text-align: right;
    color: #6b7280;
    font-size: 13px;
    font-weight: 500;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.openlist-col-date {
    width: 150px;
    text-align: right;
    color: #9ca3af;
    font-size: 13px;
    font-weight: 500;
    margin-left: 16px;
}

/* Pagination */
.openlist-pagination {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 12px 16px;
    background: #fff;
    border-top: 1px solid #e5e7eb;
}

.openlist-page-btn {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 0;
    margin: 0 4px;
    cursor: pointer;
    color: #4b5563;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    font-size: 13px;
    font-weight: 500;
}

.openlist-page-btn:hover:not(:disabled) {
    background: #f9fafb;
    border-color: #d1d5db;
    color: #111827;
}

.openlist-page-btn.active {
    background: #3b82f6;
    border-color: #3b82f6;
    color: #fff;
}

.openlist-page-btn.active:hover {
    background: #2563eb;
    border-color: #2563eb;
}

.openlist-page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f9fafb;
    border-color: #f3f4f6;
}

.openlist-page-dots {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    color: #9ca3af;
    font-size: 13px;
    margin: 0 2px;
}

/* Jump to Page */
.openlist-page-jump {
    display: flex;
    align-items: center;
    margin-left: 4px;
}

.openlist-page-input {
    width: 32px;
    height: 32px;
    padding: 0;
    margin: 0;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    text-align: center;
    font-size: 13px;
    color: #374151;
    background: #fff;
    outline: none;
    transition: all 0.2s;
    box-sizing: border-box;
    font-weight: 500;
}

.openlist-page-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.openlist-container input.openlist-page-input {
    background-color: #fff !important;
    background: #fff !important;
    color: #374151 !important;
    border-color: #e5e7eb !important;
}

/* Remove spin buttons from number input */
.openlist-page-input::-webkit-inner-spin-button, 
.openlist-page-input::-webkit-outer-spin-button { 
    -webkit-appearance: none; 
    margin: 0; 
}
.openlist-page-input {
    -moz-appearance: textfield;
}

/* Mobile Responsiveness */
@media (max-width: 600px) {
    .openlist-breadcrumbs {
        display: flex;
        flex-wrap: nowrap; /* Prevent wrapping */
        align-items: center;
        overflow: hidden; /* Hide overflow */
    }

    /* Make breadcrumbs scrollable horizontally if too long */
    .openlist-breadcrumb-scroll {
        flex: 1;
        display: flex;
        align-items: center;
        overflow-x: auto;
        overflow-y: hidden;
        white-space: nowrap;
        margin-right: 8px;
        -webkit-overflow-scrolling: touch; /* Smooth scroll on iOS */
        scrollbar-width: none; /* Firefox hide scrollbar */
        position: relative;
        padding-left: 14px;
    }
    
    .openlist-breadcrumb-scroll::-webkit-scrollbar {
        display: none; /* Chrome/Safari hide scrollbar */
    }

    .openlist-search-wrapper {
        margin-left: 0;
        margin-top: 0;
        width: auto;
        flex-shrink: 0; /* Prevent search box from shrinking */
    }

    .openlist-search {
        width: auto;
    }

    .openlist-search-input {
        width: 120px; /* Slightly smaller on mobile */
        flex: none;
    }

    .openlist-col-size, 
    .openlist-col-date {
        display: none;
    }
    
    .openlist-pagination {
        justify-content: center;
        flex-wrap: wrap;
    }

    .openlist-page-jump {
        margin-top: 0;
        width: auto;
        justify-content: center;
        margin-left: 4px;
    }
}

/* Loading & Empty States */
.openlist-loading, .openlist-empty, .openlist-error {
    padding: 40px;
    text-align: center;
    color: #6b7280;
}

.openlist-loading i {
    font-size: 24px;
    color: #3b82f6;
    margin-bottom: 10px;
    display: block;
}

.openlist-error {
    color: #ef4444;
    background: #fef2f2;
    margin: 16px;
    border-radius: 8px;
    padding: 16px;
}

.openlist-auth-overlay,
.openlist-notice-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(249, 250, 251, 0.92);
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.openlist-auth-card {
    width: min(420px, 100%);
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    box-shadow: 0 10px 25px rgba(17, 24, 39, 0.12);
    padding: 20px;
}

.openlist-auth-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 700;
    color: #111827;
    margin-bottom: 8px;
}

.openlist-auth-title i {
    color: #3b82f6;
}

.openlist-auth-desc {
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 14px;
}

.openlist-auth-form {
    display: flex;
    gap: 10px;
}

.openlist-auth-input {
    flex: 1;
    height: 38px;
    padding: 0 12px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    color: #374151;
    background-color: #f9fafb;
    background: #f9fafb;
    transition: all 0.2s;
    box-sizing: border-box;
}

.openlist-auth-input:focus {
    outline: none;
    border-color: #3b82f6;
    background-color: #fff;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.openlist-container input.openlist-auth-input {
    background-color: #f9fafb !important;
    background: #f9fafb !important;
    color: #374151 !important;
    border-color: #e5e7eb !important;
}

.openlist-container input.openlist-auth-input:focus {
    background-color: #fff !important;
    background: #fff !important;
    border-color: #3b82f6 !important;
}

.openlist-auth-submit {
    height: 38px;
    padding: 0 16px;
    background: #3b82f6;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: background-color 0.2s;
    white-space: nowrap;
}

.openlist-container button.openlist-auth-submit {
    background: #3b82f6 !important;
    background-image: none !important;
    color: #fff !important;
}

.openlist-auth-submit:hover:not(:disabled) {
    background: #2563eb;
}

.openlist-auth-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.openlist-auth-error {
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    background: #fef2f2;
    color: #b91c1c;
    font-size: 13px;
    border: 1px solid #fee2e2;
}

.openlist-notice-actions {
    margin-top: 14px;
    display: flex;
    justify-content: flex-end;
}

.openlist-notice-retry {
    height: 38px;
    padding: 0 16px;
    background: #3b82f6;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: background-color 0.2s;
    white-space: nowrap;
}

.openlist-container button.openlist-notice-retry {
    background: #3b82f6 !important;
    background-image: none !important;
    color: #fff !important;
}

.openlist-notice-retry:hover:not(:disabled) {
    background: #2563eb;
}

.openlist-notice-retry:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}
