* {
    box-sizing: border-box;
}

:root {
    --blue: #1769d2;
    --dark-blue: #104ba0;
    --light-blue: #edf5ff;
    --white: #ffffff;
    --text: #20334d;
}

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: Arial, sans-serif;
    background: var(--light-blue);
    color: var(--text);
}

.header {
    padding: 20px 5%;
    background: linear-gradient(135deg, #104ba0, #2789ef);
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    box-shadow: 0 5px 25px #1769d233;
}

.brand,
.user-menu {
    display: flex;
    align-items: center;
    gap: 15px;
}

.brand strong {
    font-size: 21px;
}

.brand small {
    display: block;
    margin-top: 5px;
    opacity: .85;
}

.logo {
    font-size: 32px;
}

.container {
    width: 92%;
    max-width: 1250px;
    margin: 45px auto;
    flex: 1;
}

h1, h2, h3 {
    color: var(--blue);
}

.welcome {
    text-align: center;
    margin-bottom: 35px;
}

.stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 22px;
    margin-bottom: 40px;
}

.stat-card,
.platform-card,
.login-card {
    background: white;
    border: 1px solid #dceaff;
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 10px 30px #1769d210;
}

.stat-card {
    text-align: center;
}

.stat-card strong {
    display: block;
    font-size: 36px;
    color: var(--blue);
    margin-top: 14px;
}

.section-heading {
    text-align: center;
}

.platform-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 25px;
}

.platform-card {
    text-align: center;
    transition: transform .25s, box-shadow .25s;
}

.platform-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px #1769d225;
}

.platform-card[hidden] {
    display: none;
}

