/* =====================================================================
   Limbus Monitoring — Styles v0.1
   Charte : noir (topbar) + jaune Limbus WP (#fbcc05) en accent
            + vert (#10b981) pour les CTA et le statut "santé"
   ===================================================================== */

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: #1f2933;
    background: #f5f7fa;
}

a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }

/* =====================================================================
   Topbar — fond noir, logo Limbus WP intégré
   ===================================================================== */
.topbar {
    background: #fff;
    box-shadow: 0 3px 30px rgba(0,0,0,0.15);
}
.topbar-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    gap: 2rem;
    min-height: 64px;
}
.brand {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    color: #ffffff;
    font-weight: 600;
    font-size: 1rem;
}
.brand:hover { text-decoration: none; }
.brand-logo {
    height: 60px;
    width: auto;
    display: block;
}
.brand-suffix {
    color: #000;
    font-weight: 500;
    font-size: 0.9375rem;
    letter-spacing: 0.04em;
    padding-left: 0.875rem;
    border-left: 1px solid #e4e7eb;
}

.topnav { display: flex; gap: 0.25rem; flex: 1; }
.topnav a {
    color: #1f2933;
    padding: 0.625rem 0.875rem;
    border-radius: 6px;
    font-weight: 500;
    transition: color 0.15s, background 0.15s;
}
.topnav a:hover { text-decoration: none; color: #1f2933; background: #f5f7fa; }
.topnav a.active {
    color: #0a0a0a;
    background: #fbcc05;
}
.topnav a.active:hover { background: #e6b800; color: #0a0a0a; }

.user-menu { display: flex; align-items: center; gap: 1rem; color: #52606d; }
.user-name { font-weight: 500; color: #1f2933; text-decoration: none; padding: 0.4rem 0.625rem; border-radius: 6px; transition: background 0.15s; }
.user-menu .btn-link { color: #52606d; padding: 0.4rem 0; }
.user-menu .btn-link:hover { color: #1f2933; text-decoration: none; }

/* Container */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 2rem 1.5rem 4rem;
}

/* Page header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}
.page-header h1 { margin: 0; font-size: 1.5rem; font-weight: 600; }

/* Stats grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}
.stat-card {
    background: #ffffff;
    border: 1px solid #e4e7eb;
    border-radius: 8px;
    padding: 1.25rem;
}
.stat-card.stat-ok { border-color: #34d399; background: #ecfdf5; }
.stat-card.stat-warning { border-color: #fbbf24; background: #fffbeb; }
.stat-card.stat-critical { border-color: #f87171; background: #fef2f2; }
.stat-card.stat-muted { color: #7b8794; }
.stat-label { font-size: 0.8125rem; color: #52606d; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 0.5rem; }
.stat-value { font-size: 1.875rem; font-weight: 600; line-height: 1; }

/* Panels */
.panel {
    background: #ffffff;
    border: 1px solid #e4e7eb;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}
.panel h2 { margin: 0 0 1rem; font-size: 1.125rem; font-weight: 600; }

/* Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
}
.data-table th, .data-table td {
    padding: 0.75rem 0.625rem;
    text-align: left;
    border-bottom: 1px solid #e4e7eb;
}
.data-table th {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #52606d;
    font-weight: 600;
    background: #f5f7fa;
}
.data-table tr:hover td { background: #f9fafb; }

.kv-table { width: 100%; border-collapse: collapse; }
.kv-table th, .kv-table td { padding: 0.5rem 0.625rem; border-bottom: 1px solid #f0f4f8; text-align: left; }
.kv-table th { width: 200px; color: #52606d; font-weight: 500; }

.meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem 2rem;
    background: #ffffff;
    padding: 1rem 1.25rem;
    border: 1px solid #e4e7eb;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
    color: #52606d;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    background: #e4e7eb;
    color: #52606d;
}
.badge-ok { background: #d1fae5; color: #065f46; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-critical { background: #fee2e2; color: #991b1b; }
.badge-no_data, .badge-muted { background: #e4e7eb; color: #52606d; }

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border: 1px solid #cbd2d9;
    background: #ffffff;
    color: #1f2933;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    font-family: inherit;
}
.btn:hover { background: #f5f7fa; text-decoration: none; }
.btn-primary { background: #10b981; border-color: #10b981; color: white; }
.btn-primary:hover { background: #059669; border-color: #059669; }
.btn-block { display: block; width: 100%; }
.btn-link { color: #2563eb; padding: 0.5rem 0; background: none; border: none; cursor: pointer; }

/* Forms */
.form-card {
    background: #ffffff;
    border: 1px solid #e4e7eb;
    border-radius: 8px;
    padding: 1.5rem;
    max-width: 640px;
}
.form-card label {
    display: block;
    margin-bottom: 1rem;
}
.form-card label > span {
    display: block;
    font-weight: 500;
    margin-bottom: 0.375rem;
    color: #323f4b;
}
.form-card input[type="text"],
.form-card input[type="email"],
.form-card input[type="url"],
.form-card input[type="password"],
.form-card select,
.form-card textarea {
    width: 100%;
    padding: 0.55rem 0.75rem;
    border: 1px solid #cbd2d9;
    border-radius: 6px;
    font-size: 0.9375rem;
    font-family: inherit;
}
.form-card input:focus,
.form-card select:focus,
.form-card textarea:focus {
    outline: none;
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16,185,129,0.15);
}
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 1rem;
    align-items: center;
}

.copy-row input { font-family: ui-monospace, SFMono-Regular, monospace; font-size: 0.8125rem; background: #f5f7fa; }

/* Search bar */
.search-bar {
    display: flex;
    gap: 0.625rem;
    margin-bottom: 1.25rem;
    align-items: center;
}
.search-bar input[type="search"] {
    flex: 1;
    max-width: 420px;
    padding: 0.5rem 0.75rem;
    border: 1px solid #cbd2d9;
    border-radius: 6px;
    font-size: 0.9375rem;
    font-family: inherit;
}

/* Empty state */
.empty-state {
    background: #ffffff;
    border: 1px dashed #cbd2d9;
    border-radius: 8px;
    padding: 3rem 1.5rem;
    text-align: center;
    color: #52606d;
}

/* Flash messages */
.flash {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-bottom: 1.25rem;
    border: 1px solid transparent;
}
.flash-success { background: #ecfdf5; color: #065f46; border-color: #34d399; }
.flash-error { background: #fef2f2; color: #991b1b; border-color: #f87171; }
.flash-info { background: #eff6ff; color: #1e40af; border-color: #60a5fa; }

.alert {
    padding: 1rem 1.25rem;
    border-radius: 8px;
    margin-bottom: 1.25rem;
    border: 1px solid;
}
.alert-warning { background: #fffbeb; color: #92400e; border-color: #fbbf24; }

/* Helpers */
.muted { color: #7b8794; }
.small { font-size: 0.8125rem; }

/* Footer */
.footer {
    text-align: center;
    padding: 2rem;
    color: #7b8794;
    font-size: 0.8125rem;
}

/* =====================================================================
   Page de login — logo intégré
   ===================================================================== */
.login-page {
    background: linear-gradient(135deg, #1a1a1a 0%, #0a0a0a 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.login-card {
    background: #ffffff;
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
    width: 100%;
    max-width: 400px;
    border-top: 4px solid #fbcc05;
}
.login-brand {
    text-align: center;
    margin-bottom: 2rem;
}
.login-logo {
    max-width: 220px;
    width: 100%;
    height: auto;
    display: block;
    margin: 0 auto 0.875rem;
    border-radius: 6px;
}
.login-tagline {
    margin: 0;
    color: #52606d;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-weight: 600;
}

.login-card label > span {
    display: block;
    font-weight: 500;
    margin-bottom: 0.375rem;
    color: #323f4b;
    font-size: 0.875rem;
}
.login-card input {
    width: 100%;
    padding: 0.625rem 0.75rem;
    border: 1px solid #cbd2d9;
    border-radius: 6px;
    font-size: 0.9375rem;
    margin-bottom: 1rem;
    font-family: inherit;
}
.login-card input:focus {
    outline: none;
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16,185,129,0.15);
}
.login-card button { margin-top: 0.5rem; }

/* Responsive */
@media (max-width: 640px) {
    .topbar-inner { flex-wrap: wrap; gap: 1rem; padding: 0.75rem 1rem; }
    .topnav { order: 3; flex-basis: 100%; }
    .brand-suffix { display: none; }
    .container { padding: 1.5rem 1rem 3rem; }
    .page-header { flex-direction: column; align-items: stretch; gap: 0.75rem; }
}

/* =====================================================================
   Lien admin du site (icône favicon cliquable + bouton)
   ===================================================================== */

/* Colonne dédiée dans les tableaux : juste assez large pour l'icône */
.data-table th.col-favicon,
.data-table td.col-favicon {
    width: 44px;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
    text-align: center;
}

/* Variante "icone" (dashboard, liste des sites) */
.favicon-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: 1px solid transparent;
    transition: background 0.15s, border-color 0.15s, transform 0.15s;
    text-decoration: none;
}
.favicon-link:hover {
    background: #f5f7fa;
    border-color: #e4e7eb;
    transform: translateY(-1px);
    text-decoration: none;
}
.favicon-link img {
    width: 18px;
    height: 18px;
    border-radius: 3px;
    object-fit: contain;
    display: block;
}

/* Variante "bouton" (fiche détail) */
.favicon-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.875rem;
    border: 1px solid #cbd2d9;
    border-radius: 6px;
    background: #ffffff;
    color: #1f2933;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s;
}
.favicon-button:hover {
    background: #f5f7fa;
    border-color: #b5bcc4;
    text-decoration: none;
}
.favicon-button img {
    width: 18px;
    height: 18px;
    border-radius: 3px;
    object-fit: contain;
    flex-shrink: 0;
}
.favicon-button .favicon-arrow {
    color: #7b8794;
    font-size: 0.875rem;
    margin-left: 0.125rem;
}

/* Conteneur d'actions dans le page-header de la fiche détail */
.header-actions {
    display: flex;
    gap: 0.625rem;
    align-items: center;
}

/* =====================================================================
   v0.1.2 — Layout des sites (liste + dashboard) + comptes
   ===================================================================== */

/* Hover sur le lien identifiant */
.user-name:hover, .user-name.active { background: #f5f7fa; }

/* Tableau des sites avec layout enrichi */
.sites-table .col-site { padding: 0.875rem 0.625rem; min-width: 320px; }
.site-row {
    display: flex;
    align-items: flex-start;
    gap: 0.875rem;
}
.site-favicon {
    border-radius: 6px;
    object-fit: contain;
    flex-shrink: 0;
    background: #ffffff;
    border: 1px solid #f0f4f8;
}
.site-favicon-sm { width: 24px; height: 24px; }
.site-favicon-md { width: 40px; height: 40px; margin-top: 0.125rem; }
.site-favicon-lg { width: 48px; height: 48px; }

.site-info {
    flex: 1;
    min-width: 0;
}
.site-name {
    font-size: 1.0625rem;
    font-weight: 600;
    color: #1f2933;
    line-height: 1.3;
    display: block;
    margin-bottom: 0.125rem;
    text-decoration: none;
}
.site-name:hover { color: #2563eb; text-decoration: none; }

.site-url {
    color: #7b8794;
    font-size: 0.8125rem;
    margin-bottom: 0.625rem;
    word-break: break-word;
}
.site-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Bouton compact pour les actions site */
.btn-sm {
    padding: 0.3rem 0.625rem;
    font-size: 0.8125rem;
}
.btn-danger {
    background: #ffffff;
    border-color: #fca5a5;
    color: #991b1b;
}
.btn-danger:hover { background: #fef2f2; border-color: #f87171; }

/* Fiche détail : favicon à gauche du nom */
.site-detail-header { align-items: center; }
.site-title {
    display: flex;
    align-items: center;
    gap: 0.875rem;
}
.site-title h1 { margin: 0; }

/* =====================================================================
   Mon compte / Comptes utilisateurs
   ===================================================================== */
.account-grid {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: 1fr 1fr;
    align-items: start;
}
@media (max-width: 880px) {
    .account-grid { grid-template-columns: 1fr; }
}

.form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}
@media (max-width: 540px) {
    .form-grid-2 { grid-template-columns: 1fr; }
}

.actions-cell {
    white-space: nowrap;
    text-align: right;
}
.actions-cell .btn { margin-left: 0.25rem; }

/* Ajustement pour le badge en page-header */
.page-header .badge {
    align-self: center;
    font-size: 0.8125rem;
    padding: 0.3rem 0.75rem;
}
