/* ── OneDrive Picker Dialog ────────────────────────────────────────────── */

dialog.dialog-onedrive {
    max-width: 520px;
    width: 95vw;
    max-height: 85vh;
    padding: 0;
    border: none;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
    overflow: hidden;
}

dialog.dialog-onedrive[open] {
    display: flex;
    flex-direction: column;
}

dialog.dialog-onedrive::backdrop {
    background: rgba(0, 0, 0, 0.45);
}

/* ── Wrapper ────────────────────────────────────────────────────────────── */

.onedrive-picker-wrapper {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

/* ── Header ─────────────────────────────────────────────────────────────── */

.onedrive-picker-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
}

.onedrive-picker-title {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.onedrive-picker-title h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-main);
}

.onedrive-picker-title .fa-microsoft {
    color: #0078d4;
    font-size: 1.1rem;
}

.onedrive-picker-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 6px;
    color: #999;
    font-size: 1rem;
    line-height: 1;
    transition: background 0.12s, color 0.12s;
}

.onedrive-picker-close:hover {
    background: #f0f0f0;
    color: var(--text-main);
}

/* ── Auth panel (no conectado) ──────────────────────────────────────────── */

.onedrive-auth-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 2.5rem 2rem;
    text-align: center;
    color: var(--text-main);
    flex: 1;
}

.onedrive-auth-icon {
    font-size: 2.5rem;
    color: #0078d4;
}

.onedrive-auth-panel p {
    margin: 0;
    font-size: 0.9rem;
    color: #666;
    max-width: 320px;
}

.onedrive-connect-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: #0078d4;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 0.55rem 1.2rem;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.15s;
}

.onedrive-connect-btn:hover {
    background: #006cbf;
    color: #fff;
    text-decoration: none;
}

/* ── Barra de cuenta (conectado) ────────────────────────────────────────── */

.onedrive-account-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1.25rem;
    background: #f0f7ff;
    border-bottom: 1px solid #d0e8ff;
    flex-shrink: 0;
}

.onedrive-account-name {
    font-size: 0.8rem;
    color: #0078d4;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Breadcrumb ─────────────────────────────────────────────────────────── */

.onedrive-breadcrumb {
    padding: 0.5rem 1.25rem;
    border-bottom: 1px solid #f0f0f0;
    flex-shrink: 0;
    background: #fafafa;
}

.onedrive-breadcrumb-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px;
    font-size: 0.8rem;
}

.onedrive-breadcrumb-item {
    color: var(--color-primary);
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    transition: background 0.1s;
}

.onedrive-breadcrumb-item:hover {
    background: #e8f0fe;
}

.onedrive-breadcrumb-item.onedrive-breadcrumb-current {
    color: var(--text-main);
    font-weight: 600;
    cursor: default;
}

.onedrive-breadcrumb-item.onedrive-breadcrumb-current:hover {
    background: none;
}

.onedrive-breadcrumb-separator {
    color: #ccc;
    padding: 0 2px;
    font-size: 0.75rem;
}

/* ── Folder list ────────────────────────────────────────────────────────── */

.onedrive-folder-list-wrapper {
    flex: 1;
    overflow-y: auto;
    padding: 0.4rem 0;
    min-height: 120px;
}

.onedrive-folder-list {
    list-style: none;
    margin: 0;
    padding: 0 0.5rem;
}

.onedrive-folder-item {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.45rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--text-main);
    user-select: none;
    transition: background 0.1s;
}

.onedrive-folder-item:hover {
    background: #f4f4f4;
}

.onedrive-folder-item.is-selected {
    background: rgba(0, 120, 212, 0.1);
    font-weight: 600;
}

.onedrive-folder-item-icon {
    color: #f0c040;
    font-size: 0.95rem;
    flex-shrink: 0;
}

.onedrive-folder-item-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.onedrive-folder-item-nav {
    flex-shrink: 0;
    background: none;
    border: none;
    cursor: pointer;
    padding: 3px 7px;
    border-radius: 4px;
    color: #bbb;
    font-size: 0.7rem;
    transition: background 0.1s, color 0.1s;
    line-height: 1;
}

.onedrive-folder-item-nav:hover {
    background: #e4e4e4;
    color: var(--text-main);
}

.onedrive-folder-loading,
.onedrive-folder-empty {
    padding: 1.5rem;
    text-align: center;
    font-size: 0.875rem;
    color: #999;
}

/* ── Create folder ──────────────────────────────────────────────────────── */

.onedrive-create-folder {
    display: flex;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    border-top: 1px solid #f0f0f0;
    flex-shrink: 0;
}

.onedrive-new-folder-input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 0.35rem 0.65rem;
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.15s;
}

.onedrive-new-folder-input:focus {
    border-color: var(--color-primary);
}

/* ── Upload footer ──────────────────────────────────────────────────────── */

.onedrive-upload-footer {
    padding: 0.75rem 1.25rem;
    border-top: 1px solid #eee;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex-shrink: 0;
}

.onedrive-selected-folder-label {
    font-size: 0.8rem;
    color: #888;
}

.onedrive-progress {
    height: 4px;
    background: #e8e8e8;
    border-radius: 2px;
    overflow: hidden;
}

.onedrive-progress-bar {
    height: 100%;
    background: var(--color-primary);
    border-radius: 2px;
    width: 0;
    transition: width 0.2s;
}

.onedrive-progress-bar.indeterminate {
    width: 40%;
    animation: onedrive-indeterminate 1.4s ease-in-out infinite;
}

@keyframes onedrive-indeterminate {
    0%   { transform: translateX(-200%); }
    100% { transform: translateX(400%); }
}

.onedrive-upload-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.65rem;
}

/* ── Result panel ───────────────────────────────────────────────────────── */

.onedrive-result-panel {
    padding: 1.75rem 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    text-align: center;
}

.onedrive-result-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
}

.onedrive-result-success {
    color: #28a745;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.onedrive-result-error {
    color: var(--color-danger);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.onedrive-result-links {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.82rem;
    width: 100%;
}

.onedrive-result-links a {
    color: var(--color-primary);
    word-break: break-all;
}
