/**
 * PANMR Suite -- Page de Connexion Client/Public -- CSS Premium
 *
 * Design : carte centree flottante sur fond gradient plein ecran.
 * DISTINCT du split-layout admin.
 *
 * IMPORTANT : cette vue est chargee DANS le theme Perfex (head + nav + footer).
 * On doit forcer le masquage de TOUS les elements du theme et remettre
 * a zero les wrappers qui contraignent le layout.
 *
 * @package    PANMR Suite
 * @subpackage Assets/CSS
 * @author     Ir. Roland MANTAMA -- https://rolandmantama.ch
 * @version    1.1.0
 * @since      1.7.1
 */

/* ======================================================================
   0. NEUTRALISER LE THEME PERFEX
   ------------------------------------------------------------------
   Le theme Perfex injecte : navbar, #wrapper, .content, footer, etc.
   On masque tout ce qui n'est pas notre contenu et on libere le layout.
   ------------------------------------------------------------------
   Note : usage de !important = force majeure car on override un theme
   externe dont on ne controle pas la specificite CSS.
   ====================================================================== */

/* 0a. Masquer navigation + footer du theme */
body.panmr-client-login .navbar,
body.panmr-client-login .navbar-default,
body.panmr-client-login .navbar-fixed-top,
body.panmr-client-login nav,
body.panmr-client-login #header,
body.panmr-client-login .customer-top-nav,
body.panmr-client-login footer,
body.panmr-client-login .footer,
body.panmr-client-login #footer,
body.panmr-client-login .footer-copyright {
    display: none !important;
    height: 0 !important;
    min-height: 0 !important;
    overflow: hidden !important;
    visibility: hidden !important;
}

/* 0b. Remettre a zero les wrappers theme qui contraignent le layout */
body.panmr-client-login,
body.panmr-client-login #wrapper,
body.panmr-client-login .content,
body.panmr-client-login .container,
body.panmr-client-login .container-fluid,
body.panmr-client-login .row,
body.panmr-client-login .col-md-12,
body.panmr-client-login .col-md-8,
body.panmr-client-login .col-md-6,
body.panmr-client-login .col-md-4,
body.panmr-client-login .col-sm-12,
body.panmr-client-login .col-xs-12 {
    width: 100% !important;
    max-width: 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    float: none !important;
}

body.panmr-client-login #wrapper,
body.panmr-client-login .content {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    margin-top: 0 !important;
    min-height: 0 !important;
}

/* 0c. Masquer le formulaire login original du theme (si visible) */
body.panmr-client-login .panel_s,
body.panmr-client-login .panel-body > form:not(.panmr-cl-form),
body.panmr-client-login .login-heading,
body.panmr-client-login h1:not(.panmr-cl-header__title) {
    /* Ne pas masquer nos propres elements */
}

/* ======================================================================
   1. BASE BODY
   ====================================================================== */

body.panmr-client-login {
    padding-top: 0 !important;
    margin: 0 !important;
    min-height: 100vh;
    font-family: 'DM Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: 15px;
    line-height: 1.6;
    color: #1f2937;
    background: linear-gradient(160deg, #0c2340 0%, #12305a 35%, #1a4175 65%, #22538f 100%) !important;
    background-attachment: fixed !important;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* ======================================================================
   2. WRAPPER PAGE
   ====================================================================== */

.panmr-cl-page {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 40px 20px;
    width: 100%;
    box-sizing: border-box;
}

/* Motif losanges Kasai */
.panmr-cl-page::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    opacity: 0.035;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M30 5 L55 30 L30 55 L5 30 Z' fill='none' stroke='%23ffffff' stroke-width='1'/%3E%3C/svg%3E");
    background-size: 60px 60px;
    pointer-events: none;
    z-index: 0;
}

/* Lueur ambre coin superieur droit */
.panmr-cl-page::after {
    content: '';
    position: fixed;
    top: -20%;
    right: -10%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(217, 119, 6, 0.08) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

/* ======================================================================
   3. EN-TETE (logo + titre sur fond bleu)
   ====================================================================== */

.panmr-cl-header {
    position: relative;
    z-index: 1;
    text-align: center;
    margin-bottom: 32px;
}

.panmr-cl-header__logo {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.panmr-cl-header__logo img {
    max-width: 200px;
    max-height: 90px;
    width: auto;
    height: auto;
    object-fit: contain;
    filter: drop-shadow(0 2px 12px rgba(0, 0, 0, 0.2));
}

.panmr-cl-header__title {
    font-size: 24px;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.3px;
    margin: 0 0 6px 0;
    padding: 0;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    background: none;
    border: none;
}

.panmr-cl-header__badge {
    display: inline-block;
    padding: 3px 12px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: rgba(251, 191, 36, 0.9);
    border: 1px solid rgba(251, 191, 36, 0.2);
    border-radius: 20px;
    background: rgba(251, 191, 36, 0.06);
}

/* ======================================================================
   4. CARTE FORMULAIRE FLOTTANTE
   ====================================================================== */

.panmr-cl-card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 440px;
    background: #ffffff;
    border-radius: 20px;
    padding: 40px 36px 36px;
    box-sizing: border-box;
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.15),
        0 4px 16px rgba(0, 0, 0, 0.08);
}

/* Bande ambre decorative en haut */
.panmr-cl-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 32px;
    right: 32px;
    height: 3px;
    border-radius: 0 0 3px 3px;
    background: linear-gradient(90deg, #d97706, #f59e0b, #fbbf24);
}

.panmr-cl-card__header {
    text-align: center;
    margin-bottom: 28px;
}

/* Icone bouclier — TAILLE FIXE */
.panmr-cl-card__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    margin: 0 auto 16px;
    border-radius: 14px;
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    box-shadow: 0 2px 8px rgba(43, 108, 176, 0.1);
}

