/* ==========================================================================
   Admin panel
   Shares the public site's palette. The sidebar brand block uses the same blue
   as the site header so the logo's black horse stays readable — on the flat
   dark grey it disappeared.
   ========================================================================== */

:root {
    /* surfaces, darkest to lightest */
    --a-bg:      #0b0b10;
    --a-panel:   #14141b;
    --a-raised:  #1b1b24;
    --a-hover:   #22222d;
    --a-line:    #2a2a36;
    --a-line-soft: #1f1f29;

    /* brand */
    --a-chrome:  #271D63;   /* matches the public site header/footer */
    --a-chrome-2:#1C1547;
    --a-pink:    #F14BAD;
    --a-pink-d:  #D91CA3;
    --a-pink-l:  #FF74C3;

    /* text */
    --a-white:   #f4f4f7;
    --a-text:    #c2c2cc;
    --a-dim:     #8b8b98;

    /* status */
    --a-green:   #35C46A;
    --a-red:     #F0533C;
    --a-amber:   #F7BA45;

    --sidebar: 244px;
    --radius: 8px;
    --radius-sm: 6px;
    --shadow: 0 2px 4px rgba(0,0,0,.28), 0 8px 24px rgba(0,0,0,.32);
    --ring: 0 0 0 3px rgba(241,75,173,.24);

    --font: "Inter", "Segoe UI", -apple-system, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

body.admin {
    margin: 0;
    background: var(--a-bg);
    color: var(--a-text);
    font-family: var(--font);
    font-size: 14.5px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

.admin a { color: var(--a-pink); text-decoration: none; transition: color .15s; }
.admin a:hover { color: var(--a-pink-l); }
.admin img { max-width: 100%; display: block; }

.admin h1 { font-size: 1.4rem; margin: 0; color: var(--a-white); font-weight: 650; letter-spacing: -.01em; }
.admin h2 { font-size: 1.05rem; color: var(--a-white); margin: 0 0 .9em; font-weight: 650; letter-spacing: -.01em; }
.admin h3 { font-size: .95rem;  color: var(--a-white); margin: 0 0 .8em; font-weight: 650; }
.admin h4 { font-size: .85rem;  color: var(--a-white); margin: 0 0 .6em; font-weight: 650; }

/* scrollbars kept in-theme rather than default light grey */
.admin ::-webkit-scrollbar { width: 10px; height: 10px; }
.admin ::-webkit-scrollbar-track { background: transparent; }
.admin ::-webkit-scrollbar-thumb { background: #30303d; border-radius: 6px; border: 2px solid var(--a-bg); }
.admin ::-webkit-scrollbar-thumb:hover { background: #3d3d4d; }

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

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

.admin-side {
    width: var(--sidebar);
    flex-shrink: 0;
    background: var(--a-panel);
    border-right: 1px solid var(--a-line);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    scrollbar-width: thin;
}

/* Blue block so the logo's black horse has something to read against. */
.admin-side__brand {
    background: var(--a-chrome);
    padding: 20px 20px 18px;
    border-bottom: 1px solid rgba(255,255,255,.12);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 92px;
    position: sticky;
    top: 0;
    z-index: 5;
}
.admin-side__brand img { height: 52px; width: auto; }

.admin-nav { padding: 10px 0 22px; flex: 1; }
.admin-nav__label {
    padding: 18px 20px 7px;
    font-size: .66rem;
    font-weight: 700;
    letter-spacing: .15em;
    text-transform: uppercase;
    color: #6a6a78;
}
.admin-nav a {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin: 1px 10px;
    padding: 9px 14px;
    color: var(--a-text);
    font-size: .9rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: background .15s, color .15s;
}
.admin-nav a:hover { background: var(--a-hover); color: var(--a-white); }
.admin-nav a.is-active {
    background: linear-gradient(90deg, rgba(217,28,163,.22), rgba(217,28,163,.06));
    color: var(--a-white);
    font-weight: 600;
}
/* accent bar on the active item */
.admin-nav a.is-active::before {
    content: "";
    position: absolute;
    left: -10px;
    top: 6px;
    bottom: 6px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--a-pink);
}
.admin-nav .pill {
    background: var(--a-pink-d);
    color: #fff;
    border-radius: 999px;
    padding: 1px 8px;
    font-size: .68rem;
    font-weight: 700;
    line-height: 1.6;
}

.admin-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.admin-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 28px;
    min-height: 68px;
    background: rgba(20,20,27,.92);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--a-line);
    position: sticky;
    top: 0;
    z-index: 20;
}
.admin-top__right { display: flex; align-items: center; gap: 16px; font-size: .87rem; }
.admin-top__right > .hint { color: var(--a-dim); }

.admin-body { padding: 26px 28px 48px; flex: 1; }

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

.panel {
    background: var(--a-panel);
    border: 1px solid var(--a-line);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 22px;
    box-shadow: var(--shadow);
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 26px;
}
.stat {
    position: relative;
    background: var(--a-panel);
    border: 1px solid var(--a-line);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: border-color .18s, transform .18s;
}
.stat::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 3px;
    background: var(--a-pink);
}
a.stat { text-decoration: none; display: block; }
a.stat:hover { border-color: rgba(241,75,173,.5); transform: translateY(-2px); }
.stat__n {
    font-size: 1.85rem;
    font-weight: 700;
    color: var(--a-white);
    line-height: 1.15;
    letter-spacing: -.02em;
}
.stat__l {
    font-size: .72rem;
    letter-spacing: .13em;
    text-transform: uppercase;
    color: var(--a-dim);
    margin-top: 6px;
    font-weight: 600;
}

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

