﻿/* OVERRIDE COLORS */

:root {
    --kendo-color-primary: #dc4344 !important;
    --kendo-color-primary-hover: #c23d3e !important;
    --kendo-color-primary-active: #a83637 !important;
}

/* GENERAL */

html, body {
    font-family: Inter, 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

body {
    display: flex;
    flex-direction: column;
    height: 100vh;
    margin: 0;
    overflow: hidden;
}

a {
    color: var(--kendo-color-on-app-surface);
}

a:hover {
    color: var(--kendo-color-primary);
    text-decoration: none;
}

h1, h2, h3 {
    margin: .67em 0 .3em;
    font-weight: normal;
}

h1 {
    font-size: 42px;
}

    h1:focus {
        outline: none;
    }

h2 {
    font-size: 32px;
}

h3 {
    font-size: 24px;
}

/* SCROLLBAR - Theme sombre */

/* Firefox */
* {
    scrollbar-color: #4a4a4a #2a2a2a;
}

/* Webkit (Chrome, Edge, Safari) */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: #2a2a2a;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #4a4a4a;
    border-radius: 4px;
    border: 2px solid #2a2a2a;
}

::-webkit-scrollbar-thumb:hover {
    background: #5a5a5a;
}

::-webkit-scrollbar-thumb:active {
    background: #6a6a6a;
}

/* HEADER */

div.appbar-top {
    position: relative;
    z-index: 1;
}

.appbar-top > div {
    line-height: 2.4;
}

#app-title {
    display: flex;
    gap: .2em;
    align-items: center;
    margin: 0;
    padding: 0;
    font-size: 1.2em;
}

#app-title strong {
    font-weight: 500;
}

#app-title sup {
    font-size: .4em;
}

#app-title a,
#app-title a:hover {
    text-decoration: none;
    color: inherit;
}

/* HEADER : LOGO */

#logo-container {
    display: flex;
    align-items: center;
    padding: 0 10px;
}

.header-logo {
    height: 40px;
    width: auto;
}

@media (max-width: 768px) {
    .header-logo {
        height: 30px;
    }
}

/* ========================================
   LAYOUT - Conteneur principal et structure
   ======================================== */

/* DRAWER MAIN */

.layout-drawer {
    flex: 1;
    align-items: stretch;
    overflow: hidden;
}

/* SIDENAV */

.layout-drawer > .k-drawer .k-drawer-items {
    margin-top: 0.5em;

    .k-icon {
        width: 16px;
    }
}

.layout-drawer > .k-drawer .k-drawer-item {
    font-size: 0.8rem;
    padding: 5px 10px;
    min-height: unset;
}

.layout-drawer > .k-drawer .k-drawer-item .k-item-text {
    font-size: 0.8rem;
}

/* Séparateur : aucun padding, aucun fond, pas d'interaction */
.layout-drawer > .k-drawer .k-drawer-item:has(.drawer-separator) {
    padding: 0;
    background: transparent !important;
    cursor: default;
    pointer-events: none;
    min-height: unset;
}

/* Section title : aucun highlight au survol, pas de curseur pointer */
.layout-drawer > .k-drawer .k-drawer-item:has(.drawer-section-title) {
    background: transparent !important;
    cursor: default;
    pointer-events: none;
    padding: 4px 10px 2px;
}

/* MAIN CONTENT */

.layout-drawer .k-drawer-content {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0 5px 10px 10px;
}

/* MAIN LAYOUT (pour LIST - EDIT) */

.layout-main {
    flex: 1;
    display: flex;
    height: calc(100vh - 200px);
    transition: all 0.3s ease-in-out;
}

/* LAYOUT : LIST */

.layout-list {
    flex: 0 0 60%;
    display: flex;
    flex-direction: column;
    transition: flex 0.3s ease-in-out;
    overflow: hidden;
    min-height: 0;
}

/* Grille en pleine largeur quand le panneau d'édition est fermé */

.layout-list.list-full-width {
    flex: 0 0 100%;
}

/* LAYOUT : EDIT */

.layout-edit {
    flex: 0 0 40%;
    display: flex;
    flex-direction: column;
    animation: slideInRight 0.3s ease-in-out;

    > * {
        margin-left: 10px;
    }
}

