/**
 * SELIA CMS administration theme.
 *
 * Materialize provides the component foundation. This file only contains
 * SELIA-specific layout, branding and compatibility rules for the CMS forms.
 */

:root {
    --admin-black: #0b0b0b;
    --admin-dark: #171717;
    --admin-orange: #ff6a00;
    --admin-orange-dark: #df5c00;
    --admin-background: #f4f2ef;
    --admin-card: #ffffff;
    --admin-border: #ddd7d1;
    --admin-muted: #6d6863;
    --admin-danger: #b42318;
    --admin-success: #137333;
    --admin-info: #164f8e;
    --admin-shadow: 0 14px 38px rgba(0, 0, 0, 0.08);
    --admin-sidebar-width: 280px;
}

* {
    box-sizing: border-box;
}

html {
    color: var(--admin-dark);
    background: var(--admin-background);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

body.admin-body {
    min-height: 100vh;
    margin: 0;
    background: var(--admin-background);
}

a {
    color: inherit;
}

code {
    overflow-wrap: anywhere;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

/* --------------------------------------------------------------------------
   Navigation
   -------------------------------------------------------------------------- */

.admin-sidebar.sidenav {
    width: var(--admin-sidebar-width);
    padding-bottom: 28px;
    background: var(--admin-black);
    color: #ffffff;
}

.admin-sidebar.sidenav li > a {
    display: flex;
    align-items: center;
    gap: 12px;
    height: auto;
    min-height: 46px;
    margin: 2px 14px;
    padding: 10px 14px;
    border-radius: 12px;
    color: #d8d8d8;
    font-size: 0.92rem;
    font-weight: 750;
    line-height: 1.25;
}

.admin-sidebar.sidenav li > a:hover,
.admin-sidebar.sidenav li.active > a {
    background: #25211f;
    color: #ffffff;
}

.admin-sidebar.sidenav li.active > a {
    box-shadow: inset 4px 0 var(--admin-orange);
}

.admin-brand {
    margin-bottom: 12px;
    padding: 22px 12px 16px;
    border-bottom: 1px solid #2a2a2a;
}

.admin-brand > a {
    display: grid !important;
    gap: 8px !important;
    margin: 0 !important;
    padding: 0 10px !important;
    background: transparent !important;
}

.admin-brand img {
    width: 205px;
    max-width: 100%;
    filter: brightness(0) invert(1);
}

.admin-brand span {
    color: #aaaaaa;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.admin-nav-section {
    margin: 22px 26px 7px !important;
    color: #88837f;
    font-size: 0.69rem;
    font-weight: 900;
    letter-spacing: 0.13em;
    text-transform: uppercase;
}

.admin-nav-icon {
    display: inline-grid;
    flex: 0 0 24px;
    place-items: center;
    font-size: 1.05rem;
}

/* --------------------------------------------------------------------------
   Page shell and top bar
   -------------------------------------------------------------------------- */

.admin-page {
    min-height: 100vh;
    padding-left: var(--admin-sidebar-width);
}

.admin-topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    height: 76px;
    border-bottom: 1px solid var(--admin-border);
    background: rgba(255, 255, 255, 0.97);
    color: var(--admin-dark);
    backdrop-filter: blur(12px);
}

.admin-topbar .nav-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    padding: 0 30px;
}

.admin-menu-trigger {
    color: var(--admin-dark);
    font-size: 1.8rem;
}

.admin-site-identity {
    display: grid;
    margin-right: auto;
}

.admin-site-identity strong {
    font-size: 1.05rem;
}

.admin-site-identity small,
.admin-user small {
    color: #77716c;
    line-height: 1.25;
}

.admin-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.admin-user > span:last-child {
    display: grid;
}

.admin-avatar {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border-radius: 50%;
    background: var(--admin-orange);
    color: #111111;
    font-weight: 900;
}

.admin-content.container-fluid {
    width: min(100%, 1540px);
    margin: 0 auto;
    padding: 32px;
}

/* --------------------------------------------------------------------------
   Typography and actions
   -------------------------------------------------------------------------- */

.admin-title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 22px;
    margin-bottom: 24px;
}

.admin-title-row h1 {
    margin: 0;
    color: #111111;
    font-size: clamp(1.8rem, 3vw, 2.45rem);
    font-weight: 850;
    line-height: 1.15;
}

.admin-title-row h2 {
    margin: 0;
}

.admin-title-row p {
    margin: 8px 0 0;
    color: var(--admin-muted);
}

.admin-kicker {
    display: block;
    margin-bottom: 5px;
    color: var(--admin-orange-dark);
    font-size: 0.75rem;
    font-weight: 900;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.admin-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.a-btn,
.admin-content button,
.admin-content .btn,
.admin-content .btn-small {
    border-radius: 10px;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: none;
}

.a-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 9px 15px;
    border: 0;
    text-decoration: none;
}

