/* ==========================================================================
   Admin Panel theme — clean light HR-dashboard look (Keka-style)
   White sidebar · soft gray canvas · indigo accent · airy cards
   ========================================================================== */

@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url('fonts/inter.woff2') format('woff2');
}

:root {
    --sidebar-width: 256px;
    --topbar-height: 64px;

    --accent: #5a67f2;           /* primary indigo-blue */
    --accent-dark: #4753e0;
    --accent-soft: #eef0ff;      /* active pill bg */
    --accent-ring: rgba(90, 103, 242, .16);

    --ink: #1f2437;              /* headings / main text */
    --text: #3d4357;
    --muted: #8a90a3;
    --line: #e9ebf2;
    --body-bg: #f5f6fa;

    --shadow-xs: 0 1px 2px rgba(31, 36, 55, .04);
    --shadow-sm: 0 1px 3px rgba(31, 36, 55, .06), 0 1px 2px rgba(31, 36, 55, .04);
    --shadow-md: 0 6px 18px rgba(31, 36, 55, .07);
    --shadow-lg: 0 14px 34px rgba(31, 36, 55, .12);
}

* {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
    background: var(--body-bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6, .fw-bold, .fw-semibold { color: var(--ink); }

/* ============================ Sidebar (light) ============================ */
.admin-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-width);
    background: #ffffff;
    color: var(--text);
    display: flex;
    flex-direction: column;
    z-index: 1040;
    transition: transform .25s ease;
    overflow-y: auto;
    border-right: 1px solid var(--line);
}

.admin-sidebar::-webkit-scrollbar { width: 6px; }
.admin-sidebar::-webkit-scrollbar-thumb { background: #dfe2ec; border-radius: 3px; }

.admin-sidebar .sidebar-brand {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: 0 1.1rem;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -.01em;
    color: var(--ink);
    flex-shrink: 0;
    border-bottom: 1px solid var(--line);
}

.admin-sidebar .sidebar-brand .brand-logo {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
}

.admin-sidebar .sidebar-brand .brand-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.admin-sidebar .sidebar-brand .brand-sub {
    display: block;
    font-size: .58rem;
    font-weight: 700;
    letter-spacing: .3em;
    color: var(--accent);
}

.admin-sidebar .nav {
    padding: .65rem .75rem 1.25rem;
    gap: .1rem;
}

.admin-sidebar .nav-section {
    font-size: .66rem;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: #a5aabb;
    padding: 1.05rem .8rem .35rem;
    font-weight: 700;
}

.admin-sidebar .nav-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: .7rem;
    color: var(--text);
    padding: .56rem .8rem;
    border-radius: .55rem;
    font-size: .9rem;
    font-weight: 500;
    transition: background .14s ease, color .14s ease;
}

.admin-sidebar .nav-link i {
    font-size: 1.08rem;
    width: 1.35rem;
    text-align: center;
    color: #9aa0b4;
    transition: color .14s ease;
}

.admin-sidebar .nav-link:hover {
    background: #f4f5f9;
    color: var(--ink);
}

.admin-sidebar .nav-link:hover i { color: var(--accent); }

.admin-sidebar .nav-link.active {
    background: var(--accent-soft);
    color: var(--accent-dark);
    font-weight: 600;
}

.admin-sidebar .nav-link.active i { color: var(--accent); }

.admin-sidebar .nav-link.active::before {
    content: '';
    position: absolute;
    left: -0.75rem;
    top: 20%;
    bottom: 20%;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--accent);
}

.admin-sidebar .sidebar-footer {
    margin-top: auto;
    padding: 1rem 1.2rem 1.2rem;
    font-size: .74rem;
    color: #a5aabb;
    border-top: 1px solid var(--line);
}

/* ============================ Layout ============================ */
.admin-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin-left .25s ease;
}

/* ============================ Topbar ============================ */
.admin-topbar {
    height: var(--topbar-height);
    background: rgba(255, 255, 255, .85);
    backdrop-filter: saturate(180%) blur(10px);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 1030;
}