@keyframes spin-cw {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

.btn-refreshing .k-svg-icon {
    animation: spin-cw 0.8s linear infinite;
    display: inline-block;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* LAYOUT ERROR */

.layout-error-container {
    background: lightyellow;
    color: #dc3545;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

.layout-error-container .layout-error-reload {
    color: #dc3545;
}

.layout-error-container .layout-error-dismiss {
    color: #dc3545;
}

/* ========================================
   LIST - Section liste/grille
   ======================================== */

.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    margin-right: 10px;
}

.list-header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.list-header h4 {
    margin: 0;
    font-size: 1.2em;
}
 
.list-grid {
    flex: 1;
    margin-right: 10px;
    min-height: 0;
}

/* Scroll vertical dans le grid body (lignes), header/footer restent sticky */

.list-grid .k-grid-content {
    overflow-y: auto;
}

.list-grid .k-grid-header,
.list-grid .k-grid-footer {
    padding-inline-end: 0;
}

/* Page size selector (pour pagination dropdown) */

.page-size-selector {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

.page-size-selector label {
    font-weight: 500;
}

/* Status indicators */

.status-active {
    color: #0053cf;
    background-color: #add8e6;
    font-weight: 400;
    border: solid 1px;
    border-radius: 5px;
    padding: 1px 6px;
}

.status-inactive {
    color: #393939;
    background-color: #d3d3d3;
    font-weight: 400;
    border: solid 1px;
    border-radius: 5px;
    padding: 1px 6px;
}

.status-success {
    color: green;
    background-color: lightgreen;
    font-weight: 400;
    border: solid 1px;
    border-radius: 5px;
    padding: 1px 6px;
}

.status-error {
    color: #a83637;
    background-color: #ff9da7;
    font-weight: 400;
    border: solid 1px;
    border-radius: 5px;
    padding: 1px 6px;
}

.status-pending {
    color: #a16800;
    background-color: #ffe79d;
    font-weight: 400;
    border: solid 1px;
    border-radius: 5px;
    padding: 1px 6px;
}

/* Limiter la hauteur des lignes de la grille (gros champ texte) */

.k-grid tbody td {
    white-space: nowrap !important;
}

/* Style pour maintenir la row sélectionnée visible */

.k-grid tr.k-selected,
.k-grid tr.k-selected:hover {
    background-color: var(--kendo-color-primary) !important;
    color: var(--kendo-color-on-primary) !important;
}

.k-grid tr.k-selected td {
    background-color: transparent;
    color: inherit;
}

/* ========================================
   EDIT - Section panneau d'édition
   ======================================== */

.edit-panel {
    background: var(--kendo-color-surface-alt);
    border: 1px solid var(--kendo-color-border);
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    height: 100%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.edit-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 8px;
    border-bottom: 1px solid var(--kendo-color-border);
    background: var(--kendo-color-surface);
}

.edit-panel-header h4 {
    margin: 0;
    font-size: 1.1em;
    flex: 1;
}

/* Boutons de navigation - visibilité selon device */

.mobile-back-button {
    display: none;
}

.desktop-close-button {
    display: block;
}

.edit-panel-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    min-height: 0; /* Important pour le scroll flex */
}

.edit-panel-footer {
    height: 48px;
    display: flex;
    gap: 10px;
    border-top: 1px solid var(--kendo-color-border);
    background: var(--kendo-color-surface);
    flex-wrap: wrap;
    flex-shrink: 0; /* Empêche le footer de rétrécir */
    align-items: center;
    padding: 0 9px;
}
}

.empty-state {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    color: var(--kendo-color-subtle);
    padding: 40px 20px;
}

.empty-state p {
    font-size: 1.1em;
    line-height: 1.6;
}

/* Legacy window footer (à garder pour compatibilité) */

.window-footer {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #ddd;
}

/* ========================================
   RESPONSIVE
   ======================================== */

/* Responsive - Tablettes (768px à 1200px) */
/*
@media (max-width: 1200px) {
    .layout-main {
        flex-direction: column;
        height: auto;
    }

    .layout-drawer .k-drawer-content {
        overflow: auto;
    }

        .layout-list,
        .layout-edit {
            flex: 1 1 auto;
        }

        .layout-list {
            margin-bottom: 20px;
        }

            .layout-list.list-full-width {
                flex: 1 1 auto;
            }
    }
    */

/* Responsive - Mobile ET Tablettes (moins de 1024px) */

@media (max-width: 1024px) {

    /* En mode édition, cacher la grille sur mobile/tablette */

    .layout-main.editing-mode .layout-list {
        display: none;
    }

    /* Le panneau d'édition prend toute la largeur */

    .layout-main.editing-mode .layout-edit {
        flex: 1 1 100%;
        animation: slideInFromRight 0.3s ease-in-out;
    }

    @keyframes slideInFromRight {
        from {
            opacity: 0;
            transform: translateX(100%);
        }

        to {
            opacity: 1;
            transform: translateX(0);
        }
    }

    /* Afficher le bouton retour mobile, cacher le X desktop */

    .mobile-back-button {
        display: block;
        margin-right: 10px;
    }

    .desktop-close-button {
        display: none;
    }

    /* Ajuster le header du panneau d'édition */

    X.edit-panel-header {
        padding: 12px 15px;
    }

    .edit-panel-header h4 {
        font-size: 1em;
    }

    /* Boutons du footer en pleine largeur sur mobile */

    .edit-panel-footer {
        flex-direction: column;
    }

    .edit-panel-footer .k-button {
        width: 100%;
    }
}

/* Responsive - Petits mobiles (moins de 640px) */

@media (max-width: 640px) {
    .layout-container {
        padding: 10px;
    }

    .layout-container h3 {
        font-size: 1.5em;
        margin-bottom: 15px;
    }

    .list-header {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }

    .list-header h4 {
        font-size: 1em;
    }

    .list-header .k-button {
        width: 100%;
    }

    .edit-panel-body {
        padding: 15px;
    }
}

/* Bottom AppBar — footer de monitoring */

div.appbar-bottom {
    z-index: 1;
    background-color: var(--kendo-color-surface);
    color: var(--kendo-color-subtle);
    border-top: 1px solid var(--kendo-color-border);
}

.footer-status-bar {
    display: flex;
    align-items: center;
    gap: 0;
    font-size: 0.78rem;
    padding: 0 8px;
    white-space: nowrap;
}

.footer-service {
    color: var(--kendo-color-subtle);
}

.footer-service--down {
    color: var(--kendo-color-error);
    font-weight: 600;
}

.footer-separator {
    color: var(--kendo-color-border);
    padding: 0 6px;
}

.footer-loading {
    color: var(--kendo-color-subtle);
    font-size: 0.78rem;
}

/* ─── Grid Column Manager Dialog ─── */

.col-manager-body {
    padding: 8px 0 4px;
}

.col-manager-subtitle {
    margin: 0 0 12px;
    font-size: 0.85rem;
    color: var(--kendo-color-subtle);
}

.col-manager-select-all {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px 10px;
    border-bottom: 1px solid var(--kendo-color-border, #444);
}

.col-manager-select-all label {
    cursor: pointer;
    font-weight: 500;
    user-select: none;
}

.col-manager-list {
    max-height: 360px;
    overflow-y: auto;
    padding: 4px 0;
}

/* Chaque ligne de colonne dans la liste */
.col-manager-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 16px;
    border-radius: 4px;
    transition: background-color 0.1s;
    cursor: default;
}

.col-manager-item:hover {
    background-color: var(--kendo-color-base-hover);
}

.col-manager-item--hidden label {
    opacity: 0.5;
}

.col-manager-item--dragover {
    border-top: 2px solid var(--kendo-color-primary);
    background-color: var(--kendo-color-base-hover);
}

.col-manager-item[draggable="true"]:active {
    opacity: 0.5;
}

/* Poignée de glisser-déposer */
.col-mgr-handle {
    cursor: grab;
    color: var(--kendo-color-subtle);
    font-size: 1.1rem;
    line-height: 1;
    user-select: none;
    flex-shrink: 0;
    padding: 0 2px;
}

.col-mgr-handle:active {
    cursor: grabbing;
}

.col-manager-item label {
    cursor: pointer;
    user-select: none;
    flex: 1;
}

/* Footer du dialog */
.col-manager-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0 0;
    border-top: 1px solid var(--kendo-color-border, #444);
    margin-top: 8px;
}

.col-manager-footer-actions {
    display: flex;
    gap: 8px;
}

/* ─── Grid FilterMenu : une seule clause, pas de OR ─── */

.k-grid-filter-popup .k-filter-menu-container > :nth-child(n+3):not(.k-actions) {
    display: none !important;
}