.a-btn.primary,
.admin-content button.primary,
.admin-primary-button {
    background: var(--admin-orange) !important;
    color: #111111 !important;
}

.a-btn.primary:hover,
.admin-content button.primary:hover,
.admin-primary-button:hover {
    background: var(--admin-orange-dark) !important;
    color: #ffffff !important;
}

.a-btn.secondary,
.admin-content button.secondary {
    border: 1px solid var(--admin-border);
    background: #ffffff;
    color: #111111;
}

.a-btn.danger,
.admin-content button.danger {
    border: 1px solid #ffc9c5;
    background: #fff1f0;
    color: var(--admin-danger);
}

.admin-version-chip {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    background: #111111;
    color: #ffffff;
}

/* --------------------------------------------------------------------------
   Cards, metrics and grids
   -------------------------------------------------------------------------- */

.admin-card,
.admin-material-card {
    margin: 0 0 22px;
    border: 1px solid var(--admin-border);
    border-radius: 18px;
    background: var(--admin-card);
    box-shadow: var(--admin-shadow);
}

.admin-card {
    padding: 22px;
}

.admin-material-card .card-content {
    padding: 24px;
}

.admin-material-card .card-title {
    margin-bottom: 10px;
    font-weight: 800;
}

.admin-muted {
    color: var(--admin-muted);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.metric-card {
    display: block;
    padding: 20px;
    border: 1px solid var(--admin-border);
    border-radius: 16px;
    background: #ffffff;
    color: #111111;
    box-shadow: var(--admin-shadow);
    text-decoration: none;
    transition: transform 160ms ease, box-shadow 160ms ease;
}

.metric-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.12);
}

.metric-card > span {
    font-size: 1.7rem;
}

.metric-card strong {
    display: block;
    margin: 10px 0 2px;
    font-size: 2rem;
}

.metric-card small {
    color: var(--admin-muted);
}

.grid-2-admin {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px;
}

.admin-grid-row {
    margin-right: -0.75rem;
    margin-left: -0.75rem;
}

/* --------------------------------------------------------------------------
   Tables and statuses
   -------------------------------------------------------------------------- */

.admin-table-wrap,
.admin-table-scroll {
    overflow-x: auto;
    border: 1px solid var(--admin-border);
    border-radius: 14px;
    background: #ffffff;
}

.admin-table,
.admin-table-scroll table {
    width: 100%;
    min-width: 760px;
    border-collapse: collapse;
}

.admin-table th,
.admin-table-scroll th {
    padding: 13px;
    background: #111111;
    color: #ffffff;
    font-size: 0.76rem;
    font-weight: 850;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.admin-table td,
.admin-table-scroll td {
    padding: 13px;
    border-bottom: 1px solid #eee8e2;
    vertical-align: top;
}

.admin-table tbody tr:last-child td,
.admin-table-scroll tbody tr:last-child td {
    border-bottom: 0;
}

.table-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    white-space: nowrap;
}

.status-pill {
    display: inline-flex;
    padding: 5px 9px;
    border-radius: 999px;
    background: #eeeeee;
    font-size: 0.75rem;
    font-weight: 850;
}

.status-pill.yes,
.status-pill.published,
.status-pill.nouveau,
.status-pill.gagne {
    background: #e7f5e9;
    color: #126b2a;
}

.status-pill.no,
.status-pill.draft,
.status-pill.archive {
    background: #f1efed;
    color: #6d6863;
}

.status-pill.en-cours {
    background: #fff0df;
    color: #9a4c00;
}

.status-pill.perdu {
    background: #fff1f0;
    color: #a72218;
}

/* --------------------------------------------------------------------------
   Forms and rich text editor
   -------------------------------------------------------------------------- */

.admin-form,
.admin-spaced-form {
    display: grid;
    gap: 18px;
}

.form-section {
    padding: 22px;
    border: 1px solid var(--admin-border);
    border-radius: 18px;
    background: #ffffff;
}

.form-section h2 {
    margin: 0 0 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid #eee8e2;
    font-size: 1.08rem;
    font-weight: 800;
}

.admin-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.admin-field {
    display: grid;
    gap: 7px;
}

.admin-field.full {
    grid-column: 1 / -1;
}

.admin-field > label,
.admin-field .field-label {
    position: static;
    color: #2a2724;
    font-size: 0.9rem;
    font-weight: 800;
    transform: none;
}

