/**
 * Styles personnalisés pour l'administration Django Scopix
 *
 * Ce fichier contient uniquement les styles custom,
 * les styles de base sont hérités de Django admin
 */


/* Forcer les captions de tableaux en haut */
table caption {
    caption-side: top;
}

/* Surcharge couleur section  */
.module caption.tenant-app {
  background: var(--primary) !important;
}
.module caption {
  background: grey !important;
}

.actionlist a, .nav-item a, .dropdown-menu a {
    font-size: 0.875rem;
}
caption .section  {
    text-transform: uppercase !important;
}



/* === Navigation principale === */

/* Conteneur principal de la navbar */
.navbar {
    background: #0a405e;
    position: relative;
    justify-content: space-between;
    display: flex;
    align-items: center;
    padding: 0.3rem 1rem;
}

.left-nav {
    display: flex;
    align-items: center;
    height: 100;
}

/* Logo */
.navbar .logo {
    width: 144px;
    height: auto;
    flex-shrink: 0;
}

/* Nom de l'exploitation */
.navbar .farm-name {
    color: white;
    font-style: italic;
    padding: 0 1rem;
    white-space: nowrap;
    cursor: pointer;
    text-decoration: none;
    flex-shrink: 0;
}

.navbar .farm-name:hover {
    opacity: 0.8;
}

/* Bouton toggle mobile (hamburger) */
.navbar-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    margin-right: 1rem;
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1001;
}

.navbar-toggle-icon {
    display: block;
    width: 25px;
    height: 2px;
    background: white;
    position: relative;
    transition: background 0.3s;
}

.navbar-toggle-icon::before,
.navbar-toggle-icon::after {
    content: '';
    display: block;
    width: 25px;
    height: 2px;
    background: white;
    position: absolute;
    transition: transform 0.3s;
}

.navbar-toggle-icon::before {
    top: -8px;
}

.navbar-toggle-icon::after {
    top: 8px;
}

/* Animation du hamburger en X */
.navbar-toggle.active .navbar-toggle-icon {
    background: transparent;
}

.navbar-toggle.active .navbar-toggle-icon::before {
    transform: rotate(45deg);
    top: 0;
}

.navbar-toggle.active .navbar-toggle-icon::after {
    transform: rotate(-45deg);
    top: 0;
}

/* Menu de navigation */
.navbar-menu {
    display: flex;
    align-items: center;
    margin: 0;
    padding: 0;
    list-style: none;
}

.navbar-menu .nav-item {
    margin: 0;
}

.navbar-menu .nav-item + .nav-item {
    margin-left: 20px;
}

.navbar-menu .nav-link {
    color: rgba(255, 255, 255, 0.75);
    text-decoration: none;
    padding: 0.5rem 0.75rem;
    display: block;
    transition: color 0.2s;
    white-space: nowrap;
}

.navbar-menu .nav-link:hover {
    color: white;
}

.navbar-menu .nav-link.active {
    color: white;
    font-weight: bold;
}

/* Accessibilité : masquer visuellement mais garder pour lecteurs d'écran */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* === Responsive : Mobile === */
@media (max-width: 991px) {
    .navbar {
        flex-wrap: wrap;
        height: auto;
        min-height: 60px;
        z-index: 100;
    }

    .navbar-toggle {
        display: block;
    }

    .navbar-menu {
        display: none;
        flex-direction: column;
        width: 100%;
        background: #0a405e;
        padding: 1rem 0;
        margin: 0;
    }

    .navbar-menu.show {
        display: flex;
    }

    .navbar-menu .nav-item {
        width: 100%;
        margin: 0;
    }

    .navbar-menu .nav-item + .nav-item {
        margin-left: 0;
    }

    .navbar-menu .nav-link {
        padding: 0.75rem 1.5rem;
        width: 100%;
    }

    .navbar-menu .nav-link:hover {
        background: rgba(255, 255, 255, 0.1);
    }

    .navbar .farm-name {
        max-width: calc(100% - 10rem);
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

/* Page d'authentification */

#authentication {
    width: 300px;
    margin: 50px auto 0px auto;
}

/* Template de base */


/* === Modales Bootstrap === */

.largeModal .modal-dialog {
    max-width: 80vw;
    margin: 5vh auto;
}

.largeModal .modal-content {
    height: 85vh;
}

.largeModal .modal-body {
    height: calc(85vh - 20px);
    padding: 15px;
}

.modal-body #iframeMap {
    width: 100%;
    height: 100%;
}

.modal-body #close {
    position: absolute;
    top: 15px;
    right: 25px;
    z-index: 1050;
    cursor: pointer;
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
    color: #000;
    text-shadow: 0 1px 0 #fff;
    opacity: .5;
}

.modal-body #close:hover {
    opacity: .75;
}

/* === Améliorations admin list === */

/* Permettre un meilleur affichage des listes longues */
.change-list table {
    font-size: 13px;
}

/* === Responsive tweaks === */

@media (max-width: 768px) {
    .largeModal .modal-dialog {
        max-width: 95vw;
        margin: 2.5vh auto;
    }

    .largeModal .modal-content {
        height: 90vh;
    }

    .largeModal .modal-body {
        height: calc(90vh - 20px);
        padding: 10px;
    }
}

/* === Styles pour les formulaires d'action admin (create_inventory, etc.) === */

.action-form .module h2 {
    margin: 0;
    padding: 8px;
    font-weight: normal;
    font-size: 13px;
    text-align: left;
    background: #7CA0A6;
    color: white;
}

.action-form .form-row {
    overflow: hidden;
    padding: 8px 12px;
    font-size: 13px;
    border-bottom: 1px solid #eee;
}

.action-form .form-row label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.action-form .form-row input[type="datetime-local"] {
    width: 300px;
    padding: 5px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.action-form .submit-row {
    margin: 15px 0;
    padding: 12px 14px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-align: right;
}

.action-form .submit-row input[type="submit"] {
    background: #417690;
    padding: 10px 15px;
    border: none;
    border-radius: 4px;
    color: white;
    margin-left: 5px;
}

.action-form .submit-row .cancel-link {
    background: #ba2121;
    padding: 10px 15px;
    border: none;
    border-radius: 4px;
    color: white;
    text-decoration: none;
    margin-left: 5px;
}

.action-form .submit-row input[type="submit"]:hover {
    background: #205067;
}

.action-form .submit-row .cancel-link:hover {
    background: #7a0b0b;
}
