/* ==========================================================================
   RJP Admin Panel
   ========================================================================== */

:root {
    --ad-green:     #0B5D3B;
    --ad-green-dk:  #08492E;
    --ad-saffron:   #F59E0B;
    --ad-sidebar:   #08130E;
    --ad-sidebar-2: #14261E;
    --ad-ink:       #14261E;
    --ad-body:      #5A6B63;
    --ad-line:      #E2E9E5;
    --ad-bg:        #F2F5F3;
    --ad-radius:    10px;
    --ad-shadow:    0 1px 3px rgba(16, 42, 30, .08);
    --ad-shadow-lg: 0 8px 26px rgba(16, 42, 30, .13);
    --ad-sidebar-w: 250px;
}

* { box-sizing: border-box; }

body {
    font-family: 'Plus Jakarta Sans', 'Noto Sans Devanagari', system-ui, -apple-system, 'Segoe UI', sans-serif;
    background: var(--ad-bg);
    color: var(--ad-body);
    font-size: .9rem;
}

h1, h2, h3, h4, h5, h6 { color: var(--ad-ink); font-weight: 600; }
a { color: var(--ad-green); text-decoration: none; }
a:hover { color: var(--ad-green-dk); }
.req { color: #dc3545; }

:focus-visible { outline: 3px solid var(--ad-saffron); outline-offset: 2px; }

/* ------------------------------------------------------------------- login */

.login-body {
    background: linear-gradient(130deg, var(--ad-green-dk), var(--ad-green) 55%, #0d8f56);
    min-height: 100vh;
}
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.5rem; }
.login-card {
    width: 100%; max-width: 400px; background: #fff;
    border-radius: 16px; padding: 2rem; box-shadow: 0 18px 50px rgba(0, 0, 0, .25);
}
.login-head { text-align: center; margin-bottom: 1.75rem; }
.login-head h1 { font-size: 1.15rem; margin: .75rem 0 .2rem; }
.login-head p { color: #8b968f; font-size: .82rem; margin: 0; }
.login-foot { text-align: center; margin-top: 1.5rem; font-size: .82rem; }

/* ------------------------------------------------------------------ shell */

.admin-shell { display: flex; min-height: 100vh; }

.admin-sidebar {
    width: var(--ad-sidebar-w); flex-shrink: 0;
    background: var(--ad-sidebar); color: rgba(255, 255, 255, .78);
    position: fixed; inset: 0 auto 0 0; z-index: 1045;
    overflow-y: auto; transition: transform .25s ease;
}
.admin-main {
    flex: 1 1 auto; min-width: 0;
    margin-left: var(--ad-sidebar-w);
    display: flex; flex-direction: column; min-height: 100vh;
}

.sidebar-brand {
    display: flex; align-items: center; gap: .7rem;
    padding: 1.1rem 1.15rem; border-bottom: 1px solid rgba(255, 255, 255, .08);
    position: sticky; top: 0; background: var(--ad-sidebar); z-index: 2;
}
.sidebar-brand div { display: flex; flex-direction: column; line-height: 1.25; }
.sidebar-brand strong { color: #fff; font-size: .95rem; }
.sidebar-brand small { color: var(--ad-saffron); font-size: .7rem; }

.sidebar-nav { padding: .75rem 0 2rem; }
.sidebar-heading {
    font-size: .68rem; text-transform: uppercase; letter-spacing: .9px;
    color: rgba(255, 255, 255, .38); padding: 1rem 1.15rem .4rem; font-weight: 600;
}
.sidebar-link {
    display: flex; align-items: center; gap: .7rem;
    padding: .6rem 1.15rem; color: rgba(255, 255, 255, .78);
    font-size: .87rem; border-left: 3px solid transparent;
    transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.sidebar-link i { font-size: 1rem; width: 18px; text-align: center; flex-shrink: 0; }
.sidebar-link span { flex: 1 1 auto; }
.sidebar-link:hover { background: var(--ad-sidebar-2); color: #fff; }
.sidebar-link.active {
    background: var(--ad-sidebar-2); color: #fff;
    border-left-color: var(--ad-saffron); font-weight: 500;
}
.sidebar-badge {
    background: var(--ad-saffron); color: #fff; font-size: .68rem; font-weight: 700;
    padding: .1rem .42rem; border-radius: 20px; min-width: 20px; text-align: center;
}

.sidebar-backdrop {
    position: fixed; inset: 0; background: rgba(0, 0, 0, .5);
    z-index: 1040; opacity: 0; visibility: hidden; transition: opacity .25s ease, visibility .25s ease;
}
.sidebar-backdrop.show { opacity: 1; visibility: visible; }

@media (max-width: 991.98px) {
    .admin-sidebar { transform: translateX(-100%); }
    .admin-sidebar.open { transform: translateX(0); }
    .admin-main { margin-left: 0; }
}

/* ----------------------------------------------------------------- topbar */

.admin-topbar {
    background: #fff; border-bottom: 1px solid var(--ad-line);
    padding: .7rem 1.25rem; display: flex; align-items: center; gap: .8rem;
    position: sticky; top: 0; z-index: 1030;
}
.topbar-title { font-size: 1.05rem; margin: 0; }
.avatar-initial {
    width: 26px; height: 26px; border-radius: 50%;
    background: var(--ad-green); color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: .78rem; font-weight: 600;
}

.admin-content { padding: 1.25rem; flex: 1 1 auto; }

.admin-footer {
    padding: 1rem 1.25rem; border-top: 1px solid var(--ad-line); background: #fff;
    display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem;
    font-size: .8rem; color: #8b968f;
}

/* ----------------------------------------------------------------- panels */

.card-panel {
    background: #fff; border: 1px solid var(--ad-line);
    border-radius: var(--ad-radius); padding: 1.25rem; box-shadow: var(--ad-shadow);
}
.panel-heading {
    font-size: .95rem; margin-bottom: 1rem; padding-bottom: .6rem;
    border-bottom: 1px solid var(--ad-line);
}

/* --------------------------------------------------------------- stat tiles */

.stat-tile {
    display: flex; flex-direction: column; gap: .1rem; height: 100%;
    padding: 1rem; border-radius: var(--ad-radius); color: #fff;
    box-shadow: var(--ad-shadow); transition: transform .18s ease, box-shadow .18s ease;
}
.stat-tile:hover { color: #fff; transform: translateY(-3px); box-shadow: var(--ad-shadow-lg); }
.stat-tile i { font-size: 1.4rem; opacity: .85; }
.stat-tile strong { font-size: 1.55rem; line-height: 1.2; }
.stat-tile span { font-size: .78rem; opacity: .92; }

.tile-green  { background: linear-gradient(135deg, #12946b, #0e7a4a); }
.tile-orange { background: linear-gradient(135deg, #ffa332, #e8790a); }
.tile-blue   { background: linear-gradient(135deg, #3d8bfd, #1c5fa8); }
.tile-purple { background: linear-gradient(135deg, #9a6ad8, #6f42c1); }
.tile-teal   { background: linear-gradient(135deg, #2bb3a3, #128377); }
.tile-red    { background: linear-gradient(135deg, #f0685f, #c0392b); }

.mini-stat {
    display: block; background: var(--ad-bg); border-radius: 8px;
    padding: .7rem .85rem; height: 100%; transition: background .15s ease;
}
.mini-stat:hover { background: #e6ece9; }
.mini-stat strong { display: block; font-size: 1.15rem; color: var(--ad-ink); }
.mini-stat span { font-size: .76rem; color: #8b968f; }

.amount-block { background: var(--ad-bg); border-radius: 8px; padding: .7rem .85rem; }
.amount-block strong { font-size: 1.2rem; }

.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-right: .35rem; }

/* ------------------------------------------------------------- mini chart */

.mini-chart { display: flex; align-items: flex-end; gap: .5rem; height: 150px; padding-top: .5rem; }
.mini-bar-wrap {
    flex: 1 1 0; display: flex; flex-direction: column; align-items: center;
    justify-content: flex-end; height: 100%; gap: .25rem;
}
.mini-bar {
    width: 100%; max-width: 34px; border-radius: 5px 5px 0 0;
    background: linear-gradient(180deg, #12946b, #0e7a4a); min-height: 4px;
}
.mini-bar-wrap small { font-size: .68rem; color: #8b968f; }
.mini-bar-wrap em { font-style: normal; font-size: .72rem; font-weight: 600; color: var(--ad-ink); }

/* ----------------------------------------------------------- activity list */

.activity-list li { display: flex; gap: .7rem; padding: .6rem 0; border-bottom: 1px solid var(--ad-line); font-size: .84rem; }
.activity-list li:last-child { border-bottom: 0; padding-bottom: 0; }
.activity-dot {
    width: 8px; height: 8px; border-radius: 50%; background: var(--ad-saffron);
    margin-top: .45rem; flex-shrink: 0;
}

/* ---------------------------------------------------------------- toolbar */

.toolbar {
    display: flex; flex-wrap: wrap; align-items: center; gap: .75rem;
    background: #fff; border: 1px solid var(--ad-line); border-radius: var(--ad-radius);
    padding: .8rem 1rem; margin-bottom: 1rem; box-shadow: var(--ad-shadow);
}
.toolbar-search { flex: 1 1 260px; max-width: 420px; margin: 0; }
.toolbar-filters { display: flex; flex-wrap: wrap; gap: .35rem; }
.toolbar-actions { margin-left: auto; display: flex; align-items: center; gap: .75rem; }

.filter-chip {
    display: inline-flex; align-items: center; gap: .35rem;
    font-size: .78rem; padding: .28rem .7rem; border-radius: 20px;
    background: var(--ad-bg); color: var(--ad-body); border: 1px solid transparent;
}
.filter-chip span {
    background: rgba(0, 0, 0, .08); border-radius: 20px; padding: 0 .4rem; font-size: .7rem; font-weight: 600;
}
.filter-chip:hover { background: #e6ece9; color: var(--ad-ink); }
.filter-chip.active { background: var(--ad-green); color: #fff; }
.filter-chip.active span { background: rgba(255, 255, 255, .25); }

/* ----------------------------------------------------------------- tables */

.table { font-size: .86rem; }
.table > thead th {
    background: var(--ad-bg); color: var(--ad-ink); font-weight: 600;
    font-size: .76rem; text-transform: uppercase; letter-spacing: .4px;
    border-bottom: 1px solid var(--ad-line); white-space: nowrap;
}
.table > tbody td { vertical-align: middle; }
.table-thumb {
    width: 58px; height: 44px; object-fit: cover; border-radius: 6px;
    background: var(--ad-bg); flex-shrink: 0;
}
.row-actions { display: flex; gap: .25rem; justify-content: flex-end; flex-wrap: nowrap; }
.row-actions .btn { padding: .2rem .45rem; line-height: 1.2; }

.status-pill {
    font-size: .72rem; font-weight: 600; padding: .2rem .55rem; border-radius: 20px;
}
.status-on  { background: #d6f2e4; color: #0a5d38; }
.status-off { background: #eceff0; color: #6b7772; }

/* ------------------------------------------------------------------ forms */

.form-label { font-weight: 500; font-size: .84rem; color: var(--ad-ink); margin-bottom: .3rem; }
.form-control, .form-select {
    border: 1px solid var(--ad-line); border-radius: 8px; font-size: .87rem; padding: .5rem .75rem;
}
.form-control:focus, .form-select:focus {
    border-color: var(--ad-green); box-shadow: 0 0 0 .2rem rgba(14, 122, 74, .12);
}
.form-text { font-size: .76rem; }
.form-check-input:checked { background-color: var(--ad-green); border-color: var(--ad-green); }

.btn-primary {
    background: var(--ad-green); border-color: var(--ad-green); font-weight: 500;
}
.btn-primary:hover, .btn-primary:focus, .btn-primary:active {
    background: var(--ad-green-dk) !important; border-color: var(--ad-green-dk) !important;
}
.btn-outline-primary { color: var(--ad-green); border-color: var(--ad-green); }
.btn-outline-primary:hover { background: var(--ad-green); border-color: var(--ad-green); }

.current-file {
    display: flex; align-items: center; gap: .8rem;
    background: var(--ad-bg); border-radius: 8px; padding: .6rem .8rem;
}
.current-file img {
    width: 84px; height: 62px; object-fit: cover; border-radius: 6px; background: #fff;
}
.upload-preview {
    margin-top: .6rem; max-width: 220px; border-radius: 8px; border: 1px solid var(--ad-line);
}
.file-chip {
    display: inline-flex; align-items: center; gap: .45rem;
    background: var(--ad-bg); border-radius: 8px; padding: .4rem .7rem; font-size: .82rem;
}

.form-section {
    border-top: 1px solid var(--ad-line); margin-top: 1.5rem; padding-top: 1.25rem;
}
.form-section:first-of-type { border-top: 0; margin-top: 0; padding-top: 0; }
.form-section-title {
    font-size: .82rem; text-transform: uppercase; letter-spacing: .5px;
    color: var(--ad-green); font-weight: 600; margin-bottom: 1rem;
}

.form-actions {
    display: flex; flex-wrap: wrap; gap: .5rem; align-items: center;
    border-top: 1px solid var(--ad-line); margin-top: 1.5rem; padding-top: 1.25rem;
}

/* --------------------------------------------------------------- gallery */

.photo-tile {
    position: relative; border-radius: 8px; overflow: hidden;
    aspect-ratio: 4 / 3; background: var(--ad-bg); box-shadow: var(--ad-shadow);
}
.photo-tile img { width: 100%; height: 100%; object-fit: cover; }
.photo-tile .photo-remove {
    position: absolute; top: .35rem; right: .35rem;
    width: 26px; height: 26px; border: 0; border-radius: 50%;
    background: rgba(220, 53, 69, .92); color: #fff; font-size: .75rem; line-height: 1;
    opacity: 0; transition: opacity .18s ease;
}
.photo-tile:hover .photo-remove, .photo-tile:focus-within .photo-remove { opacity: 1; }

/* ------------------------------------------------------------- detail view */

.detail-list { margin: 0; }
.detail-list dt {
    font-size: .74rem; text-transform: uppercase; letter-spacing: .4px;
    color: #8b968f; font-weight: 600; margin-top: .9rem;
}
.detail-list dt:first-child { margin-top: 0; }
.detail-list dd { margin: .1rem 0 0; color: var(--ad-ink); font-size: .88rem; }

.empty-block { text-align: center; padding: 3rem 1rem; color: #8b968f; }
.empty-block i { font-size: 2.5rem; color: var(--ad-line); display: block; margin-bottom: .75rem; }

/* ------------------------------------------------------------- pagination */

/* Shared with the public site: paginate_links() emits .pager markup. */
.pager { display: flex; align-items: center; gap: .25rem; flex-wrap: wrap; }
.pager a, .pager span {
    min-width: 36px; height: 36px; padding-inline: .6rem;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--ad-line); border-radius: 7px;
    font-size: .84rem; font-weight: 600; color: var(--ad-ink); background: #fff;
    transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.pager a:hover { background: var(--ad-bg); border-color: var(--ad-green); color: var(--ad-green); }
.pager .is-current { background: var(--ad-green); border-color: var(--ad-green); color: #fff; }
.pager .is-disabled { opacity: .45; pointer-events: none; }

/* -------------------------------------------------------------- utilities */

.tox-tinymce { border-radius: 8px !important; border-color: var(--ad-line) !important; }
.text-break-all { word-break: break-all; }

@media (max-width: 575.98px) {
    .admin-content { padding: .85rem; }
    .toolbar { padding: .7rem; }
    .toolbar-actions { margin-left: 0; width: 100%; justify-content: space-between; }
    .toolbar-search { max-width: none; }
}
