﻿/* =========================================================
   PromoTool Theme (ordered: generic -> specific)
   ========================================================= */

:root {
    --pt-red: #e30613;
    --pt-red-hover: #c90511;
    --pt-black: #000000;
    --pt-bg: #0b0b0b;
    --pt-bg-soft: #121212;
    --pt-border: rgba(255, 255, 255, 0.12);
    --pt-text: #ffffff;
    --pt-text-muted: rgba(255, 255, 255, 0.65);
    --pt-focus: rgba(227, 6, 19, 0.45);

    --pt-sidebar-width: 260px;
    --pt-sidebar-collapsed-width: 72px;
    --pt-mobile-header-h: 56px;
}

/* =======================
   Base
   ======================= */

html, body {
    height: 100%;
    margin: 0;
    background: var(--pt-bg);
    color: var(--pt-text);
    overflow-x: hidden;
}

* {
    box-sizing: border-box;
}

a {
    color: var(--pt-red);
    text-decoration: none;
}

a:hover {
    color: var(--pt-red-hover);
    text-decoration: underline;
}

/* =======================
   Login / Auth screens (home déconnectée + authentication)
   ======================= */

/* Plein écran, fond PromoTool, centrage */
.pt-login-hero,
.pt-loading-wrap {
    min-height: 100dvh;
    display: grid;
    place-items: center;
    padding: 24px;
    box-sizing: border-box;
    overflow: hidden;
    color: #ffffff;
    background: radial-gradient(800px 400px at 50% 20%, rgba(227, 6, 19, 0.12), transparent 60%),
    linear-gradient(180deg, #000000, #0b0b0b);
}

/* Carte */
.pt-login-card,
.pt-loading-card {
    width: min(520px, 92vw);
    border-radius: 20px;
    padding: 34px 34px 26px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 20px 48px rgba(0, 0, 0, 0.65);
    text-align: center;
}

/* Logo wrapper (évite logo cassé) */
.pt-login-logo-wrap,
.pt-loading-logo-wrap {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    display: grid;
    place-items: center;
    margin: 0 auto 16px;
}

/* Logo image */
.pt-login-logo,
.pt-loading-logo {
    width: 44px;
    height: 44px;
    object-fit: contain;
    display: block;
}

.pt-login-card h1 {
    margin: 0;
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: 0.2px;
    color: #ffffff;
}

.pt-login-tagline {
    margin: 10px 0 22px;
    color: rgba(255, 255, 255, 0.78);
    font-size: 1rem;
}

/* Bouton login */
.pt-login-btn {
    width: 100%;
    padding: 0.85rem 1rem;
    font-size: 1rem;
    border-radius: 14px;
}

/* Spinner (si utilisé dans authorizing) */
.pt-spinner {
    width: 34px;
    height: 34px;
    border-radius: 999px;
    border: 3px solid rgba(255, 255, 255, 0.18);
    border-top-color: rgba(227, 6, 19, 0.95);
    margin: 10px auto 14px;
    animation: pt-spin 0.85s linear infinite;
}

@keyframes pt-spin {
    to {
        transform: rotate(360deg);
    }
}

.pt-loading-subtitle,
.pt-loading-hint {
    color: rgba(255, 255, 255, 0.78);
}

/* Mobile: centré propre, moins de padding */
@media (max-width: 767.98px) {
    .pt-login-hero,
    .pt-loading-wrap {
        padding-left: 12px;
        padding-right: 12px;
    }
}

/* =======================
   Avatar (FIX: never huge)
   ======================= */

.pt-avatar {
    width: 40px !important;
    height: 40px !important;
    max-width: 40px !important;
    max-height: 40px !important;
    border-radius: 999px !important;
    object-fit: cover !important;
    display: block !important;
    flex: 0 0 40px !important;
}

@media (min-width: 768px) {
    .pt-avatar {
        width: 2.5em !important;
        height: 2.5em !important;
        max-width: 2.5em !important;
        max-height: 2.5em !important;
        flex: 0 0 2.5em !important;
    }
}

.pt-top-user img {
    width: inherit;
    height: inherit;
    max-width: inherit;
    max-height: inherit;
}

/* Alignement avatar / nom / bouton */
.pt-top-user {
    display: inline-flex !important;
    align-items: center !important;
    gap: 12px;
}

.pt-top-user .pt-avatar {
    align-self: center !important;
}

.pt-top-user-link {
    display: inline-flex !important;
    align-items: center !important;
    line-height: 1 !important;
}

.pt-top-user .btn {
    align-self: center !important;
    line-height: 1.1;
}

.pt-top-username {
    display: inline-block;
    line-height: 1.1;
}

/* =======================
   Layout desktop
   ======================= */

.page {
    display: flex;
    min-height: 100vh;
    overflow: hidden;
}

.sidebar {
    display: flex;
    flex-direction: column;
    min-height: 100vh;

    width: var(--pt-sidebar-width);
    flex: 0 0 var(--pt-sidebar-width);
    flex-shrink: 0;

    background: #000000 !important;
    background-image: none !important;
    border-right: 1px solid var(--pt-border);
}

.nav-scrollable {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;

    background: #000000 !important;
    background-image: none !important;
}

.pt-main,
main {
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

.content,
.overflow-x-container {
    min-width: 0;
    overflow-x: auto;
    overflow-y: visible;
}

/* =======================
   Top rows (generic)
   ======================= */

.top-row {
    background: #000000;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.pt-top-row,
.pt-main-toprow {
    background: #000000 !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12) !important;
}

.navbar-toggler {
    border-color: rgba(255, 255, 255, 0.25);
}
.navbar-toggler:focus {
    box-shadow: 0 0 0 3px var(--pt-focus);
}

/* =======================
   Sidebar header
   ======================= */

.sidebar .top-row {
    background: #000000 !important;
    background-image: none !important;
    border-bottom: 1px solid var(--pt-border);
}

.pt-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    overflow: hidden;
    white-space: nowrap;
}

.pt-brand-logo {
    width: 22px;
    height: 22px;
    object-fit: contain;
    border-radius: 6px;
}

/* =======================
   Sidebar nav
   ======================= */

.sidebar .nav-item a,
.sidebar .nav-item .nav-link {
    color: var(--pt-text-muted) !important;
    border-radius: 10px;
    margin: 4px 10px;
    padding: 10px 12px;
}

.sidebar .nav-item a:hover,
.sidebar .nav-item .nav-link:hover {
    color: var(--pt-text) !important;
    background: rgba(255, 255, 255, 0.06) !important;
}

.sidebar .nav-item a.active,
.sidebar .nav-item .nav-link.active {
    color: #ffffff !important;
    background: rgba(227, 6, 19, 0.16) !important;
    box-shadow: none !important;
}

.sidebar .nav-link {
    display: flex !important;
    align-items: center !important;
    gap: 12px;
    min-height: 42px;
    line-height: 1;
}

.sidebar .nav-link .bi,
.sidebar .nav-link .fa-solid,
.sidebar .nav-link .fa-regular,
.sidebar .nav-link .fa-light,
.sidebar .nav-link .fa-duotone,
.sidebar .nav-link .fa-brands {
    width: 22px;
    min-width: 22px;
    display: grid;
    place-items: center;
    font-size: 1.05rem;
    line-height: 1;
    color: var(--pt-red);
    opacity: 0.95;
}

.sidebar .pt-nav-text {
    white-space: nowrap;
}

/* =======================
   Desktop: sidebar collapsed
   ======================= */

.pt-sidebar-toggle {
    margin-left: 10px;
    gap: 8px;
    align-items: center;
    padding: 0.35rem 0.6rem;
}

.pt-collapse-icon {
    transition: transform 160ms ease;
    display: block;
    line-height: 1;
}

.pt-rot180 {
    transform: rotate(180deg);
}

@media (min-width: 768px) {
    .sidebar.pt-sidebar-collapsed {
        width: var(--pt-sidebar-collapsed-width) !important;
        flex-basis: var(--pt-sidebar-collapsed-width) !important;
        overflow-x: hidden;
    }

    .sidebar.pt-sidebar-collapsed .nav-item,
    .sidebar.pt-sidebar-collapsed .nav-item.px-3 {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    .sidebar.pt-sidebar-collapsed .nav-link {
        justify-content: center !important;
        gap: 0 !important;
        width: calc(var(--pt-sidebar-collapsed-width) - 16px) !important;
        margin: 6px auto !important;
        padding: 12px 0 !important;
    }

    .sidebar.pt-sidebar-collapsed .pt-nav-text {
        display: none !important;
    }

    .sidebar.pt-sidebar-collapsed .nav-link .bi,
    .sidebar.pt-sidebar-collapsed .nav-link .fa-solid,
    .sidebar.pt-sidebar-collapsed .nav-link .fa-regular,
    .sidebar.pt-sidebar-collapsed .nav-link .fa-light,
    .sidebar.pt-sidebar-collapsed .nav-link .fa-duotone,
    .sidebar.pt-sidebar-collapsed .nav-link .fa-brands {
        width: 100%;
        min-width: 0;
        font-size: 1.1rem;
    }

    .sidebar.pt-sidebar-collapsed .pt-brand-text {
        display: none !important;
    }

    .sidebar.pt-sidebar-collapsed .top-row .container-fluid {
        position: relative;
        padding-left: 0;
        padding-right: 0;
    }

    .sidebar.pt-sidebar-collapsed .pt-sidebar-toggle {
        position: absolute;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
        margin: 0;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        padding: 6px;
        min-width: 36px;
        min-height: 36px;
    }
}

/* =======================
   Mobile (most specific last)
   ======================= */

@media (max-width: 767.98px) {
    .page {
        flex-direction: column;
        overflow-x: hidden;
    }

    .sidebar {
        width: 100%;
        flex: 0 0 auto;
        min-height: auto;
        border-right: none;
        border-bottom: 1px solid var(--pt-border);
    }

    main > .top-row,
    .pt-main > .top-row,
    main .pt-main-toprow,
    .pt-main .pt-main-toprow {
        display: none !important;
    }

    .nav-scrollable.collapse {
        display: none !important;
    }

    .nav-scrollable:not(.collapse) {
        max-height: calc(100dvh - var(--pt-mobile-header-h));
        overflow-y: auto;
        overflow-x: hidden;
        padding: 10px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.10);
    }

    .sidebar .nav-item,
    .sidebar .nav-item.px-3 {
        padding: 0 !important;
        width: 100%;
    }

    .sidebar .nav-item a,
    .sidebar .nav-item .nav-link {
        display: flex !important;
        width: 100% !important;
        margin: 6px 0 !important;
        padding: 14px 14px !important;
        border-radius: 12px !important;
    }

    .sidebar .pt-nav-text {
        white-space: normal !important;
    }

    .content.px-4,
    article.content.px-4,
    .top-row.px-4 {
        padding-left: 12px !important;
        padding-right: 12px !important;
    }

    .mud-container {
        max-width: 100% !important;
        padding-left: 12px !important;
        padding-right: 12px !important;
    }

    .mud-button-root {
        max-width: 100% !important;
        white-space: normal !important;
    }
}