.a-table { width: 100%; border-collapse: separate; border-spacing: 0; }
.a-table th {
    padding: 13px 16px;
    text-align: left;
    font-size: .68rem;
    letter-spacing: .13em;
    text-transform: uppercase;
    color: var(--a-dim);
    font-weight: 700;
    white-space: nowrap;
    background: var(--a-raised);
    border-bottom: 1px solid var(--a-line);
}
.a-table th:first-child { border-top-left-radius: var(--radius); }
.a-table th:last-child  { border-top-right-radius: var(--radius); }
.a-table td {
    padding: 13px 16px;
    text-align: left;
    font-size: .89rem;
    border-bottom: 1px solid var(--a-line-soft);
    vertical-align: middle;
}
.a-table tbody tr { transition: background .13s; }
.a-table tbody tr:hover { background: var(--a-raised); }
.a-table tbody tr:last-child td { border-bottom: 0; }
.a-table img.thumb {
    width: 44px; height: 44px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 1px solid var(--a-line);
}
.a-table td.right, .a-table th.right { text-align: right; }
.a-table .actions { display: flex; gap: 8px; justify-content: flex-end; align-items: center; }
.a-table .actions form { margin: 0; }
.a-table strong { color: var(--a-white); font-weight: 600; }

/* a panel that holds only a table needs no padding of its own */
.panel--table { padding: 0; overflow: hidden; }

/* ----------------------------------------------------------------- badges */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: .69rem;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    white-space: nowrap;
    border: 1px solid transparent;
}
.badge::before {
    content: "";
    width: 6px; height: 6px;
    border-radius: 50%;
    background: currentColor;
}
.badge--on   { background: rgba(53,196,106,.13); color: #5fd98d; border-color: rgba(53,196,106,.3); }
.badge--off  { background: rgba(139,139,152,.13); color: var(--a-dim); border-color: rgba(139,139,152,.28); }
.badge--warn { background: rgba(247,186,69,.13); color: var(--a-amber); border-color: rgba(247,186,69,.3); }
.badge--info { background: rgba(241,75,173,.13); color: var(--a-pink-l); border-color: rgba(241,75,173,.32); }

/* ---------------------------------------------------------------- buttons */

.a-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    height: 40px;
    padding: 0 20px;
    background: var(--a-pink-d);
    color: #fff;
    border: 1px solid var(--a-pink-d);
    font-size: .85rem;
    font-weight: 600;
    font-family: inherit;
    line-height: 1;
    border-radius: var(--radius-sm);
    cursor: pointer;
    white-space: nowrap;
    text-decoration: none;
    box-shadow: 0 1px 2px rgba(0,0,0,.3);
    transition: background .15s, border-color .15s, transform .12s, box-shadow .15s;
}
.a-btn:hover {
    background: var(--a-pink);
    border-color: var(--a-pink);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(217,28,163,.32);
}
.a-btn:active { transform: translateY(0); box-shadow: 0 1px 2px rgba(0,0,0,.3); }
.a-btn:focus-visible { outline: 0; box-shadow: var(--ring); }

