/* =====================================================================
   Admin Panel
   Separate from the public site's CSS files entirely (CLAUDE.md §7/§9)
   — only the design tokens are shared, via @import, for visual
   consistency rather than a new palette. Simple/professional/
   responsive; no scroll animation, no GSAP/Lenis/Swiper here.
   ===================================================================== */

@import url('variables.css');

* {
    box-sizing: border-box;
}

body.admin-body {
    margin: 0;
    font-family: var(--font-body);
    font-size: var(--fs-body);
    color: var(--color-text-dark);
    background-color: var(--color-bg-light);
    line-height: var(--lh-body);
}

a {
    color: inherit;
    text-decoration: none;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ---- Header / nav -------------------------------------------------------- */

.admin-header {
    background-color: var(--color-primary);
    color: var(--color-white);
    position: sticky;
    top: 0;
    z-index: 50;
}

.admin-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-lg);
    max-width: 1200px;
    margin-inline: auto;
    padding: var(--space-md) var(--space-xl);
}

.admin-header__logo {
    font-family: var(--font-heading);
    font-weight: var(--fw-bold);
    font-size: 1.1rem;
    color: var(--color-white);
    flex-shrink: 0;
}

.admin-header__logo span {
    color: var(--color-accent);
    font-weight: var(--fw-semibold);
}

.admin-header__nav-toggle-input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.admin-nav {
    display: flex;
    gap: var(--space-xl);
}

.admin-nav__link {
    color: rgba(255, 255, 255, 0.7);
    font-weight: var(--fw-medium);
    font-size: var(--fs-small);
    transition: color 0.2s ease;
}

.admin-nav__link:hover,
.admin-nav__link.is-active {
    color: var(--color-white);
}

.admin-header__logout {
    margin: 0;
    flex-shrink: 0;
}

.admin-header__menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 2.25rem;
    height: 2.25rem;
    cursor: pointer;
}

.admin-header__menu-icon,
.admin-header__menu-icon::before,
.admin-header__menu-icon::after {
    display: block;
    width: 20px;
    height: 2px;
    background-color: var(--color-white);
    border-radius: 2px;
}

.admin-header__menu-icon {
    position: relative;
}

.admin-header__menu-icon::before,
.admin-header__menu-icon::after {
    content: '';
    position: absolute;
    left: 0;
}

.admin-header__menu-icon::before {
    top: -6px;
}

.admin-header__menu-icon::after {
    top: 6px;
}

@media (max-width: 720px) {
    .admin-header__inner {
        flex-wrap: wrap;
    }

    .admin-nav {
        order: 5;
        flex-basis: 100%;
        flex-direction: column;
        gap: var(--space-md);
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.25s ease;
    }

    .admin-header__nav-toggle-input:checked ~ .admin-nav {
        max-height: 200px;
        padding-top: var(--space-md);
    }

    .admin-header__menu-toggle {
        display: flex;
    }
}

/* ---- Layout --------------------------------------------------------------- */

.admin-main {
    max-width: 1200px;
    margin-inline: auto;
    padding: var(--space-2xl) var(--space-xl) var(--space-4xl);
}

.admin-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
}

.admin-page-header h1 {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    color: var(--color-primary);
    margin: 0;
}

/* ---- Stat cards ------------------------------------------------------------ */

.admin-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-lg);
    margin-bottom: var(--space-2xl);
}

.admin-stat-card {
    background-color: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
}

.admin-stat-card__value {
    display: block;
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: var(--fw-bold);
    color: var(--color-primary);
}

.admin-stat-card__label {
    color: var(--color-text-grey);
    font-size: var(--fs-small);
}

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

.admin-panel {
    background-color: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-xl);
    margin-bottom: var(--space-xl);
}

.admin-panel h2 {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    color: var(--color-primary);
    margin-top: 0;
    margin-bottom: var(--space-lg);
}

.admin-panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
}

.admin-panel__header h2 {
    margin-bottom: 0;
}

.admin-panel__view-all {
    font-size: var(--fs-small);
    font-weight: var(--fw-semibold);
    color: var(--color-accent);
    margin-bottom: var(--space-lg);
}

/* ---- Filter bar (enquiries month filter) -----------------------------------
   Was previously unstyled — the <select> fell through to plain browser
   defaults because it sat inside .admin-filter-bar rather than
   .admin-form, so none of the shared `.admin-form input/select/textarea`
   rules (further down this file) ever matched it. Rebuilt here with the
   same tokens as that rule (padding/border/radius/focus-ring) rather
   than folding it into `.admin-form` itself, since that class also
   carries a 640px max-width meant for vertical add/edit-style forms —
   not what a horizontal filter bar wants. */