.admin-topbar .btn-toggle {
    border: none;
    background: transparent;
    font-size: 1.4rem;
    color: var(--text);
    line-height: 1;
}

.admin-topbar .topbar-search {
    position: relative;
    max-width: 340px;
    width: 100%;
}

.admin-topbar .topbar-search i {
    position: absolute;
    left: .85rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    font-size: .95rem;
}

.admin-topbar .topbar-search input {
    border: 1px solid var(--line);
    background: #f7f8fb;
    border-radius: .7rem;
    padding: .5rem .85rem .5rem 2.3rem;
    font-size: .9rem;
    width: 100%;
    transition: all .15s ease;
}

.admin-topbar .topbar-search input:focus {
    outline: none;
    background: #fff;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-ring);
}

.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    position: relative;
    transition: all .15s ease;
}

.icon-btn:hover { background: #f4f5f9; color: var(--ink); }

.icon-btn .dot {
    position: absolute;
    top: 8px;
    right: 9px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ef4444;
    border: 2px solid #fff;
}

.avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #7c8bff);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: .9rem;
    flex-shrink: 0;
}

.admin-topbar .user-btn { border: none; background: transparent; border-radius: 12px; }
.admin-topbar .user-btn:hover { background: #f4f5f9; }

/* ============================ Page ============================ */
.admin-page {
    padding: 1.75rem 2rem 2.5rem;
    max-width: 1440px;
}

.page-title {
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -.02em;
    color: var(--ink);
}

/* ============================ Cards ============================ */
.card {
    border: 1px solid var(--line);
    border-radius: .9rem;
    box-shadow: var(--shadow-sm);
    background: #fff;
}

.card-header {
    background: transparent !important;
    border-bottom: 1px solid var(--line);
    padding: 1rem 1.25rem;
    font-weight: 600;
    color: var(--ink);
}

/* ---------- Stat cards ---------- */
.stat-card {
    border: 1px solid var(--line);
    border-radius: .9rem;
    background: #fff;
    transition: transform .16s ease, box-shadow .16s ease;
    overflow: hidden;
    position: relative;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.stat-card .stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.45rem;
    flex-shrink: 0;
}

.stat-card .stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -.02em;
    color: var(--ink);
}

.stat-card .stat-label {
    color: var(--muted);
    font-size: .84rem;
    font-weight: 500;
}