.platform-icon {
    width: 65px;
    height: 65px;
    margin: auto;
    border-radius: 18px;
    background: linear-gradient(135deg, #1769d2, #62baff);
    color: white;
    display: grid;
    place-items: center;
    font-size: 30px;
    font-weight: bold;
}

.status {
    color: #16834b;
    font-size: 13px;
    font-weight: bold;
}

.account-count {
    margin: 18px 0;
    color: #64748b;
}

.btn {
    position: relative;
    overflow: hidden;
    display: inline-block;
    border: 0;
    border-radius: 10px;
    padding: 13px 24px;
    background: linear-gradient(135deg, #1769d2, #3299ff);
    color: white;
    text-decoration: none;
    cursor: pointer;
    font-weight: bold;
    box-shadow: 0 4px 15px #1769d233;
}

.btn::after {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 60%;
    height: 100%;
    background: linear-gradient(90deg, transparent, #ffffff55, transparent);
    transform: skewX(-25deg);
    animation: shine 4s infinite;
    pointer-events: none;
}

@keyframes shine {
    0%, 45% { left: -100%; }
    80%, 100% { left: 150%; }
}

.btn-white {
    background: white;
    color: var(--blue);
}

input {
    width: 100%;
    padding: 14px;
    border: 1px solid #c6dcf5;
    border-radius: 10px;
    font-size: 15px;
    background: white;
}

input:focus {
    outline: 2px solid #1769d2;
}

.search {
    display: block;
    max-width: 550px;
    margin: 0 auto 30px;
}

.login-wrapper {
    min-height: 60vh;
    display: grid;
    place-items: center;
}

.login-card {
    width: 100%;
    max-width: 440px;
    padding: 35px;
    text-align: center;
}

.login-icon {
    font-size: 42px;
}

.login-card label {
    display: block;
    margin: 20px 0 8px;
    text-align: left;
    font-weight: bold;
}

.full-width {
    width: 100%;
    margin-top: 25px;
}

.alert {
    padding: 15px;
    background: #fff0f0;
    color: #b91c1c;
    border-radius: 10px;
    margin: 20px 0;
}

footer {
    padding: 20px;
    background: var(--blue);
    color: white;
    text-align: center;
}

@media (max-width: 650px) {
    .header,
    .user-menu {
        flex-wrap: wrap;
    }

    .stats {
        grid-template-columns: 1fr;
    }

    .brand strong {
        font-size: 17px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::after {
        animation: none !important;
        transition: none !important;
    }
}

.section-heading .btn {
    margin-bottom: 25px;
}

.card-actions,
.modal-actions {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 20px;
}

.btn-secondary {
    background: #e5efff;
    color: #1769d2;
}

.btn-danger {
    background: linear-gradient(135deg, #dc2626, #ef4444);
    box-shadow: 0 4px 15px #dc262633;
}

.modal {
    border: 1px solid #dceaff;
    border-radius: 22px;
    padding: 30px;
    width: min(500px, 90vw);
    color: var(--text);
    box-shadow: 0 20px 70px #00000025;
}

.modal[open] {
    animation: modal-entry .25s ease-out;
}

.modal::backdrop {
    background: #102b5080;
    backdrop-filter: blur(5px);
}

.modal h2 {
    text-align: center;
    margin-top: 0;
}

.modal label {
    display: block;
    font-weight: bold;
    margin: 18px 0 8px;
}

.modal textarea {
    width: 100%;
    min-height: 100px;
    padding: 14px;
    border: 1px solid #c6dcf5;
    border-radius: 10px;
    font: inherit;
    resize: vertical;
}

.alert-success {
    padding: 16px;
    margin-bottom: 25px;
    border-radius: 12px;
    background: #e8f8ef;
    color: #16834b;
    text-align: center;
}

@keyframes modal-entry {
    from {
        opacity: 0;
        transform: translateY(15px) scale(.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@media (prefers-reduced-motion: reduce) {
    .modal[open] {
        animation: none;
    }
}

.btn-manage {
    display: block;
    margin: 15px auto 0;
}

.secret-field {
    background: #edf5ff;
    border: 1px solid #dceaff;
    border-radius: 12px;
    padding: 15px;
    margin: 15px 0;
    text-align: left;
}

.secret-field label {
    display: block;
    color: #1769d2;
    font-weight: bold;
    font-size: 13px;
    margin-bottom: 8px;
}

.secret-field span {
    color: #64748b;
    overflow-wrap: anywhere;
}

.empty-state {
    grid-column: 1 / -1;
    padding: 45px;
    text-align: center;
    background: white;
    border: 2px dashed #c6dcf5;
    border-radius: 20px;
}

.stat-card .stat-secure {
    font-size: 25px;
    color: #16834b;
}

#copy-message {
    color: #16834b;
    font-weight: bold;
}

.navigation {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 15px;
    padding: 18px;
    background: white;
    border-bottom: 1px solid #dceaff;
}

.navigation a {
    padding: 12px 22px;
    border-radius: 10px;
    text-decoration: none;
    color: #1769d2;
    font-weight: bold;
    transition: background .2s;
}

.navigation a:hover {
    background: #edf5ff;
}

.navigation a.active {
    color: white;
    background: linear-gradient(135deg, #1769d2, #3299ff);
    box-shadow: 0 4px 15px #1769d233;
}

.history-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
    margin-bottom: 25px;
}

.history-filters input {
    flex: 1;
    min-width: 230px;
}

.history-filters select {
    padding: 13px;
    border: 1px solid #c6dcf5;
    border-radius: 10px;
    background: white;
    color: var(--text);
    font: inherit;
}

.history-container {
    overflow-x: auto;
    background: white;
    border-radius: 18px;
    border: 1px solid #dceaff;
    box-shadow: 0 10px 30px #1769d210;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.history-table th {
    background: #1769d2;
    color: white;
    padding: 18px;
    text-align: center;
}

.history-table td {
    padding: 18px;
    text-align: center;
    border-bottom: 1px solid #edf5ff;
}

.history-table tbody tr:hover {
    background: #f5f9ff;
}

.history-badge {
    display: inline-block;
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
}

.history-success {
    color: #16834b;
    background: #e5f7ed;
}

.history-danger {
    color: #c62828;
    background: #ffe9e9;
}

.stat-card .stat-danger {
    color: #dc2626;
}

.history-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    margin-top: 25px;
}

.role-badge {
    display: inline-block;
    background: #edf5ff;
    color: #1769d2;
    padding: 9px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: bold;
}

.user-email {
    overflow-wrap: anywhere;
}

.permission-container {
    max-width: 850px;
    margin: 30px auto;
    padding: 30px;
    background: white;
    border: 1px solid #dceaff;
    border-radius: 22px;
    box-shadow: 0 10px 30px #1769d210;
}

.permission-container h2,
.permission-container > p {
    text-align: center;
}

.permission-container h3 {
    margin-top: 30px;
    padding-bottom: 12px;
    border-bottom: 1px solid #dceaff;
}

.permission-row {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 20px;
    margin: 12px 0;
    background: #f5f9ff;
    border: 1px solid #dceaff;
    border-radius: 12px;
    cursor: pointer;
    transition: background .2s;
}

.permission-row:hover {
    background: #e5efff;
}

.permission-row input[type="checkbox"] {
    width: 22px;
    height: 22px;
    accent-color: #1769d2;
    cursor: pointer;
    flex-shrink: 0;
}

.permission-row small {
    display: block;
    color: #64748b;
    margin-top: 6px;
}

.permission-row:has(input:checked) {
    background: #e8f2ff;
    border-color: #1769d2;
}

.stat-card .stat-secure {
    font-size: 36px;
}

.header {
    flex-wrap: wrap;
}

.user-menu {
    flex-wrap: wrap;
}

.btn-reactiver {
    background: linear-gradient(135deg, #15803d, #22c55e);
    box-shadow: 0 4px 15px #15803d33;
}

.status-form {
    margin-top: 10px;
}

.user-management-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
}

.user-management-actions .btn {
    width: 100%;
}

.btn-session {
    background: linear-gradient(135deg, #475569, #64748b);
    box-shadow: 0 4px 15px #47556933;
}

.modal p {
    text-align: center;
    line-height: 1.6;
}

.modal input {
    margin-bottom: 8px;
}

.a2f-user-status {
    display: flex;
    justify-content: center;
    margin: 12px 0;
}

.a2f-status-active,
.a2f-status-inactive {
    display: inline-flex;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

.a2f-status-active {
    color: #15803d;
    background: #dcfce7;
    border: 1px solid #86efac;
}

.a2f-status-inactive {
    color: #b45309;
    background: #fff7ed;
    border: 1px solid #fed7aa;
}

.btn-a2f-reset {
    background: linear-gradient(135deg, #d97706, #f59e0b);
    color: white;
    width: 100%;
    box-shadow: 0 5px 18px #d9770633;
}

.a2f-reset-warning {
    margin: 15px 0;
    padding: 14px;
    border-radius: 12px;
    background: #fff7ed;
    color: #92400e;
    text-align: center;
    line-height: 1.5;
}

.ouvrir-site-form {
    width: 100%;
    margin-top: 12px;
}

.btn-ouvrir-site {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 13px 18px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #1769d2, #3195ff);
    color: white;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 5px 18px #1769d233;
    transition: transform .2s ease, box-shadow .2s ease;
}

.btn-ouvrir-site:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px #1769d244;
}

.btn-ouvrir-site::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(
        110deg,
        transparent 30%,
        #ffffff55 50%,
        transparent 70%
    );
    transform: translateX(-100%);
    animation: ouverture-shine 3s infinite;
    pointer-events: none;
}

@keyframes ouverture-shine {
    0% { transform: translateX(-100%); }
    55%, 100% { transform: translateX(100%); }
}

@media (prefers-reduced-motion: reduce) {
    .btn-ouvrir-site::after {
        animation: none;
    }
}

#login-security-panel[hidden],
#login-countdown[hidden] {
    display: none !important;
}

#login-security-panel {
    padding: 16px;
    margin: 18px 0;
    border-radius: 12px;
    background: #edf5ff;
    color: #1769d2;
    text-align: center;
}

#login-security-panel.login-blocked {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
}

.login-attempts {
    display: flex;
    gap: 6px;
    margin: 15px 0;
}

.login-attempt-bar {
    flex: 1;
    height: 7px;
    border-radius: 10px;
    background: #1769d2;
    transition: background .3s ease;
}

.login-attempt-bar.attempt-used {
    background: #dc2626;
}

#login-countdown {
    font-size: 36px;
    font-weight: bold;
    font-variant-numeric: tabular-nums;
    margin: 12px 0;
}

#login-security-message {
    font-size: 14px;
    font-weight: 600;
}

form[data-login-security] input:disabled {
    background: #f1f5f9;
    cursor: not-allowed;
    opacity: .7;
}

form[data-login-security] button:disabled {
    background: #94a3b8 !important;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

form[data-login-security] button:disabled::after {
    animation: none;
    display: none;
}

.login-card:has(#login-security-panel.login-blocked) .login-icon {
    filter: grayscale(1) sepia(1) saturate(8) hue-rotate(315deg);
    animation: login-lock-pulse 1.8s ease-in-out infinite;
}

@keyframes login-lock-pulse {
    0%, 100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.12);
    }
}

@media (prefers-reduced-motion: reduce) {
    .login-card:has(#login-security-panel.login-blocked) .login-icon {
        animation: none;
    }
}