.admin-filter-bar {
    display: flex;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.admin-form-group--inline {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    margin-bottom: 0;
}

.admin-form-group--inline label {
    font-size: var(--fs-small);
    font-weight: var(--fw-medium);
}

.admin-filter-bar select {
    /* Extra right padding clears the custom arrow below. */
    padding: 0.65rem 2.25rem 0.65rem 0.85rem;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: var(--fs-body);
    color: var(--color-text-dark);
    background-color: var(--color-white);
    cursor: pointer;
    transition: border-color var(--duration-fast) var(--ease-base),
                box-shadow var(--duration-fast) var(--ease-base);

    /* Custom chevron in place of each browser's native control —
       plain CSS, no JS needed. Color is --color-text-grey's hex value
       hardcoded, since data-URI SVGs can't reliably reference CSS
       custom properties. */
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
}

.admin-filter-bar select::-ms-expand {
    display: none;
}

.admin-filter-bar select:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 4px rgba(0, 141, 255, 0.12);
}

@media (max-width: 640px) {
    .admin-filter-bar {
        align-items: stretch;
    }

    .admin-form-group--inline {
        flex: 1 1 100%;
    }

    .admin-filter-bar select {
        width: 100%;
    }
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table th,
.admin-table td {
    text-align: left;
    padding: var(--space-sm) var(--space-md);
    border-bottom: 1px solid var(--color-border);
    font-size: var(--fs-small);
    vertical-align: middle;
}

.admin-table th {
    color: var(--color-text-grey);
    font-weight: var(--fw-semibold);
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.05em;
}

.admin-table__actions a {
    margin-right: var(--space-md);
    font-weight: var(--fw-semibold);
    color: var(--color-accent);
}

.admin-link-danger {
    color: #DC2626 !important;
}

.admin-empty-state {
    color: var(--color-text-grey);
    padding: var(--space-md) 0;
}

@media (max-width: 640px) {
    .admin-table thead {
        display: none;
    }

    .admin-table,
    .admin-table tbody,
    .admin-table tr,
    .admin-table td {
        display: block;
        width: 100%;
    }

    .admin-table tr {
        border-bottom: 1px solid var(--color-border);
        padding: var(--space-md) 0;
    }

    .admin-table td {
        border-bottom: none;
        padding: 0.2rem 0;
    }
}

/* ---- Badges ----------------------------------------------------------------- */

.admin-badge {
    display: inline-block;
    padding: 0.2rem 0.65rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: var(--fw-semibold);
    text-transform: capitalize;
}

.admin-badge--active {
    background-color: #DCFCE7;
    color: #166534;
}

.admin-badge--inactive {
    background-color: #FEE2E2;
    color: #991B1B;
}

.admin-badge--new {
    background-color: #DBEAFE;
    color: #1E40AF;
}

/* ---- Enquiry status (contact_enquiries.status) — 'new' above already
   covered the dashboard preview; 'read'/'responded'/'archived' are new
   here for the full enquiries list, same pill treatment. */

.admin-badge--read {
    background-color: #F1F5F9;
    color: #475569;
}

.admin-badge--responded {
    background-color: #DCFCE7;
    color: #166534;
}

.admin-badge--archived {
    background-color: #E5E7EB;
    color: #4B5563;
}

/* ---- Enquiry source (contact_enquiries.source) — deliberately a
   different palette than the status badges above so the two badge
   columns in the enquiries list read as distinct kinds of information,
   not more status values. */

.admin-badge--source-contact {
    background-color: #EDE9FE;
    color: #5B21B6;
}

.admin-badge--source-enquiry {
    background-color: #E0F2FE;
    color: #075985;
}

/* ---- Alerts ------------------------------------------------------------------ */

.admin-alert {
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-sm);
    margin-bottom: var(--space-lg);
    font-size: var(--fs-small);
}

.admin-alert--success {
    background-color: #DCFCE7;
    color: #166534;
}

.admin-alert--error {
    background-color: #FEE2E2;
    color: #991B1B;
}

.admin-alert ul {
    margin: 0;
    padding-left: 1.1rem;
}

/* ---- Forms -------------------------------------------------------------------- */

.admin-form {
    max-width: 640px;
}

.admin-form-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    margin-bottom: var(--space-lg);
}

.admin-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-lg);
}

@media (max-width: 640px) {
    .admin-form-row {
        grid-template-columns: 1fr;
    }
}

