/* =========================================================================
   WHM Disk Usage Tracker — sakin, derli toplu arayüz teması
   Bootstrap 5 temel alınır; aşağıdaki katman onu yumuşak, az gürültülü bir
   görünüme dönüştürür. Mevcut sınıf adları korunur, yalnızca yeniden stillenir.
   ========================================================================= */

:root {
    --bg: #f5f6f8;
    --surface: #ffffff;
    --surface-2: #fafbfc;
    --border: #e8eaee;
    --border-strong: #dde0e6;
    --text: #1f2733;
    --muted: #6b7280;
    --muted-2: #9aa1ad;

    --primary: #4f46e5;
    --primary-ink: #4338ca;
    --primary-soft: #eef0fe;

    --ok-bg: #e9f7ef;     --ok-ink: #1b7a44;
    --warn-bg: #fdf3e3;   --warn-ink: #9a6212;
    --bad-bg: #fdecec;    --bad-ink: #b42929;
    --info-bg: #eaf2fd;   --info-ink: #1d5fb5;
    --neutral-bg: #eef0f3; --neutral-ink: #5a6473;

    --radius: 12px;
    --radius-sm: 9px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
    --shadow-pop: 0 8px 28px rgba(16, 24, 40, .12);
    --sidebar-w: 244px;
}

* { box-sizing: border-box; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary-ink); text-decoration: none; }
a:hover { color: var(--primary); text-decoration: underline; }

/* ----------------------------------------------------------------- shell */
.app-shell { min-height: 100vh; }

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-w);
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 1040;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: 1.1rem 1.25rem;
    font-weight: 650;
    font-size: .98rem;
    color: var(--text);
    border-bottom: 1px solid var(--border);
}

.sidebar-brand .brand-mark {
    width: 30px; height: 30px;
    border-radius: 8px;
    background: var(--primary);
    color: #fff;
    display: grid; place-items: center;
    flex: 0 0 auto;
}

.sidebar-nav {
    padding: .75rem .6rem;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow-y: auto;
    flex: 1 1 auto;
}

.sidebar-nav .nav-section {
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--muted-2);
    padding: .9rem .65rem .35rem;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .55rem .65rem;
    border-radius: var(--radius-sm);
    color: var(--muted);
    font-weight: 500;
    line-height: 1.1;
}
.sidebar-nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.sidebar-nav a.active { background: var(--primary-soft); color: var(--primary-ink); }
.sidebar-nav a svg { width: 18px; height: 18px; flex: 0 0 auto; opacity: .9; }
.sidebar-nav a.active svg { opacity: 1; }

.sidebar-footer {
    border-top: 1px solid var(--border);
    padding: .85rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
}
.sidebar-footer .who { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.sidebar-footer .who small { color: var(--muted-2); font-size: .72rem; }
.sidebar-footer .who strong { font-weight: 600; font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.app-main { margin-left: var(--sidebar-w); min-height: 100vh; }

.topbar {
    display: none;
    align-items: center;
    gap: .75rem;
    padding: .6rem .9rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 1030;
}
.topbar .topbar-brand { font-weight: 650; }

.sidebar-toggle {
    border: 1px solid var(--border-strong);
    background: var(--surface);
    border-radius: 9px;
    width: 38px; height: 38px;
    display: grid; place-items: center;
    color: var(--text);
}

.content { padding: 1.6rem; max-width: 1320px; }

.sidebar-backdrop { display: none; }

@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform .2s ease;
        box-shadow: var(--shadow-pop);
    }
    body.sidebar-open .sidebar { transform: translateX(0); }
    .app-main { margin-left: 0; }
    .topbar { display: flex; }
    .content { padding: 1.1rem; }
    body.sidebar-open .sidebar-backdrop {
        display: block;
        position: fixed; inset: 0;
        background: rgba(16, 24, 40, .35);
        z-index: 1035;
    }
}