.a-btn--ghost {
    background: var(--a-raised);
    border-color: var(--a-line);
    color: var(--a-text);
    box-shadow: none;
}
.a-btn--ghost:hover {
    background: var(--a-hover);
    border-color: #3d3d4d;
    color: var(--a-white);
    box-shadow: none;
}

.a-btn--danger {
    background: transparent;
    border-color: rgba(240,83,60,.38);
    color: #f2836f;
    box-shadow: none;
}
.a-btn--danger:hover {
    background: rgba(240,83,60,.14);
    border-color: var(--a-red);
    color: #ff9b86;
    box-shadow: none;
}

.a-btn--sm { height: 32px; padding: 0 13px; font-size: .78rem; }
.a-btn--block { width: 100%; }

/*
 * Buttons rendered as <a> need these: the generic `.admin a` link colour has
 * higher specificity than `.a-btn`, which otherwise paints the label pink on a
 * pink button and makes it look washed out.
 */
.admin a.a-btn,
.admin a.a-btn:hover { color: #fff; }
.admin a.a-btn--ghost { color: var(--a-text); }
.admin a.a-btn--ghost:hover { color: var(--a-white); }
.admin a.a-btn--danger { color: #f2836f; }
.admin a.a-btn--danger:hover { color: #ff9b86; }

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

.a-form { max-width: 960px; }
.a-row { margin-bottom: 20px; }
.a-row:last-of-type { margin-bottom: 0; }
.a-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.a-grid--3 { grid-template-columns: repeat(3, 1fr); }

.admin label {
    display: block;
    margin-bottom: 7px;
    font-size: .74rem;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--a-white);
    font-weight: 700;
}

.admin input[type=text], .admin input[type=email], .admin input[type=tel],
.admin input[type=number], .admin input[type=password], .admin input[type=url],
.admin input[type=date], .admin input[type=time], .admin input[type=datetime-local],
.admin select, .admin textarea {
    width: 100%;
    background: var(--a-bg);
    border: 1px solid var(--a-line);
    color: var(--a-white);
    padding: 10px 13px;
    font-size: .9rem;
    font-family: inherit;
    border-radius: var(--radius-sm);
    transition: border-color .15s, box-shadow .15s;
}
.admin input::placeholder, .admin textarea::placeholder { color: #63636f; }
.admin input:hover, .admin select:hover, .admin textarea:hover { border-color: #3a3a48; }
.admin input:focus, .admin select:focus, .admin textarea:focus {
    outline: 0;
    border-color: var(--a-pink);
    box-shadow: var(--ring);
}
.admin textarea { min-height: 150px; resize: vertical; line-height: 1.6; }
.admin textarea.tall {
    min-height: 340px;
    font-family: "Cascadia Code", Consolas, "Courier New", monospace;
    font-size: .84rem;
    line-height: 1.65;
}
.admin select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath fill='%238b8b98' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 13px center;
    background-size: 11px;
    padding-right: 36px;
}
.admin input[type=file] {
    width: 100%;
    color: var(--a-text);
    font-size: .86rem;
    background: var(--a-bg);
    border: 1px dashed var(--a-line);
    border-radius: var(--radius-sm);
    padding: 10px 13px;
}
.admin input[type=file]::file-selector-button {
    background: var(--a-raised);
    border: 1px solid var(--a-line);
    color: var(--a-text);
    border-radius: 5px;
    padding: 6px 13px;
    margin-right: 12px;
    font-family: inherit;
    font-size: .8rem;
    font-weight: 600;
    cursor: pointer;
}
.admin input[type=file]::file-selector-button:hover { background: var(--a-hover); color: var(--a-white); }

.hint { font-size: .78rem; color: var(--a-dim); margin: 6px 0 0; line-height: 1.5; }

.a-check { display: flex; align-items: center; gap: 10px; }
.a-check input[type=checkbox] {
    width: 17px; height: 17px;
    accent-color: var(--a-pink-d);
    cursor: pointer;
    flex-shrink: 0;
}
.a-check label {
    margin: 0;
    text-transform: none;
    letter-spacing: 0;
    font-size: .89rem;
    font-weight: 500;
    color: var(--a-text);
    cursor: pointer;
}

.img-field { display: flex; gap: 18px; align-items: flex-start; }
.img-field__preview {
    width: 124px; height: 124px;
    flex-shrink: 0;
    border: 1px solid var(--a-line);
    border-radius: var(--radius-sm);
    object-fit: cover;
    background: var(--a-bg);
}
.img-field__controls { flex: 1; min-width: 0; }

.form-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    padding-top: 22px;
    margin-top: 24px;
    border-top: 1px solid var(--a-line);
}

/* ----------------------------------------------------------------- alerts */

.a-alert {
    padding: 13px 17px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    border: 1px solid;
    border-left-width: 3px;
    font-size: .89rem;
    font-weight: 500;
}
.a-alert--success { background: rgba(53,196,106,.09); border-color: var(--a-green); color: #7ee0a4; }
.a-alert--error   { background: rgba(240,83,60,.09);  border-color: var(--a-red);   color: #ff9b86; }

/* ------------------------------------------------------------- list header */

.list-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}
.list-search { display: flex; gap: 9px; align-items: center; }
.list-search input, .list-search select { height: 40px; }
.list-search input { min-width: 250px; }
.list-search select { width: auto; min-width: 160px; }

.a-pagination { display: flex; gap: 6px; justify-content: center; margin-top: 26px; flex-wrap: wrap; }
.a-pagination a, .a-pagination span {
    min-width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 12px;
    border: 1px solid var(--a-line);
    background: var(--a-panel);
    border-radius: var(--radius-sm);
    font-size: .85rem;
    font-weight: 600;
    color: var(--a-text);
    transition: border-color .15s, background .15s, color .15s;
}
.a-pagination a:hover { border-color: var(--a-pink); color: var(--a-white); background: var(--a-hover); }
.a-pagination .is-current {
    background: var(--a-pink-d);
    border-color: var(--a-pink-d);
    color: #fff;
}

.empty-state {
    text-align: center;
    padding: 62px 24px;
    color: var(--a-dim);
    font-size: .92rem;
}

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

.login-wrap {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(900px 460px at 50% -12%, rgba(39,29,99,.85), transparent 70%),
        var(--a-bg);
}
.login-card {
    width: 100%;
    max-width: 396px;
    background: var(--a-panel);
    border: 1px solid var(--a-line);
    border-radius: 12px;
    padding: 0 0 32px;
    text-align: center;
    box-shadow: 0 24px 60px rgba(0,0,0,.55);
    overflow: hidden;
}
.login-card__head {
    background: var(--a-chrome);
    padding: 26px 24px;
    border-bottom: 1px solid rgba(255,255,255,.12);
}
.login-card__head img { height: 56px; width: auto; margin: 0 auto; }
.login-card h2 { margin: 26px 0 22px; }
.login-card form { text-align: left; padding: 0 32px; }
.login-card .a-btn { width: 100%; height: 44px; margin-top: 6px; }
.login-card .hint { text-align: center; margin-top: 20px; }
.login-card .a-alert { margin: 0 32px 18px; text-align: left; }

/* ------------------------------------------------------------- responsive */

@media (max-width: 1000px) {
    .a-grid, .a-grid--3 { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
    .admin-side {
        position: fixed;
        left: -100%;
        z-index: 100;
        transition: left .25s;
        box-shadow: var(--shadow);
    }
    .admin-side.is-open { left: 0; }
    .admin-body { padding: 18px 16px 40px; }
    .admin-top { padding: 0 16px; }
    .table-scroll { overflow-x: auto; }
    .list-head { flex-direction: column; align-items: stretch; }
    .list-search { flex-wrap: wrap; }
    .list-search input { min-width: 0; flex: 1; }
    .img-field { flex-direction: column; }
}
