/* =========================================================
   La Biblia en 3D - Módulo de Configuración y Backup
   Archivo: /css/backup-settings.css
   ========================================================= */

:root {
    --b3dSetAccent: #00acc1;
    --b3dSetBg: rgba(8, 12, 20, 0.78);
    --b3dSetCard: #ffffff;
    --b3dSetText: #0f172a;
    --b3dSetMuted: #64748b;
    --b3dSetBorder: rgba(15, 23, 42, .12);
    --b3dSetShadow: 0 24px 60px rgba(0,0,0,.30);
    --b3dSetSuccess: #16a34a;
    --b3dSetWarn: #ea580c;
    --b3dSetDanger: #dc2626;
}

/* Botón de configuración junto a búsqueda */
#btnSettingsBackup.btnIcon,
#btnSettingsBackup.btnCompare,
#btnSettingsBackup.btn {
    height: 40px;
    width: 44px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,.14);
    background: rgba(0,0,0,.25);
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

#btnSettingsBackup:hover {
    border-color: rgba(0,172,193,.60);
}

#btnSettingsBackup .b3dSettingsGear {
    font-size: 18px;
    line-height: 1;
}

.b3dSettingsGear {
    font-size: x-large;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center; /* vertical */
    justify-content: center; /* horizontal */

    line-height: 1; /* evita desalineación del texto */
}
    /* Overlay */
    .b3dSettingsOverlay {
    position: fixed;
    inset: 0;
    z-index: 120000;
    background: var(--b3dSetBg);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

    .b3dSettingsOverlay.is-open {
        display: flex;
    }

.b3dSettingsModal {
    width: min(760px, calc(100vw - 24px));
    max-height: min(88vh, 900px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, #ffffff, #f8fafc);
    color: var(--b3dSetText);
    border-radius: 22px;
    box-shadow: var(--b3dSetShadow);
    border: 1px solid rgba(255,255,255,.18);
}

.b3dSettingsHead {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--b3dSetBorder);
    background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(248,250,252,.96));
}

.b3dSettingsTitleWrap {
    min-width: 0;
}

.b3dSettingsTitle {
    margin: 0;
    font-size: 22px;
    line-height: 1.15;
    font-weight: 900;
    color: #0f172a;
}

.b3dSettingsSub {
    margin-top: 4px;
    font-size: 13px;
    color: var(--b3dSetMuted);
}

.b3dSettingsClose {
    height: 42px;
    min-width: 42px;
    border-radius: 12px;
    border: 1px solid rgba(15,23,42,.12);
    background: #fff;
    color: #0f172a;
    cursor: pointer;
    font-size: 20px;
    font-weight: 900;
}

.b3dSettingsBody {
    overflow: auto;
    padding: 18px 20px 22px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.b3dSettingsCard {
    border: 1px solid var(--b3dSetBorder);
    background: rgba(255,255,255,.92);
    border-radius: 18px;
    padding: 16px;
    box-shadow: 0 10px 24px rgba(15,23,42,.06);
}

.b3dSettingsCardTitle {
    font-size: 16px;
    font-weight: 900;
    color: #0f172a;
    margin: 0 0 8px 0;
}

.b3dSettingsToggleRow {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.b3dSettingsToggleText {
    min-width: 0;
    flex: 1 1 auto;
}

.b3dSettingsToggleLabel {
    display: block;
    font-size: 16px;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 4px;
}

.b3dSettingsToggleHint {
    display: block;
    font-size: 13px;
    color: var(--b3dSetMuted);
    line-height: 1.45;
}

.b3dSwitch {
    position: relative;
    flex: 0 0 auto;
    width: 58px;
    height: 32px;
}

    .b3dSwitch input {
        position: absolute;
        opacity: 0;
        pointer-events: none;
    }

.b3dSwitchSlider {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: #cbd5e1;
    transition: .2s ease;
    cursor: pointer;
}

    .b3dSwitchSlider::before {
        content: "";
        position: absolute;
        top: 3px;
        left: 4px;
        width: 26px;
        height: 26px;
        border-radius: 50%;
        background: #fff;
        box-shadow: 0 4px 12px rgba(0,0,0,.15);
        transition: .2s ease;
    }

.b3dSwitch input:checked + .b3dSwitchSlider {
    background: linear-gradient(180deg, #00bcd4, #0284c7);
}

    .b3dSwitch input:checked + .b3dSwitchSlider::before {
        transform: translateX(24px);
    }

.b3dSettingsGrid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0,1fr));
    gap: 12px;
}