.admin-field input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
.admin-field select,
.admin-field textarea,
.search-bar input {
    box-sizing: border-box;
    width: 100%;
    height: auto;
    margin: 0;
    padding: 12px 13px;
    border: 1px solid #cbc4bd !important;
    border-radius: 10px !important;
    background: #ffffff !important;
    box-shadow: none !important;
    font: inherit;
}

.admin-field textarea {
    min-height: 110px;
    resize: vertical;
}

.admin-field input:focus,
.admin-field select:focus,
.admin-field textarea:focus,
.search-bar input:focus {
    border-color: var(--admin-orange) !important;
    box-shadow: 0 0 0 3px rgba(255, 106, 0, 0.14) !important;
    outline: 0;
}

.admin-field small {
    color: var(--admin-muted);
}

.check-line {
    display: flex !important;
    align-items: center;
    gap: 10px;
    min-height: 35px;
}

.check-line input[type="checkbox"] + span:not(.lever) {
    height: auto;
    padding-left: 30px;
    color: #2a2724;
    font-weight: 750;
    line-height: 1.4;
}

.existing-file {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: 9px;
    background: #f8f5f2;
    overflow-wrap: anywhere;
}

.form-sticky-actions {
    position: sticky;
    bottom: 0;
    z-index: 20;
    display: flex;
    gap: 10px;
    padding: 14px 0;
    background: rgba(244, 242, 239, 0.94);
    backdrop-filter: blur(10px);
}

.file-field .btn {
    height: 42px;
    line-height: 42px;
}

.file-field .file-path-wrapper {
    padding-left: 14px;
}

.file-field input.file-path {
    height: 42px;
    margin: 0;
    border-bottom: 1px solid #cbc4bd;
}

.editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    padding: 8px;
    border-radius: 10px 10px 0 0;
    background: #111111;
}

.editor-toolbar button {
    min-height: 34px;
    padding: 7px 10px !important;
    border-radius: 6px !important;
    background: #2b2b2b !important;
    color: #ffffff !important;
    font-size: 0.8rem;
}

.rich-editor {
    min-height: 300px;
    padding: 16px;
    overflow: auto;
    border: 1px solid #cbc4bd;
    border-top: 0;
    border-radius: 0 0 10px 10px;
    background: #ffffff;
    line-height: 1.65;
}

.rich-editor:focus {
    outline: 0;
    box-shadow: inset 0 0 0 2px rgba(255, 106, 0, 0.35);
}

.search-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.search-bar input {
    min-width: 260px;
}

/* --------------------------------------------------------------------------
   Messages and utilities
   -------------------------------------------------------------------------- */

.admin-flash {
    margin: 0 0 18px;
    border-radius: 12px;
    font-weight: 750;
}

.admin-flash.success {
    background: #e7f5e9;
    color: var(--admin-success);
}

.admin-flash.error {
    background: #fff1f0;
    color: var(--admin-danger);
}

.admin-flash.info {
    background: #eaf3ff;
    color: var(--admin-info);
}

.admin-note {
    margin-bottom: 18px;
    padding: 14px 16px;
    border-left: 5px solid var(--admin-orange);
    border-radius: 8px;
    background: #fff5e9;
}

.admin-empty-state,
.empty-admin {
    padding: 42px 20px;
    color: var(--admin-muted);
    text-align: center;
}

.inline-form {
    display: inline;
}

.admin-readable-list {
    display: grid;
    gap: 10px;
    padding-left: 22px;
}

.admin-history-collection {
    margin-bottom: 0;
    border-color: var(--admin-border);
    border-radius: 12px;
    overflow: hidden;
}

.admin-history-version {
    color: var(--admin-orange-dark);
    font-weight: 850;
}

.code-copy {
    display: flex;
    align-items: flex-start;
    gap: 6px;
}

.code-copy code {
    padding: 7px;
    border-radius: 7px;
    background: #f2efec;
}

.admin-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 18px;
}

.admin-tabs a {
    padding: 8px 12px;
    border: 1px solid var(--admin-border);
    border-radius: 999px;
    background: #ffffff;
    color: #111111;
    text-decoration: none;
}

.admin-tabs a.active {
    border-color: #111111;
    background: #111111;
    color: #ffffff;
}

/* --------------------------------------------------------------------------
   Special administration screens
   -------------------------------------------------------------------------- */

.home-section-row {
    display: grid;
    grid-template-columns: 80px 1fr 1fr 100px 100px;
    gap: 12px;
    align-items: start;
    padding: 16px 0;
    border-bottom: 1px solid #eee8e2;
}

.home-section-row input,
.home-section-row textarea {
    box-sizing: border-box;
    width: 100%;
    margin: 0 0 8px;
    padding: 9px;
    border: 1px solid #cbc4bd;
    border-radius: 8px;
}