.panmr-cl-card__icon svg {
    display: block;
    width: 26px;
    height: 26px;
    min-width: 26px;
    min-height: 26px;
    max-width: 26px;
    max-height: 26px;
    stroke: #22538f;
    stroke-width: 1.8;
    fill: none;
}

.panmr-cl-card__title {
    font-size: 21px;
    font-weight: 700;
    color: #1f2937;
    letter-spacing: -0.2px;
    margin: 0 0 4px 0;
    padding: 0;
    background: none;
    border: none;
}

.panmr-cl-card__hint {
    font-size: 13px;
    color: #6b7280;
    line-height: 1.5;
    margin: 0;
}

/* ======================================================================
   5. ALERTES
   ====================================================================== */

.panmr-cl-alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 13px;
    line-height: 1.5;
    margin-bottom: 20px;
    border: 1px solid transparent;
}

.panmr-cl-alert--danger {
    background: #fee2e2;
    color: #b91c1c;
    border-color: #fecaca;
}

.panmr-cl-alert--success {
    background: #dcfce7;
    color: #15803d;
    border-color: #bbf7d0;
}

.panmr-cl-alert--info {
    background: #dbeafe;
    color: #1d4ed8;
    border-color: #bfdbfe;
}

.panmr-cl-alert__icon {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    min-width: 18px;
    min-height: 18px;
    margin-top: 1px;
}

/* ======================================================================
   6. CHAMPS FORMULAIRE
   ====================================================================== */

.panmr-cl-field {
    margin-bottom: 20px;
}

.panmr-cl-field__label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
    letter-spacing: 0.1px;
}

.panmr-cl-field__input {
    display: block;
    width: 100%;
    height: 48px;
    padding: 0 16px;
    font-family: inherit;
    font-size: 14px;
    color: #1f2937;
    background: #f9fafb;
    border: 1.5px solid #e5e7eb;
    border-radius: 12px;
    outline: none;
    box-sizing: border-box;
    transition: border-color 200ms cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 200ms cubic-bezier(0.4, 0, 0.2, 1),
                background-color 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

.panmr-cl-field__input::placeholder {
    color: #9ca3af;
}

.panmr-cl-field__input:hover {
    border-color: #d1d5db;
}

.panmr-cl-field__input:focus {
    border-color: #4a90d9;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(43, 108, 176, 0.1);
}

/* Password wrap */
.panmr-cl-field__password-wrap {
    position: relative;
}

.panmr-cl-field__password-wrap .panmr-cl-field__input {
    padding-right: 48px;
}

.panmr-cl-field__toggle-pw {
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    color: #9ca3af;
    border-radius: 6px;
    transition: color 200ms, background 200ms;
}

.panmr-cl-field__toggle-pw:hover {
    color: #4b5563;
    background: rgba(0, 0, 0, 0.04);
}

.panmr-cl-field__toggle-pw:focus-visible {
    outline: 2px solid #4a90d9;
    outline-offset: 2px;
}

.panmr-cl-field__toggle-pw svg {
    display: block;
    width: 18px;
    height: 18px;
    min-width: 18px;
    min-height: 18px;
    max-width: 18px;
    max-height: 18px;
    stroke-width: 1.8;
    fill: none;
    stroke: currentColor;
}

/* ======================================================================
   7. OPTIONS (remember + forgot)
   ====================================================================== */

.panmr-cl-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 8px;
}