.b3dSettingsStat {
    border-radius: 14px;
    border: 1px solid rgba(15,23,42,.08);
    background: linear-gradient(180deg, #f8fafc, #fff);
    padding: 14px;
}

.b3dSettingsStatLabel {
    display: block;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .4px;
    color: var(--b3dSetMuted);
    margin-bottom: 6px;
}

.b3dSettingsStatValue {
    display: block;
    font-size: 15px;
    font-weight: 800;
    color: #0f172a;
    word-break: break-word;
}

.b3dSettingsActions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.b3dBtn {
    height: 42px;
    border-radius: 12px;
    border: 1px solid rgba(15,23,42,.12);
    background: #fff;
    color: #0f172a;
    padding: 0 14px;
    font-weight: 800;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

    .b3dBtn:hover {
        border-color: rgba(0,172,193,.55);
    }

.b3dBtnPrimary {
    color: #fff;
    border-color: rgba(2,132,199,.12);
    background: linear-gradient(180deg, #0ea5e9, #0284c7);
}

.b3dBtnSuccess {
    color: #fff;
    border-color: rgba(22,163,74,.12);
    background: linear-gradient(180deg, #22c55e, #15803d);
}

.b3dBtnDanger {
    color: #fff;
    border-color: rgba(220,38,38,.12);
    background: linear-gradient(180deg, #ef4444, #dc2626);
}

.b3dBtn[disabled] {
    opacity: .55;
    cursor: not-allowed;
    filter: grayscale(.1);
}

.b3dSettingsAuthArea {
    display: none;
    margin-top: 6px;
    padding-top: 14px;
    border-top: 1px dashed rgba(15,23,42,.12);
}

    .b3dSettingsAuthArea.is-visible {
        display: block;
    }

.b3dAuthProviderNote {
    font-size: 13px;
    color: var(--b3dSetMuted);
    margin-bottom: 12px;
}

.b3dSettingsStatus {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 14px;
    font-size: 13px;
    line-height: 1.5;
    border: 1px solid rgba(15,23,42,.08);
    background: #f8fafc;
    color: #334155;
}

    .b3dSettingsStatus[data-tone="success"] {
        background: rgba(22,163,74,.08);
        border-color: rgba(22,163,74,.18);
        color: #166534;
    }

    .b3dSettingsStatus[data-tone="warn"] {
        background: rgba(234,88,12,.08);
        border-color: rgba(234,88,12,.18);
        color: #9a3412;
    }

    .b3dSettingsStatus[data-tone="danger"] {
        background: rgba(220,38,38,.08);
        border-color: rgba(220,38,38,.18);
        color: #991b1b;
    }

.b3dSettingsList {
    margin: 0;
    padding-left: 18px;
    color: #334155;
    line-height: 1.65;
    font-size: 14px;
}

.b3dSettingsFooter {
    padding: 14px 20px 18px;
    border-top: 1px solid var(--b3dSetBorder);
    background: linear-gradient(180deg, rgba(248,250,252,.94), rgba(255,255,255,.98));
    color: var(--b3dSetMuted);
    font-size: 12px;
}

.b3dSpinner {
    display: inline-block;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,.45);
    border-top-color: rgba(255,255,255,1);
    animation: b3dSpin .75s linear infinite;
}

@keyframes b3dSpin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 760px) {
    .b3dSettingsBody {
        padding: 16px;
    }

    .b3dSettingsHead,
    .b3dSettingsFooter {
        padding-left: 16px;
        padding-right: 16px;
    }

    .b3dSettingsGrid {
        grid-template-columns: 1fr;
    }

    .b3dSettingsToggleRow {
        flex-direction: column;
        align-items: stretch;
    }

    .b3dSwitch {
        width: 58px;
    }

    .b3dSettingsActions {
        flex-direction: column;
    }

    .b3dBtn {
        width: 100%;
    }
}

/* ====== Tabs / panels ====== */
.b3dSettingsTabs{display:flex;gap:8px;padding:12px 20px 0;background:linear-gradient(180deg,rgba(255,255,255,.98),rgba(248,250,252,.96));border-bottom:1px solid var(--b3dSetBorder)}
.b3dSettingsTab{height:40px;padding:0 16px;border-radius:12px 12px 0 0;border:1px solid rgba(15,23,42,.12);border-bottom:0;background:#eef2f7;color:#334155;font-weight:800;cursor:pointer}
.b3dSettingsTab.is-active{background:#fff;color:#0f172a;box-shadow:0 -4px 12px rgba(15,23,42,.06)}
.b3dSettingsPanel{display:none;flex-direction:column;gap:18px}
.b3dSettingsPanel.is-active{display:flex}

/* ====== Confirm overlay ====== */
.b3dBackupConfirmOverlay{position:absolute;inset:0;display:none;align-items:center;justify-content:center;background:rgba(10,18,40,.38);backdrop-filter:blur(4px);-webkit-backdrop-filter:blur(4px);z-index:40;padding:18px}
.b3dBackupConfirmOverlay.is-open{display:flex}
.b3dBackupConfirmBox{width:min(92vw,720px);background:#fff;border-radius:28px;padding:34px 30px 28px;box-shadow:0 24px 70px rgba(10,18,40,.25)}
.b3dBackupConfirmTitle{font-size:32px;line-height:1.05;font-weight:900;color:#101934;margin:0 0 16px}
.b3dBackupConfirmText{font-size:20px;line-height:1.45;color:#44506a;margin:0 0 26px;white-space:pre-line}
.b3dBackupConfirmActions{display:flex;gap:18px;justify-content:flex-end;flex-wrap:wrap}
.b3dBackupConfirmBtn{border:0;border-radius:999px;padding:18px 30px;font-size:18px;font-weight:800;cursor:pointer;min-width:180px}
.b3dBackupConfirmBtn.cancel{background:#dfe4ed;color:#15203b}.b3dBackupConfirmBtn.accept{background:#e62828;color:#fff}

/* ====== Storage ====== */
.b3dSettingsStorage{margin-top:14px;padding:14px 16px;border:1px solid rgba(9,30,66,.10);border-radius:18px;background:#f8fafc}
.b3dSettingsStorageTop{display:flex;justify-content:space-between;gap:12px;align-items:center;flex-wrap:wrap;margin-bottom:10px}
.b3dSettingsStorageLabel{font-size:12px;font-weight:800;letter-spacing:.04em;text-transform:uppercase;color:#64748b}
.b3dSettingsStorageValue{font-size:14px;font-weight:800;color:#0f172a}
.b3dSettingsStorageTrack{height:14px;border-radius:999px;background:#dbe6f5;overflow:hidden}
.b3dSettingsStorageFill{height:100%;width:0%;border-radius:999px;background:linear-gradient(90deg,#22c55e 0%,#0ea5e9 70%,#ef4444 100%);transition:width .25s ease}
.b3dSettingsStorageHint{margin-top:8px;font-size:12px;color:#64748b}

/* ====== Quota admin ====== */
.b3dQuotaAdminToolbar{display:flex;gap:12px;flex-wrap:wrap;align-items:center}
.b3dQuotaSearchInput{flex:1 1 260px;height:42px;border:1px solid rgba(15,23,42,.12);background:#fff;border-radius:12px;padding:0 14px;color:#0f172a;font-weight:700}
.b3dQuotaAdminList{display:flex;flex-direction:column;gap:12px;margin-top:12px;max-height:420px;overflow:auto;padding-right:4px}
.b3dQuotaUserRow{border:1px solid rgba(9,30,66,.10);border-radius:18px;padding:14px;background:#fff}
.b3dQuotaUserTop{display:flex;justify-content:space-between;gap:12px;align-items:flex-start;flex-wrap:wrap}
.b3dQuotaUserName{font-weight:800;color:#0f172a;font-size:16px}
.b3dQuotaUserMeta{font-size:12px;color:#64748b;margin-top:3px;word-break:break-word}
.b3dQuotaUserDate{font-size:12px;color:#64748b;font-weight:700}
.b3dQuotaBar{margin-top:12px;height:12px;border-radius:999px;background:#dbe6f5;overflow:hidden}
.b3dQuotaBarFill{height:100%;border-radius:999px;background:linear-gradient(90deg,#22c55e 0%,#0ea5e9 70%,#ef4444 100%)}
.b3dQuotaUserStats{font-size:12px;color:#64748b;margin-top:8px}
.b3dQuotaEditor{display:grid;grid-template-columns:minmax(140px,180px) auto auto auto;gap:10px;align-items:center;margin-top:12px}
.b3dQuotaEditor input[type=number]{width:100%;border:1px solid #cbd5e1;border-radius:12px;padding:10px 12px;font-size:14px;font-weight:700}
.b3dQuotaEditor label{font-size:13px;color:#334155;font-weight:700}.b3dQuotaCheck{display:flex;gap:8px;align-items:center;white-space:nowrap}.b3dQuotaEmpty{padding:12px 0;color:#64748b;font-weight:700}

body.backup-modal-open #hint,body.backup-modal-open #hint.hint{display:none !important}

@media (max-width:760px){
  .b3dSettingsTabs{padding:10px 16px 0}
  .b3dBackupConfirmBox{padding:26px 20px 22px}.b3dBackupConfirmTitle{font-size:24px}.b3dBackupConfirmText{font-size:18px}.b3dBackupConfirmActions{justify-content:stretch}.b3dBackupConfirmBtn{width:100%;min-width:0}
  .b3dQuotaEditor{grid-template-columns:1fr}
}
/* ====== Quota admin grid paginado ====== */
.b3dQuotaTable {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 12px;
    background: #fff;
    border: 1px solid rgba(9,30,66,.10);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 20px rgba(15,23,42,.05);
}

    .b3dQuotaTable thead th {
        position: sticky;
        top: 0;
        z-index: 1;
        background: linear-gradient(180deg, #f8fafc, #eef2f7);
        color: #334155;
        font-size: 12px;
        font-weight: 900;
        text-align: left;
        padding: 12px 10px;
        border-bottom: 1px solid rgba(9,30,66,.10);
        white-space: nowrap;
    }

    .b3dQuotaTable tbody tr:nth-child(even) {
        background: rgba(248,250,252,.65);
    }

    .b3dQuotaTable tbody tr:hover {
        background: rgba(14,165,233,.05);
    }

    .b3dQuotaTable td {
        padding: 12px 10px;
        border-bottom: 1px solid rgba(9,30,66,.08);
        vertical-align: middle;
        font-size: 13px;
        color: #334155;
    }

    .b3dQuotaTable tbody tr:last-child td {
        border-bottom: 0;
    }

.b3dQuotaCellName {
    font-weight: 800;
    color: #0f172a;
    line-height: 1.35;
    word-break: break-word;
}

.b3dQuotaMiniBar {
    width: 180px;
    max-width: 100%;
    height: 10px;
    border-radius: 999px;
    background: #dbe6f5;
    overflow: hidden;
    margin-bottom: 6px;
}

.b3dQuotaMiniBarFill {
    height: 100%;
    width: 0%;
    border-radius: 999px;
    background: linear-gradient(90deg, #22c55e 0%, #0ea5e9 70%, #ef4444 100%);
    transition: width .25s ease;
}

.b3dQuotaMiniText {
    font-size: 12px;
    color: #64748b;
    line-height: 1.35;
    white-space: nowrap;
}

.b3dQuotaTable .b3dQuotaInput {
    width: 110px;
    min-width: 90px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    padding: 8px 10px;
    font-size: 13px;
    font-weight: 700;
    color: #0f172a;
    background: #fff;
}

.b3dQuotaTable .b3dQuotaCheck {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    white-space: nowrap;
}

.b3dQuotaTableActions {
    display: flex;
    gap: 8px;
    flex-wrap: nowrap;
    align-items: center;
}

    .b3dQuotaTableActions .b3dBtn {
        height: 38px;
        padding: 0 12px;
        font-size: 18px;
        white-space: nowrap;
    }

.b3dQuotaPager {
    margin-top: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.b3dQuotaPagerInfo {
    flex: 1 1 auto;
    text-align: center;
    font-size: 13px;
    font-weight: 700;
    color: #475569;
}

.b3dQuotaAdminList {
    margin-top: 12px;
    overflow: auto;
    max-height: 460px;
    border-radius: 16px;
}

/* Ajustes responsive */
@media (max-width: 1100px) {
    .b3dQuotaTable {
        min-width: 980px;
    }

    .b3dQuotaAdminList {
        overflow-x: auto;
    }
}

@media (max-width: 760px) {
    .b3dQuotaPager {
        flex-direction: column;
        align-items: stretch;
    }

    .b3dQuotaPagerInfo {
        text-align: center;
    }

    .b3dQuotaPager .b3dBtn {
        width: 100%;
    }
}
.b3dEmailLoginForm {
    margin: 10px 0 18px;
}

    .b3dEmailLoginForm .b3dQuotaSearchInput {
        width: 100%;
        max-width: 100%;
    }