/* --------------------------------------------------------------- headings */
.page-title { font-size: 1.45rem; font-weight: 650; line-height: 1.2; margin: 0; letter-spacing: -.01em; }
.text-muted { color: var(--muted) !important; }

/* ----------------------------------------------------------------- panels */
.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.15rem 1.25rem;
    box-shadow: var(--shadow);
}
.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: .9rem;
}
.panel-header h2 { font-size: .98rem; font-weight: 640; margin: 0; }
.subsection-title { font-size: .92rem; font-weight: 620; margin: 0 0 .85rem; }

/* ------------------------------------------------------------- stat cards */
.stat-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.1rem;
    min-height: 86px;
    box-shadow: var(--shadow);
}
.stat-box span { display: block; color: var(--muted); font-size: .78rem; margin-bottom: .35rem; font-weight: 500; }
.stat-box strong { display: block; font-size: 1.5rem; font-weight: 660; line-height: 1.15; letter-spacing: -.01em; }
.stat-box .stat-date { font-size: .92rem; font-weight: 600; }

/* --------------------------------------------------------------- queue pills */
.queue-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(124px, 1fr)); gap: .7rem; }
.queue-pill {
    display: flex; align-items: center; justify-content: space-between; gap: .6rem;
    padding: .7rem .85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    text-decoration: none; color: inherit;
    box-shadow: var(--shadow);
}
.queue-pill:hover { border-color: var(--primary); background: var(--primary-soft); text-decoration: none; }
.queue-pill.active { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 2px var(--primary-soft); }
.queue-pill span { color: var(--muted); font-size: .82rem; }
.queue-pill strong { font-size: 1.25rem; font-weight: 660; }