.panmr-cl-remember {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.panmr-cl-remember__checkbox {
    width: 16px;
    height: 16px;
    min-width: 16px;
    border: 1.5px solid #d1d5db;
    border-radius: 4px;
    appearance: none;
    -webkit-appearance: none;
    background: #ffffff;
    cursor: pointer;
    transition: border-color 200ms, background 200ms;
    position: relative;
}

.panmr-cl-remember__checkbox:checked {
    background: #22538f;
    border-color: #22538f;
}

.panmr-cl-remember__checkbox:checked::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 5px;
    width: 4px;
    height: 8px;
    border: solid #ffffff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.panmr-cl-remember__checkbox:focus-visible {
    outline: 2px solid #4a90d9;
    outline-offset: 2px;
}

.panmr-cl-remember__text {
    font-size: 13px;
    color: #4b5563;
    user-select: none;
}

.panmr-cl-forgot {
    font-size: 13px;
    font-weight: 600;
    color: #22538f;
    text-decoration: none;
    transition: color 200ms;
}

.panmr-cl-forgot:hover {
    color: #0c2340;
    text-decoration: underline;
}

/* ======================================================================
   8. BOUTON CONNEXION
   ====================================================================== */

.panmr-cl-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    height: 50px;
    padding: 0 24px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    color: #ffffff;
    background: linear-gradient(135deg, #0c2340 0%, #1a4175 50%, #22538f 100%);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    letter-spacing: 0.2px;
    position: relative;
    overflow: hidden;
    box-sizing: border-box;
    transition: transform 150ms cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

.panmr-cl-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, transparent 60%);
    pointer-events: none;
}

.panmr-cl-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(12, 35, 64, 0.35);
}

.panmr-cl-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(12, 35, 64, 0.2);
}

.panmr-cl-btn:focus-visible {
    outline: 2px solid #fbbf24;
    outline-offset: 3px;
}

.panmr-cl-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.panmr-cl-btn__icon {
    display: block;
    width: 18px;
    height: 18px;
    min-width: 18px;
    min-height: 18px;
    max-width: 18px;
    max-height: 18px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
    transition: transform 200ms;
}

.panmr-cl-btn:hover .panmr-cl-btn__icon {
    transform: translateX(3px);
}

.panmr-cl-btn__spinner {
    display: none;
    width: 20px;
    height: 20px;
    border: 2.5px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: panmr-cl-spin 0.7s linear infinite;
}

.panmr-cl-btn--loading .panmr-cl-btn__spinner {
    display: block;
}

.panmr-cl-btn--loading .panmr-cl-btn__text,
.panmr-cl-btn--loading .panmr-cl-btn__icon {
    display: none;
}

@keyframes panmr-cl-spin {
    to { transform: rotate(360deg); }
}

/* ======================================================================
   9. SEPARATEUR + LIEN PORTAIL
   ====================================================================== */

.panmr-cl-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 24px 0 20px;
    color: #d1d5db;
    font-size: 12px;
}

.panmr-cl-divider::before,
.panmr-cl-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e5e7eb;
}

.panmr-cl-divider span {
    color: #9ca3af;
    font-weight: 500;
    white-space: nowrap;
}

.panmr-cl-link-portal {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    height: 44px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    color: #22538f;
    background: #eff6ff;
    border: 1.5px solid #dbeafe;
    border-radius: 12px;
    text-decoration: none;
    box-sizing: border-box;
    transition: background 200ms, border-color 200ms, color 200ms;
}

.panmr-cl-link-portal:hover {
    background: #dbeafe;
    border-color: #b3d4f5;
    color: #12305a;
    text-decoration: none;
}