.admin-form label {
    font-size: var(--fs-small);
    font-weight: var(--fw-medium);
}

.admin-form input,
.admin-form select,
.admin-form textarea {
    padding: 0.65rem 0.85rem;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: var(--fs-body);
    color: var(--color-text-dark);
    background-color: var(--color-white);
    transition: border-color var(--duration-fast) var(--ease-base),
                box-shadow var(--duration-fast) var(--ease-base);
}

.admin-form input:focus,
.admin-form select:focus,
.admin-form textarea:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 4px rgba(0, 141, 255, 0.12);
}

.admin-form textarea {
    resize: vertical;
    min-height: 120px;
}

.admin-form-hint {
    font-size: 0.75rem;
    color: var(--color-text-grey);
    margin: 0;
}

.admin-form-current-image img,
#admin-image-preview {
    display: block;
    max-width: 200px;
    max-height: 140px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    margin-bottom: var(--space-sm);
}

.admin-form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-md);
}

/* ---- Buttons -------------------------------------------------------------------- */

.admin-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.65rem 1.25rem;
    border-radius: var(--radius-sm);
    font-weight: var(--fw-semibold);
    font-size: var(--fs-small);
    border: 1.5px solid transparent;
    cursor: pointer;
    transition: background-color var(--duration-fast) var(--ease-base),
                border-color var(--duration-fast) var(--ease-base),
                color var(--duration-fast) var(--ease-base),
                box-shadow var(--duration-fast) var(--ease-base);
}

.admin-btn:active {
    transform: translateY(1px);
}

.admin-btn--primary {
    background-color: var(--color-accent);
    color: var(--color-white);
}

.admin-btn--primary:hover {
    background-color: #0077d6;
}

.admin-btn--secondary {
    background-color: var(--color-white);
    border-color: var(--color-border);
    color: var(--color-text-dark);
}

.admin-btn--secondary:hover {
    background-color: var(--color-bg-light);
    border-color: var(--color-text-grey);
}

.admin-btn--danger {
    background-color: #DC2626;
    color: var(--color-white);
}

.admin-btn--danger:hover {
    background-color: #B91C1C;
}

.admin-btn--ghost {
    background-color: transparent;
    border-color: rgba(255, 255, 255, 0.3);
    color: var(--color-white);
}

.admin-btn--ghost:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.5);
}

/* ---- Login ----------------------------------------------------------------------
   Refined centered card rather than a split panel — this is an internal
   admin tool (CLAUDE.md §7: "simple, professional, responsive"), not the
   public marketing site, so the polish is in restrained depth/hierarchy
   rather than a bigger layout or added motion. */

.admin-login {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-xl);
    background-color: var(--color-bg-light);
    /* Soft brand-tinted glow + a faint dot grid for texture, in place of
       the flat gray void — both well within the "very subtle gradients
       only" rule (CLAUDE.md §3). */
    background-image:
        radial-gradient(60% 45% at 50% 0%, rgba(0, 141, 255, 0.07), transparent 70%),
        radial-gradient(rgba(11, 35, 68, 0.05) 1px, transparent 1px);
    background-size: auto, 24px 24px;
}

.admin-login__card {
    position: relative;
    overflow: hidden;
    background-color: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-2xl) var(--space-2xl) var(--space-xl);
    max-width: 400px;
    width: 100%;
    box-shadow: 0 1px 2px rgba(11, 35, 68, 0.04), 0 24px 48px rgba(11, 35, 68, 0.12);
}

/* Thin brand-gradient strip along the top edge — overflow:hidden above
   keeps its square corners from poking past the card's rounded ones. */
.admin-login__card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    background: linear-gradient(90deg, var(--color-accent), var(--color-primary));
}

.admin-login__brand {
    text-align: center;
    margin-bottom: var(--space-xl);
}

.admin-login__logo-img {
    display: block;
    /* Full logo (1554x488, includes the tagline line) — up from 40px
       for the previous cropped mark, since the taller true aspect
       ratio needs more height before "VOXA / TECH SOLUTIONS" reads
       clearly. At 64px tall the rendered width (~204px) fits the
       400px card's padded content area on most phones; max-width
       lets it scale down further on the narrowest ones (~360px and
       below) instead of overflowing the card. */
    height: 64px;
    width: auto;
    max-width: 100%;
    margin: 0 auto var(--space-md);
}