.media-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.media-card {
    overflow: hidden;
    border: 1px solid var(--admin-border);
    border-radius: 14px;
    background: #ffffff;
}

.media-preview {
    display: grid;
    height: 160px;
    place-items: center;
    overflow: hidden;
    background: #eeeeee;
}

.media-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.media-card-body {
    padding: 14px;
}

.media-card code {
    font-size: 0.72rem;
}

/* --------------------------------------------------------------------------
   Login
   -------------------------------------------------------------------------- */

.login-page {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 20px;
    background:
        radial-gradient(circle at 80% 10%, rgba(255, 106, 0, 0.22), transparent 32%),
        #070707;
}

.login-card {
    width: min(460px, 100%);
    padding: 36px;
    border-radius: 22px;
    background: #ffffff;
    box-shadow: 0 32px 80px rgba(0, 0, 0, 0.35);
}

.login-card img {
    width: 230px;
    max-width: 100%;
    margin-bottom: 22px;
}

.login-card h1 {
    margin: 0 0 5px;
    font-size: 2rem;
}

.login-card p {
    color: var(--admin-muted);
}

.login-card .admin-field {
    margin: 16px 0;
}

.login-card button {
    width: 100%;
}

/* --------------------------------------------------------------------------
   Responsive layout
   -------------------------------------------------------------------------- */

@media (min-width: 993px) {
    .admin-menu-trigger {
        display: none;
    }
}

@media (max-width: 1200px) {
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .media-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 992px) {
    .admin-page {
        padding-left: 0;
    }

    .admin-topbar .nav-wrapper {
        padding: 0 18px;
    }

    .admin-menu-trigger {
        display: inline-flex;
        margin-right: 15px;
    }

    .admin-content.container-fluid {
        padding: 22px;
    }
}

@media (max-width: 800px) {
    .admin-title-row {
        display: block;
    }

    .admin-actions,
    .admin-version-chip {
        margin-top: 14px;
    }

    .grid-2-admin,
    .admin-form-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-grid,
    .media-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .home-section-row {
        grid-template-columns: 1fr;
    }

    .admin-field.full {
        grid-column: auto;
    }
}

@media (max-width: 520px) {
    .admin-content.container-fluid {
        padding: 14px;
    }

    .admin-card,
    .form-section,
    .admin-material-card .card-content {
        padding: 16px;
    }

    .dashboard-grid,
    .media-grid {
        grid-template-columns: 1fr;
    }

    .search-bar {
        align-items: stretch;
        flex-direction: column;
    }

    .search-bar input {
        min-width: 0;
    }

    .login-card {
        padding: 25px;
    }
}

/* SELIA 3.6.3 — navigation administration lisible -------------------------- */
body.admin-body #admin-navigation.admin-sidebar.sidenav {
    background: #080808 !important;
    color: #ffffff !important;
}

body.admin-body #admin-navigation.admin-sidebar.sidenav li > a,
body.admin-body #admin-navigation.admin-sidebar.sidenav li > a > span:not(.admin-nav-icon) {
    color: #f1efec !important;
    opacity: 1 !important;
    text-shadow: none !important;
}

body.admin-body #admin-navigation.admin-sidebar.sidenav li > a {
    min-height: 48px;
    border: 1px solid transparent;
    font-size: 0.94rem;
    font-weight: 700;
}

body.admin-body #admin-navigation.admin-sidebar.sidenav li > a:hover {
    border-color: rgb(255 255 255 / 8%);
    background: #1c1c1e !important;
    color: #ffffff !important;
}

body.admin-body #admin-navigation.admin-sidebar.sidenav li.active > a {
    border-color: rgb(255 107 0 / 24%);
    background: #211b17 !important;
    color: #ffffff !important;
    box-shadow: inset 4px 0 #ff6a00;
}

body.admin-body #admin-navigation.admin-sidebar.sidenav .admin-nav-icon {
    color: #ff8733 !important;
    opacity: 1 !important;
    filter: none !important;
}

body.admin-body #admin-navigation.admin-sidebar.sidenav .admin-nav-section {
    margin-top: 24px !important;
    margin-bottom: 8px !important;
    color: #c5c0bb !important;
    font-size: 0.72rem;
    font-weight: 850;
    letter-spacing: 0.14em;
    opacity: 1 !important;
}

body.admin-body #admin-navigation.admin-sidebar.sidenav .admin-brand span {
    color: #d5d1cc !important;
    opacity: 1 !important;
}

body.admin-body #admin-navigation.admin-sidebar.sidenav::-webkit-scrollbar {
    width: 8px;
}

body.admin-body #admin-navigation.admin-sidebar.sidenav::-webkit-scrollbar-thumb {
    border: 2px solid #080808;
    border-radius: 999px;
    background: #5d5854;
}