.trend {
    display: inline-flex;
    align-items: center;
    gap: .2rem;
    font-size: .77rem;
    font-weight: 600;
    padding: .15rem .5rem;
    border-radius: 50rem;
}
.trend.up   { color: #0d7a4f; background: #e5f7ef; }
.trend.down { color: #c22f3d; background: #fdeaec; }

/* soft icon tiles */
.tile-violet { background: #eef0ff; color: var(--accent-dark); }
.tile-green  { background: #e5f7ef; color: #0d7a4f; }
.tile-amber  { background: #fff4e0; color: #b26a00; }
.tile-sky    { background: #e6f4fd; color: #0b6aa2; }

/* ============================ Tables ============================ */
.table { --bs-table-bg: transparent; margin-bottom: 0; color: var(--text); }
.table > thead th {
    background: #f7f8fb;
    color: var(--muted);
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    font-weight: 700;
    border-bottom: 1px solid var(--line);
    padding-top: .75rem;
    padding-bottom: .75rem;
}
.table > tbody td { padding-top: .8rem; padding-bottom: .8rem; vertical-align: middle; border-color: #f0f1f6; }
.table-hover > tbody > tr:hover > * { background: #f8f9fe; }

.badge { font-weight: 600; padding: .38em .68em; border-radius: 50rem; }

/* ============================ Buttons / forms ============================ */
.btn { border-radius: .6rem; font-weight: 500; }

.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 4px 12px var(--accent-ring);
}
.btn-primary:hover, .btn-primary:focus, .btn-primary:active,
.btn-primary:first-child:active {
    background: var(--accent-dark);
    border-color: var(--accent-dark);
    box-shadow: 0 6px 16px rgba(90, 103, 242, .3);
}
.btn-primary:disabled { background: #a9b1f8; border-color: #a9b1f8; }

.btn-outline-primary { color: var(--accent-dark); border-color: #c3c9f9; }
.btn-outline-primary:hover, .btn-outline-primary:focus,
.btn-outline-primary:active, .btn-outline-primary.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.form-control, .form-select { border-radius: .6rem; border-color: #dde0ea; color: var(--ink); }
.form-control:focus, .form-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-ring);
}
.form-check-input:checked { background-color: var(--accent); border-color: var(--accent); }
.form-check-input:focus { box-shadow: 0 0 0 3px var(--accent-ring); border-color: var(--accent); }
.form-label { font-weight: 500; color: var(--ink); font-size: .88rem; }

/* pagination */
.page-link { color: var(--text); border-color: var(--line); }
.page-item.active .page-link { background: var(--accent); border-color: var(--accent); }
.page-link:focus { box-shadow: 0 0 0 3px var(--accent-ring); }

/* dropdowns / modals — soft rounded */
.dropdown-menu { border: 1px solid var(--line); box-shadow: var(--shadow-md); border-radius: .75rem; }
.modal-content { border: none; border-radius: 1rem; box-shadow: var(--shadow-lg); }

/* ============================ Backdrop / responsive ============================ */
.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(31, 36, 55, .45);
    z-index: 1035;
    display: none;
}

@media (max-width: 991.98px) {
    .admin-sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
    .admin-sidebar.show { transform: translateX(0); }
    .admin-content { margin-left: 0; }
    .sidebar-backdrop.show { display: block; }
    .admin-page { padding: 1.25rem; }
}

/* ============================ Login ============================ */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(900px 460px at 8% 0%, #e4e7ff 0%, transparent 55%),
        radial-gradient(800px 420px at 100% 100%, #eef0ff 0%, transparent 50%),
        #f5f6fa;
}

.login-card {
    width: 100%;
    max-width: 420px;
    border: 1px solid var(--line);
    border-radius: 1.1rem;
    box-shadow: var(--shadow-lg);
    background: #fff;
}

.login-card .login-icon {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.1rem;
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.login-card .login-icon img { width: 100%; height: 100%; object-fit: cover; }

.login-card .input-group-text { background: #f7f8fb; border-color: #dde0ea; color: var(--muted); }

/* ── Post form: image picker + crop dialog + editor tweaks ── */
.tox-tinymce{border-radius:.375rem!important;}
.image-picker{border:2px dashed #d4d8e4;border-radius:.5rem;padding:.4rem;cursor:pointer;
    transition:border-color .15s,background .15s;text-align:center;margin-bottom:.5rem;overflow:hidden;}
.image-picker:hover{border-color:var(--accent);background:#f8f9fe;}
.image-picker.is-invalid{border-color:#dc3545;}
.image-picker img{border-radius:.375rem;}
.image-picker-placeholder{padding:2.25rem 1rem;color:#6c757d;}
.image-picker-placeholder i{font-size:2rem;display:block;margin-bottom:.4rem;}
/* Popup fits the image area (not a giant empty box). */
#cropDialog{max-width:fit-content;width:auto;}
#cropModal .modal-body{padding:0;background:#1e1e1e;}
#cropModal .crop-stage{line-height:0;}
#cropModal #cropImage{display:block;max-width:88vw;max-height:74vh;}

/* Sidebar collapsible submenu (Videos dropdown) */
.admin-sidebar .nav-caret {
    font-size: .75rem;
    transition: transform .2s ease;
}
.admin-sidebar .nav-parent[aria-expanded="true"] .nav-caret {
    transform: rotate(180deg);
}
.admin-sidebar .nav-sublink {
    padding-left: 2.6rem;
    font-size: .9rem;
}
.admin-sidebar .nav-sublink i {
    font-size: .85rem;
}