.admin-login__subtitle {
    display: inline-block;
    margin: 0;
    color: var(--color-accent);
    font-size: var(--fs-small);
    font-weight: var(--fw-semibold);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.admin-login .admin-btn {
    width: 100%;
    margin-top: var(--space-sm);
    padding-block: 0.85rem;
    font-size: var(--fs-body);
}

.admin-login .admin-btn--primary {
    box-shadow: 0 12px 24px rgba(0, 141, 255, 0.22);
}

.admin-login .admin-btn--primary:hover {
    box-shadow: 0 16px 32px rgba(0, 141, 255, 0.28);
}

@media (max-width: 480px) {
    .admin-login {
        padding: var(--space-lg) var(--space-md);
        background-size: auto, 18px 18px;
    }

    .admin-login__card {
        padding: var(--space-xl) var(--space-lg) var(--space-lg);
    }
}

/* ---- Gallery manager (admin/services/gallery.php) ----------------------------------
   Same restrained-polish treatment as .admin-login (§7: internal admin
   tool, not the public site — no scroll animation, just genuinely
   well-designed instead of default-browser-styled). */

/* Upload dropzone. No actual drag-and-drop JS wiring (would need
   listeners this codebase deliberately avoids for admin forms — see
   admin.js's header comment on why destructive/enhanced behavior here
   stays server-rendered) — the native <input type="file"> underneath
   already accepts OS-level drag-drop on itself with zero JS, so this
   is a real dropzone, just not one with a custom drag-over state. */
.admin-upload-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-2xl) var(--space-lg);
    border: 1.5px dashed var(--color-border);
    border-radius: var(--radius-md);
    background-color: var(--color-bg-light);
    text-align: center;
    transition: border-color var(--duration-fast) var(--ease-base);
}

.admin-upload-zone:has(input:focus-visible) {
    border-color: var(--color-accent);
}

.admin-upload-zone__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 50%;
    background-color: var(--color-white);
    border: 1px solid var(--color-border);
    color: var(--color-accent);
}

.admin-upload-zone__icon svg {
    width: 1.375rem;
    height: 1.375rem;
}

.admin-upload-zone__text {
    color: var(--color-text-dark);
    font-weight: var(--fw-semibold);
    font-size: var(--fs-body);
}

.admin-upload-zone input[type="file"] {
    font-size: var(--fs-small);
    color: var(--color-text-grey);
    border: none;
    background: none;
    padding: 0;
}

.admin-upload-zone input[type="file"]::file-selector-button {
    margin-right: var(--space-sm);
    padding: 0.55rem 1.1rem;
    border-radius: var(--radius-sm);
    border: none;
    background-color: var(--color-accent);
    color: var(--color-white);
    font-family: var(--font-body);
    font-weight: var(--fw-semibold);
    font-size: var(--fs-small);
    cursor: pointer;
    transition: background-color var(--duration-fast) var(--ease-base);
}

.admin-upload-zone input[type="file"]::file-selector-button:hover {
    background-color: #0077d6;
}

.admin-upload-zone .admin-form-hint {
    max-width: 420px;
}

/* Fixed card width (not 1fr) so a single image doesn't stretch across
   the whole row — the exact "floating with tons of empty space" issue
   being fixed. auto-fill also means this needs no manual breakpoints:
   it degrades to one column on its own once nothing else fits. */
.admin-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 280px));
    justify-content: start;
    gap: var(--space-lg);
}

.admin-gallery-item {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    background-color: var(--color-white);
    transition: box-shadow var(--duration-base) var(--ease-base),
                border-color var(--duration-base) var(--ease-base);
}

.admin-gallery-item:hover {
    box-shadow: 0 12px 24px rgba(11, 35, 68, 0.1);
    border-color: transparent;
}

.admin-gallery-item__image {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
}

.admin-gallery-item__form {
    padding: var(--space-md);
}

.admin-gallery-item__form .admin-form-group {
    margin-bottom: var(--space-sm);
}

.admin-gallery-item__actions {
    display: flex;
    gap: var(--space-sm);
    margin-top: var(--space-xs);
}

.admin-gallery-item__actions .admin-btn {
    flex: 1;
}

/* Lighter/outlined by default so a full-weight solid-red button isn't
   competing equally with Save on every card — still unmistakably
   "danger" (red border/text), just not shouting as loud until you
   actually mean to act on it. */
.admin-gallery-item__actions .admin-btn--danger {
    background-color: transparent;
    border-color: #FCA5A5;
    color: #DC2626;
}

.admin-gallery-item__actions .admin-btn--danger:hover {
    background-color: #DC2626;
    border-color: #DC2626;
    color: var(--color-white);
}

/* ---- Confirm panel (delete.php) --------------------------------------------------- */

.admin-panel--confirm p {
    margin-top: 0;
}