/* Readable, wrapping error text — no truncation. Used on the queue page. */
.err-text {
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: anywhere;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: .8rem;
    line-height: 1.4;
    max-width: 520px;
}
.queue-error-panel { border-left: 3px solid var(--danger, #dc3545); }
.err-summary-item { padding: .6rem 0; border-bottom: 1px solid var(--border); }
.err-summary-item:last-of-type { border-bottom: 0; }

/* -------------------------------------------------------------------- tables */
.table { --bs-table-bg: transparent; color: var(--text); margin-bottom: 0; }
.table > thead th {
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--muted-2);
    font-weight: 600;
    border-bottom: 1px solid var(--border);
    padding: .55rem .6rem;
    white-space: nowrap;
}
.table > tbody td { padding: .62rem .6rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table > tbody tr:last-child td { border-bottom: 0; }
.table-hover > tbody > tr:hover > * { background: var(--surface-2); }
.table > :not(:first-child) { border-top: 0; }
/* keep our table interactive even without .table-hover */
.panel .table > tbody > tr:hover > td { background: var(--surface-2); }
.table-warning, .table-warning > td { background: var(--warn-bg) !important; }

.path-cell { max-width: 380px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .8rem; }
.cell-sub { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* File name + always-visible extension badge (name truncates, badge never does) */
.file-line { display: flex; align-items: center; gap: .45rem; max-width: 380px; }
.file-line .file-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.ext-badge {
    flex: 0 0 auto;
    display: inline-block;
    padding: .18em .5em;
    border-radius: 6px;
    background: var(--primary-soft);
    color: var(--primary-ink);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: .7rem;
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: .02em;
}
.ext-badge.ext-none { background: var(--neutral-bg); color: var(--muted); }
.table-error { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.context-cell { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* -------------------------------------------------------------------- badges */
.badge { font-weight: 600; font-size: .72rem; padding: .3em .6em; border-radius: 999px; letter-spacing: 0; }
.badge.text-bg-success { background: var(--ok-bg) !important; color: var(--ok-ink) !important; }
.badge.text-bg-warning { background: var(--warn-bg) !important; color: var(--warn-ink) !important; }
.badge.text-bg-danger  { background: var(--bad-bg) !important; color: var(--bad-ink) !important; }
.badge.text-bg-info    { background: var(--info-bg) !important; color: var(--info-ink) !important; }
.badge.text-bg-primary { background: var(--primary-soft) !important; color: var(--primary-ink) !important; }
.badge.text-bg-secondary { background: var(--neutral-bg) !important; color: var(--neutral-ink) !important; }
.badge.text-bg-light   { background: var(--neutral-bg) !important; color: var(--muted) !important; }

/* ------------------------------------------------------------------ buttons */
.btn { font-weight: 550; border-radius: 9px; font-size: .85rem; padding: .42rem .85rem; --bs-btn-focus-box-shadow: 0 0 0 .2rem rgba(79,70,229,.15); }
.btn-sm { font-size: .78rem; padding: .3rem .6rem; border-radius: 8px; }

.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover, .btn-primary:focus { background: var(--primary-ink); border-color: var(--primary-ink); color: #fff; }

/* tüm "outline" butonlar sakin, nötr bir hayalet stile iner; renk yalnızca
   hover'da ipucu olarak belirir → renk gürültüsü ciddi şekilde azalır */
.btn-outline-primary, .btn-outline-secondary, .btn-outline-info,
.btn-outline-warning, .btn-outline-success, .btn-outline-danger {
    background: var(--surface);
    border-color: var(--border-strong);
    color: var(--text);
}
.btn-outline-primary:hover, .btn-outline-secondary:hover, .btn-outline-info:hover,
.btn-outline-warning:hover, .btn-outline-success:hover {
    background: var(--surface-2); border-color: var(--muted-2); color: var(--text);
}
.btn-outline-danger { color: var(--bad-ink); }
.btn-outline-danger:hover { background: var(--bad-bg); border-color: var(--bad-ink); color: var(--bad-ink); }
.btn-danger { background: var(--bad-ink); border-color: var(--bad-ink); }
.btn-danger:hover { background: #9c2222; border-color: #9c2222; }
.btn-light { background: var(--surface-2); border-color: var(--border-strong); color: var(--text); }
.btn-light:hover { background: var(--neutral-bg); }

/* ----------------------------------------------------------------- dropdown */
.dropdown-menu {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-pop);
    padding: .35rem;
    font-size: .85rem;
}
.dropdown-item { border-radius: 7px; padding: .45rem .6rem; color: var(--text); }
.dropdown-item:hover { background: var(--surface-2); }
.dropdown-item.text-danger:hover { background: var(--bad-bg); }
.dropdown-menu form { margin: 0; }
.dropdown-menu .dropdown-item { width: 100%; text-align: left; background: none; border: 0; }

/* -------------------------------------------------------------------- forms */
.form-label { font-size: .78rem; font-weight: 600; color: var(--muted); margin-bottom: .3rem; }
.form-control, .form-select {
    border: 1px solid var(--border-strong);
    border-radius: 9px;
    font-size: .86rem;
    padding: .45rem .65rem;
    color: var(--text);
    background-color: var(--surface);
}
.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 .2rem rgba(79, 70, 229, .12);
}
.form-control::placeholder { color: var(--muted-2); }
.form-check-input:checked { background-color: var(--primary); border-color: var(--primary); }
.form-text { color: var(--muted-2); font-size: .76rem; }
.input-group-text { background: var(--surface-2); border-color: var(--border-strong); color: var(--muted); font-size: .82rem; }

/* ------------------------------------------------------------------- alerts */
.alert { border-radius: var(--radius-sm); border: 1px solid transparent; font-size: .88rem; }
.alert-success { background: var(--ok-bg); color: var(--ok-ink); border-color: #cdeedd; }
.alert-warning { background: var(--warn-bg); color: var(--warn-ink); border-color: #f4e3c4; }
.alert-danger  { background: var(--bad-bg); color: var(--bad-ink); border-color: #f5cfcf; }
.alert-info    { background: var(--info-bg); color: var(--info-ink); border-color: #cfe0f6; }
.alert-light   { background: var(--surface-2); color: var(--muted); border-color: var(--border); }

/* --------------------------------------------------------------- code boxes */
.command-box {
    background: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: .75rem .9rem;
    margin: 0;
    overflow-x: auto;
    white-space: pre;
    font-size: .82rem;
}
.command-box code { color: inherit; }
code { color: var(--primary-ink); background: var(--primary-soft); padding: .05rem .35rem; border-radius: 5px; font-size: .82em; }

.log-context-details summary { cursor: pointer; color: var(--primary-ink); }
.log-context-details pre {
    max-width: min(760px, 70vw); max-height: 360px; overflow: auto;
    margin: .5rem 0 0; padding: .75rem;
    border-radius: var(--radius-sm);
    background: #0f172a; color: #e2e8f0;
    white-space: pre-wrap; word-break: break-word; font-size: .8rem;
}

/* --------------------------------------------------------- settings blocks */
.schedule-interval-cell { width: 140px; }
.rule-list { display: grid; gap: .85rem; }
.rule-item { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 1rem; background: var(--surface-2); }
.code-textarea { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .84rem; }
.proxy-settings-box { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); padding: 1rem; }
.permission-list { display: grid; gap: .7rem; }
.permission-item { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); padding: .85rem; }

/* ---------------------------------------------------------------- actions row */
.quick-actions { display: flex; flex-wrap: wrap; gap: .55rem; }

/* ------------------------------------------------------------------ login */
.login-body { min-height: 100vh; display: grid; place-items: center; background: var(--bg); padding: 1rem; }
.login-shell { width: min(400px, 100%); }
.login-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.75rem;
    box-shadow: var(--shadow-pop);
}
.login-card .brand-mark {
    width: 42px; height: 42px; border-radius: 11px;
    background: var(--primary); color: #fff;
    display: grid; place-items: center; margin: 0 auto 1rem;
}
.login-card h1 { font-size: 1.2rem; font-weight: 650; margin-bottom: .35rem; text-align: center; }
.login-card .login-sub { color: var(--muted); font-size: .85rem; text-align: center; margin-bottom: 1.4rem; }

/* ----------------------------------------------------- disk usage trend bars */
.trend-bars { display: flex; align-items: flex-end; gap: 2px; height: 88px; padding-top: 4px; }
.trend-bars .trend-bar {
    flex: 1 1 auto; min-width: 4px;
    background: linear-gradient(to top, var(--primary), #818cf8);
    border-radius: 3px 3px 0 0;
    transition: opacity .15s ease;
}
.trend-bars .trend-bar:hover { opacity: .65; }

/* ----------------------------------------------------------- settings page */
.section-title { font-size: 1.05rem; font-weight: 640; margin: 0 0 .9rem; letter-spacing: -.01em; }

.settings-nav { display: flex; flex-wrap: wrap; gap: .4rem; }
.settings-nav a {
    display: inline-block;
    padding: .35rem .75rem;
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    background: var(--surface);
    color: var(--muted);
    font-size: .82rem;
    font-weight: 550;
    text-decoration: none;
}
.settings-nav a:hover { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-ink); text-decoration: none; }

.task-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-2);
    padding: 1.15rem 1.25rem;
}
.task-card + .task-card { margin-top: .85rem; }
.task-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1rem; }
.task-card-title { font-weight: 600; font-size: .96rem; }
.task-card .form-switch .form-check-label { font-size: .82rem; color: var(--muted); }

.task-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem 1.25rem;
    align-items: end;
}
.task-card-grid .field label { display: block; font-size: .78rem; font-weight: 600; color: var(--muted); margin-bottom: .35rem; }
.task-card-grid .input-group .form-control { min-width: 80px; }

.task-meta {
    margin-top: 1rem;
    padding-top: .8rem;
    border-top: 1px dashed var(--border-strong);
}

/* ----------------------------------------------------- account insights */
.insight-tags { display: flex; flex-wrap: wrap; gap: .5rem; }
.insight-tag {
    display: inline-flex; align-items: center;
    padding: .35rem .7rem;
    border-radius: 999px;
    font-size: .82rem; font-weight: 550;
    border: 1px solid transparent;
}
.insight-tag.insight-warn { background: var(--warn-bg); color: var(--warn-ink); border-color: #f4e3c4; }
.insight-tag.insight-info { background: var(--neutral-bg); color: var(--neutral-ink); }

.insight-mini {
    margin-top: 2px;
    font-size: .74rem;
    line-height: 1.2;
    max-width: 280px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.insight-mini.insight-warn { color: var(--warn-ink); }
.insight-mini.insight-info { color: var(--muted); }

@media (max-width: 768px) {
    .path-cell, .table-error, .context-cell, .file-name, .cell-sub { max-width: 160px; }
    .content { padding: 1rem; }
    .task-card-grid { grid-template-columns: 1fr; }
    .insight-mini { max-width: 160px; }
}

/* ----------------------------------------------- file-deletion report */
.stat-box.stat-reclaim { background: var(--ok-bg); border-color: #bfe6cf; }
.stat-box.stat-reclaim span,
.stat-box.stat-reclaim strong { color: var(--ok-ink); }
.stat-box.stat-reclaim .stat-sub { font-size: .76rem; font-weight: 500; color: var(--ok-ink); opacity: .85; }

.ext-row { margin-bottom: .85rem; }
.ext-row:last-child { margin-bottom: 0; }
.ext-row .ext-head { display: flex; justify-content: space-between; align-items: baseline; gap: .6rem; margin-bottom: .32rem; }
.ext-row .ext-name code { background: var(--neutral-bg); color: var(--neutral-ink); padding: .08rem .45rem; border-radius: 5px; font-size: .82rem; font-weight: 600; }
.ext-row .ext-val { font-size: .82rem; color: var(--muted); white-space: nowrap; }
.ext-row .ext-val b { color: var(--text); font-weight: 640; }
.ext-bar { height: 8px; border-radius: 6px; background: var(--neutral-bg); overflow: hidden; }
.ext-bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), #7c74f0); border-radius: 6px; min-width: 2px; }

/* ----------------------------------------------- bulk select / delete bar */
.bulk-bar {
    position: sticky;
    top: 0;
    z-index: 5;
    background: var(--primary-soft);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    padding: .6rem .85rem;
    margin-bottom: .9rem;
}
.bulk-bar #bulk-count { font-size: 1.05rem; }

/* --------------------------------------------------------- live cron monitor */
.cron-live { display: inline-flex; align-items: center; gap: .4rem; }
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: #2bb673; box-shadow: 0 0 0 0 rgba(43,182,115,.6); animation: livePulse 1.8s infinite; }
@keyframes livePulse { 0% { box-shadow: 0 0 0 0 rgba(43,182,115,.55); } 70% { box-shadow: 0 0 0 7px rgba(43,182,115,0); } 100% { box-shadow: 0 0 0 0 rgba(43,182,115,0); } }
.cron-clock { font-variant-numeric: tabular-nums; letter-spacing: .02em; }

.cron-running-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; }
.cron-running-list li { display: flex; align-items: center; gap: .5rem; }
.spinner { width: 13px; height: 13px; border: 2px solid var(--border-strong); border-top-color: var(--primary); border-radius: 50%; display: inline-block; animation: spin .8s linear infinite; flex-shrink: 0; }
@keyframes spin { to { transform: rotate(360deg); } }

.cron-next-list { margin: 0; padding-left: 1.4rem; display: flex; flex-direction: column; gap: .4rem; }
.cron-next-list li { padding-left: .2rem; }
.cron-next-list li::marker { color: var(--muted-2); font-variant-numeric: tabular-nums; }
