/* ============================================================
   Microsoft 365 SSO button — embedded inside GLPI login page.
   GLPI core CSS can be aggressive, so we use !important and
   high-specificity resets to keep our button looking right.
   ============================================================ */

/* Container that wraps the divider + button */
.mssso-login-container {
    clear: both !important;
    display: block !important;
    width: 100% !important;
    margin: 18px 0 8px 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
    text-align: center !important;
    float: none !important;
}

/* "OR" divider line */
.mssso-divider {
    display: flex !important;
    align-items: center !important;
    text-align: center !important;
    margin: 14px 0 !important;
    padding: 0 !important;
    color: #6b7280 !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    letter-spacing: 1.2px !important;
    line-height: 1 !important;
}

.mssso-divider::before,
.mssso-divider::after {
    content: "" !important;
    flex: 1 1 auto !important;
    height: 1px !important;
    background: #d1d5db !important;
    display: block !important;
}

.mssso-divider span {
    padding: 0 12px !important;
    flex: 0 0 auto !important;
    display: inline-block !important;
}

/* The button itself — designed to look like Microsoft's official button */
.mssso-btn,
a.mssso-btn,
a.mssso-btn:link,
a.mssso-btn:visited,
a.mssso-btn:hover,
a.mssso-btn:active,
a.mssso-btn:focus {
    /* Reset everything GLPI might have set on <a> */
    all: revert-layer;

    /* Force our layout — compact and centered like Microsoft's official button */
    display: inline-flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 10px !important;
    width: auto !important;
    max-width: 280px !important;
    box-sizing: border-box !important;
    margin: 0 auto !important;

    /* Microsoft's official look: white card, subtle border */
    background-color: #ffffff !important;
    color: #1f2937 !important;
    border: 1px solid #d1d5db !important;
    border-radius: 6px !important;
    padding: 10px 16px !important;
    margin: 0 !important;

    /* Typography */
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "Helvetica Neue", Arial, sans-serif !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    line-height: 1.4 !important;
    text-decoration: none !important;
    text-align: center !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    white-space: nowrap !important;

    /* Interactive */
    cursor: pointer !important;
    user-select: none !important;
    -webkit-user-select: none !important;
    transition: background-color 0.15s ease, border-color 0.15s ease,
                color 0.15s ease, box-shadow 0.15s ease !important;

    /* Make sure it sits below the form, not beside it */
    float: none !important;
    clear: both !important;
    position: relative !important;
    overflow: visible !important;
    outline: none !important;

    /* Subtle shadow like Microsoft's official button */
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) !important;
}

/* Hover state */
.mssso-btn:hover,
a.mssso-btn:hover {
    background-color: #f9fafb !important;
    border-color: #9ca3af !important;
    color: #111827 !important;
    text-decoration: none !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08) !important;
}

/* Active/pressed state */
.mssso-btn:active,
a.mssso-btn:active {
    background-color: #f3f4f6 !important;
    border-color: #6b7280 !important;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.06) !important;
    transform: translateY(0) !important;
}

/* Focus ring for accessibility */
.mssso-btn:focus-visible,
a.mssso-btn:focus-visible {
    outline: 2px solid #2563eb !important;
    outline-offset: 2px !important;
    border-color: #2563eb !important;
}

/* The Microsoft logo icon — explicitly small */
.mssso-icon,
.mssso-btn .mssso-icon,
.mssso-btn svg {
    width: 18px !important;
    height: 18px !important;
    min-width: 18px !important;
    min-height: 18px !important;
    max-width: 18px !important;
    max-height: 18px !important;
    flex: 0 0 18px !important;
    display: inline-block !important;
    margin: 0 !important;
    padding: 0 !important;
    vertical-align: middle !important;
    fill: currentColor !important;
    pointer-events: none !important;
}

/* The text label inside the button */
.mssso-btn span,
.mssso-btn > span {
    display: inline-block !important;
    color: inherit !important;
    font: inherit !important;
    margin: 0 !important;
    padding: 0 !important;
    flex: 0 1 auto !important;
    text-align: left !important;
    vertical-align: middle !important;
    line-height: 1.4 !important;
}

/* ============================================================
   Dark theme — GLPI supports a dark mode via body.dark
   ============================================================ */
body.dark .mssso-btn,
body.dark a.mssso-btn,
body[data-theme="dark"] .mssso-btn,
html[data-theme="dark"] .mssso-btn {
    background-color: #2d2d2d !important;
    color: #f3f4f6 !important;
    border-color: #4b5563 !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3) !important;
}

body.dark .mssso-btn:hover,
body[data-theme="dark"] .mssso-btn:hover,
html[data-theme="dark"] .mssso-btn:hover {
    background-color: #374151 !important;
    border-color: #6b7280 !important;
    color: #ffffff !important;
}

body.dark .mssso-divider,
body[data-theme="dark"] .mssso-divider,
html[data-theme="dark"] .mssso-divider {
    color: #9ca3af !important;
}

body.dark .mssso-divider::before,
body.dark .mssso-divider::after,
body[data-theme="dark"] .mssso-divider::before,
body[data-theme="dark"] .mssso-divider::after,
html[data-theme="dark"] .mssso-divider::before,
html[data-theme="dark"] .mssso-divider::after {
    background: #4b5563 !important;
}

/* ============================================================
   RTL / small screens
   On mobile, make the button full-width for better touch target
   ============================================================ */
@media (max-width: 480px) {
    .mssso-btn,
    a.mssso-btn {
        font-size: 13px !important;
        padding: 11px 12px !important;
        gap: 8px !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    .mssso-icon,
    .mssso-btn .mssso-icon,
    .mssso-btn svg {
        width: 16px !important;
        height: 16px !important;
        min-width: 16px !important;
        min-height: 16px !important;
        max-width: 16px !important;
        max-height: 16px !important;
        flex: 0 0 16px !important;
    }
}