.panmr-cl-link-portal svg {
    display: block;
    width: 16px;
    height: 16px;
    min-width: 16px;
    min-height: 16px;
    max-width: 16px;
    max-height: 16px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

/* ======================================================================
   10. SELECTEUR LANGUE
   ====================================================================== */

.panmr-cl-lang {
    margin-top: 16px;
    text-align: center;
}

.panmr-cl-lang__select {
    display: inline-block;
    padding: 6px 32px 6px 12px;
    font-family: inherit;
    font-size: 12px;
    color: #6b7280;
    background-color: #f3f4f6;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    transition: border-color 200ms;
}

.panmr-cl-lang__select:hover {
    border-color: #d1d5db;
}

.panmr-cl-lang__select:focus-visible {
    outline: 2px solid #4a90d9;
    outline-offset: 2px;
}

/* ======================================================================
   11. FOOTER (sur fond bleu, texte clair)
   ====================================================================== */

.panmr-cl-footer {
    position: relative;
    z-index: 1;
    margin-top: 28px;
    text-align: center;
}

.panmr-cl-footer__text {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
    line-height: 1.6;
    margin: 0;
}

.panmr-cl-footer__link {
    color: rgba(255, 255, 255, 0.55);
    text-decoration: none;
    font-weight: 500;
    transition: color 200ms;
}

.panmr-cl-footer__link:hover {
    color: rgba(255, 255, 255, 0.8);
}

.panmr-cl-footer__admin {
    display: inline-block;
    margin-top: 8px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.3);
    text-decoration: none;
    transition: color 200ms;
}

.panmr-cl-footer__admin:hover {
    color: rgba(255, 255, 255, 0.6);
}

/* ======================================================================
   12. ANIMATIONS
   ====================================================================== */

@keyframes panmr-cl-fade-in-down {
    from {
        opacity: 0;
        transform: translateY(-12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes panmr-cl-scale-in {
    from {
        opacity: 0;
        transform: scale(0.96);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes panmr-cl-fade-in-up {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.panmr-cl-header {
    animation: panmr-cl-fade-in-down 500ms cubic-bezier(0.4, 0, 0.2, 1) both;
    animation-delay: 100ms;
}

.panmr-cl-card {
    animation: panmr-cl-scale-in 500ms cubic-bezier(0.4, 0, 0.2, 1) both;
    animation-delay: 200ms;
}

.panmr-cl-footer {
    animation: panmr-cl-fade-in-up 500ms cubic-bezier(0.4, 0, 0.2, 1) both;
    animation-delay: 400ms;
}

/* ======================================================================
   13. SKIP LINK (a11y)
   ====================================================================== */

.panmr-cl-skip {
    position: absolute;
    top: -100%;
    left: 16px;
    z-index: 1000;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    color: #0c2340;
    background: #fbbf24;
    border-radius: 0 0 8px 8px;
    text-decoration: none;
    transition: top 200ms;
}

.panmr-cl-skip:focus {
    top: 0;
}

/* ======================================================================
   14. RESPONSIVE
   ====================================================================== */

@media (max-width: 480px) {
    .panmr-cl-page {
        padding: 24px 16px;
        justify-content: flex-start;
        padding-top: 48px;
    }

    .panmr-cl-header {
        margin-bottom: 24px;
    }

    .panmr-cl-header__logo img {
        max-width: 160px;
    }

    .panmr-cl-header__title {
        font-size: 20px;
    }

    .panmr-cl-card {
        padding: 28px 22px 24px;
        border-radius: 16px;
    }

    .panmr-cl-card::before {
        left: 20px;
        right: 20px;
    }

    .panmr-cl-card__icon {
        width: 44px;
        height: 44px;
        border-radius: 12px;
    }

    .panmr-cl-card__icon svg {
        width: 22px;
        height: 22px;
        min-width: 22px;
        min-height: 22px;
        max-width: 22px;
        max-height: 22px;
    }

    .panmr-cl-card__title {
        font-size: 19px;
    }

    .panmr-cl-field__input {
        height: 46px;
        font-size: 16px; /* Empeche zoom iOS */
    }

    .panmr-cl-btn {
        height: 48px;
    }

    .panmr-cl-options {
        flex-direction: column;
        align-items: flex-start;
    }

    .panmr-cl-link-portal {
        height: 42px;
        font-size: 12px;
    }
}

/* Tres petit ecran */
@media (max-width: 360px) {
    .panmr-cl-page {
        padding: 20px 14px;
        padding-top: 36px;
    }

    .panmr-cl-card {
        padding: 24px 18px 20px;
    }

    .panmr-cl-header__badge {
        display: none;
    }
}

/* Grand ecran */
@media (min-width: 1200px) {
    .panmr-cl-card {
        max-width: 460px;
        padding: 44px 40px 40px;
    }
}

/* Mouvement reduit */
@media (prefers-reduced-motion: reduce) {
    .panmr-cl-header,
    .panmr-cl-card,
    .panmr-cl-footer {
        animation: none;
    }

    .panmr-cl-btn:hover {
        transform: none;
    }

    .panmr-cl-btn:hover .panmr-cl-btn__icon {
        transform: none;
    }
}