/* ================================================================
   WRL Portal — Feuille de styles principale
   Architecture : variables CSS → reset → layout → composants
   ================================================================ */

/* ----------------------------------------------------------------
   1. Variables CSS (thèmes dark/light)
   ---------------------------------------------------------------- */
:root {
    /* Couleurs de base (dark mode par défaut) */
    --bg-primary:      #0d1117;
    --bg-secondary:    #161b22;
    --bg-tertiary:     #21262d;
    --bg-hover:        #30363d;

    --border-color:    #30363d;
    --border-muted:    #21262d;

    --text-primary:    #e6edf3;
    --text-secondary:  #8b949e;
    --text-muted:      #6e7681;

    --accent:          #58a6ff;
    --accent-hover:    #79b8ff;
    --accent-muted:    rgba(88, 166, 255, 0.15);

    /* Statuts */
    --status-online:   #3fb950;
    --status-waking:   #d29922;
    --status-offline:  #f85149;
    --status-unknown:  #6e7681;

    /* Boutons d'action */
    --btn-wol:         #d29922;
    --btn-wol-hover:   #e3b341;
    --btn-wol-bg:      rgba(210, 153, 34, 0.15);
    --btn-ttyd:        #a371f7;
    --btn-ttyd-hover:  #c084fc;
    --btn-ttyd-bg:     rgba(163, 113, 247, 0.15);
    --btn-danger:      #f85149;
    --btn-danger-hover:#ff6b6b;
    --btn-danger-bg:   rgba(248, 81, 73, 0.15);

    /* Misc */
    --radius-sm:       4px;
    --radius-md:       8px;
    --radius-lg:       12px;
    --shadow:          0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-sm:       0 2px 8px rgba(0, 0, 0, 0.3);
    --transition:      150ms ease;

    --navbar-height:   56px;
    --font-mono:       'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
}

/* Light mode */
[data-theme="light"] {
    --bg-primary:      #f6f8fa;
    --bg-secondary:    #ffffff;
    --bg-tertiary:     #f3f4f6;
    --bg-hover:        #eaeef2;
    --border-color:    #d0d7de;
    --border-muted:    #e8ecf0;
    --text-primary:    #1f2328;
    --text-secondary:  #57606a;
    --text-muted:      #8c959f;
    --accent:          #0969da;
    --accent-hover:    #0750b5;
    --accent-muted:    rgba(9, 105, 218, 0.1);
    --term-bg:         #24292e;
    --term-text:       #e1e4e8;
    --shadow:          0 8px 32px rgba(0, 0, 0, 0.12);
    --shadow-sm:       0 2px 8px rgba(0, 0, 0, 0.08);
}

/* ----------------------------------------------------------------
   2. Reset & base
   ---------------------------------------------------------------- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 15px;
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    transition: background var(--transition), color var(--transition);
}

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

a:hover {
    color: var(--accent-hover);
}

svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ----------------------------------------------------------------
   3. Layout — Navbar
   ---------------------------------------------------------------- */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--navbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    backdrop-filter: blur(8px);
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.navbar-icon {
    width: 22px;
    height: 22px;
    color: var(--accent);
}

.navbar-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.navbar-user {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    padding: 0.3rem 0.6rem;
    border-radius: var(--radius-sm);
}

/* ----------------------------------------------------------------
   4. Layout — Contenu principal
   ---------------------------------------------------------------- */
.main-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

.page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: 1.75rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.page-subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 0.15rem;
}

/* ----------------------------------------------------------------
   5. Grille des appareils
   ---------------------------------------------------------------- */
.device-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 1.25rem;
}

/* ----------------------------------------------------------------
   6. Carte d'appareil
   ---------------------------------------------------------------- */
.device-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.device-card:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-sm);
}

.device-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
}

.device-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.device-name {
    font-size: 1rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.device-ip {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-family: var(--font-mono);
}

.device-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.device-meta-item {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-family: var(--font-mono);
}

.device-meta-item svg {
    width: 12px;
    height: 12px;
    color: var(--text-muted);
}

.device-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}

/* ----------------------------------------------------------------
   7. Indicateurs de statut
   ---------------------------------------------------------------- */
.device-status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    transition: background-color 0.4s ease;
}

.device-status-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

/* États statut */
.status-online  { background-color: var(--status-online);  color: var(--status-online); }
.status-waking  { background-color: var(--status-waking);  color: var(--status-waking);
                  animation: pulse 1s ease-in-out infinite; }
.status-offline { background-color: var(--status-offline); color: var(--status-offline); }
.status-unknown { background-color: var(--status-unknown); color: var(--status-unknown); }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.4; }
}

/* ----------------------------------------------------------------
   8. Boutons
   ---------------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-decoration: none;
    transition: background var(--transition), color var(--transition),
                box-shadow var(--transition), opacity var(--transition);
    white-space: nowrap;
    line-height: 1;
}

.btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.btn-sm  { padding: 0.35rem 0.75rem; font-size: 0.82rem; }
.btn-xs  { padding: 0.2rem 0.5rem; font-size: 0.75rem; }
.btn-full { width: 100%; }

.btn-icon {
    padding: 0.35rem;
    width: 30px;
    height: 30px;
}

.btn-icon svg { width: 14px; height: 14px; }

/* Primary */
.btn-primary {
    background: var(--accent);
    color: #fff;
}
.btn-primary:hover:not(:disabled) {
    background: var(--accent-hover);
    box-shadow: 0 0 0 3px var(--accent-muted);
}

/* Ghost */
.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}
.btn-ghost:hover:not(:disabled) {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* Danger */
.btn-danger {
    background: var(--btn-danger-bg);
    color: var(--btn-danger);
    border: 1px solid rgba(248, 81, 73, 0.3);
}
.btn-danger:hover:not(:disabled) {
    background: var(--btn-danger);
    color: #fff;
}

/* WoL */
.btn-wol {
    background: var(--btn-wol-bg);
    color: var(--btn-wol);
    border: 1px solid rgba(210, 153, 34, 0.3);
}
.btn-wol:hover:not(:disabled) {
    background: var(--btn-wol);
    color: #fff;
}

/* ttyd */
.btn-ttyd {
    background: var(--btn-ttyd-bg);
    color: var(--btn-ttyd);
    border: 1px solid rgba(163, 113, 247, 0.3);
}
.btn-ttyd:hover:not(:disabled) {
    background: var(--btn-ttyd);
    color: #fff;
}

/* Macro */
.btn-macro {
    background: var(--accent-muted);
    color: var(--accent);
    border: 1px solid rgba(88, 166, 255, 0.3);
}
.btn-macro:hover:not(:disabled) {
    background: var(--accent);
    color: #fff;
}

.btn-macro-quick {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-muted);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
}
.btn-macro-quick:hover:not(:disabled) {
    background: var(--accent-muted);
    color: var(--accent);
    border-color: rgba(88, 166, 255, 0.3);
}

/* Barre de macros rapides */
.macro-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-muted);
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    font-size: 0.7rem;
    font-weight: 700;
    background: var(--accent);
    color: #fff;
    border-radius: 8px;
    margin-left: 2px;
}

/* ----------------------------------------------------------------
   9. Formulaires
   ---------------------------------------------------------------- */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    flex: 1;
}

.form-row {
    display: flex;
    gap: 0.75rem;
}

.form-details {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-top: 0.25rem;
}

.form-details > summary {
    cursor: pointer;
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    user-select: none;
    list-style: none;
}

.form-details > summary::before {
    content: '▶ ';
    font-size: 0.7rem;
}

.form-details[open] > summary::before {
    content: '▼ ';
}

.form-details-body {
    padding: 0.75rem;
    border-top: 1px solid var(--border);
}

label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.required {
    color: var(--btn-danger);
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="email"],
select,
textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
    font-family: inherit;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
    -webkit-appearance: none;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-muted);
}

input::placeholder {
    color: var(--text-muted);
}

select option {
    background: var(--bg-secondary);
}

/* ----------------------------------------------------------------
   10. Alertes
   ---------------------------------------------------------------- */
.alert {
    padding: 0.65rem 0.875rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    line-height: 1.5;
    margin-top: 0.5rem;
}

.alert-error {
    background: var(--btn-danger-bg);
    color: var(--btn-danger);
    border: 1px solid rgba(248, 81, 73, 0.3);
}

.alert-success {
    background: rgba(63, 185, 80, 0.12);
    color: var(--status-online);
    border: 1px solid rgba(63, 185, 80, 0.3);
}

.alert-info {
    background: var(--accent-muted);
    color: var(--accent);
    border: 1px solid rgba(88, 166, 255, 0.3);
}

/* ----------------------------------------------------------------
   11. Modals
   ---------------------------------------------------------------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    padding: 1rem;
    animation: fadeIn 120ms ease;
}

.modal-overlay[hidden] {
    display: none;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 700px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: var(--shadow);
    animation: slideUp 150ms ease;
}

.modal-sm { max-width: 400px; }
.modal-lg { max-width: 720px; }

.term-close-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #555;
    padding: 0.2rem;
    display: flex;
    border-radius: 4px;
    transition: color 0.15s, background 0.15s;
}
.term-close-btn:hover { color: #ccc; background: rgba(255,255,255,0.08); }
.term-close-btn svg { width: 16px; height: 16px; }

@keyframes slideUp {
    from { transform: translateY(12px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.modal-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.modal-header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.modal-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0.25rem;
    border-radius: var(--radius-sm);
    display: flex;
    transition: color var(--transition), background var(--transition);
}

.modal-close:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.modal-close svg { width: 18px; height: 18px; }

.modal form,
.modal-body {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding-top: 0.875rem;
    border-top: 1px solid var(--border-muted);
    margin-top: 0.5rem;
}


/* ----------------------------------------------------------------
   13. Liste de macros (modal)
   ---------------------------------------------------------------- */
.macro-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.macro-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.875rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-muted);
    border-radius: var(--radius-sm);
}

.macro-item-info {
    flex: 1;
    min-width: 0;
}

.macro-item-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
}

.macro-item-cmd {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.divider {
    border: none;
    border-top: 1px solid var(--border-muted);
    margin: 0.5rem 0;
}

/* ----------------------------------------------------------------
   14. Journal d'audit
   ---------------------------------------------------------------- */
.audit-log {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    line-height: 1.6;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-muted);
    border-radius: var(--radius-sm);
    padding: 0.875rem;
    max-height: 400px;
    overflow-y: auto;
}

.audit-log .log-action {
    color: var(--accent);
    font-weight: 600;
}

.audit-log .log-error {
    color: var(--btn-danger);
}

.audit-log .log-success {
    color: var(--status-online);
}

/* ----------------------------------------------------------------
   15. Toasts
   ---------------------------------------------------------------- */
.toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}

.toast {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    max-width: 340px;
    pointer-events: auto;
    box-shadow: var(--shadow);
    animation: toastIn 200ms ease;
    border: 1px solid transparent;
}

.toast-success {
    background: rgba(63, 185, 80, 0.15);
    color: var(--status-online);
    border-color: rgba(63, 185, 80, 0.3);
}

.toast-error {
    background: var(--btn-danger-bg);
    color: var(--btn-danger);
    border-color: rgba(248, 81, 73, 0.3);
}

.toast-info {
    background: var(--accent-muted);
    color: var(--accent);
    border-color: rgba(88, 166, 255, 0.3);
}

@keyframes toastIn {
    from { transform: translateX(20px); opacity: 0; }
    to   { transform: translateX(0);    opacity: 1; }
}

/* ----------------------------------------------------------------
   16. Fenêtre ttyd (iframe terminal)
   ---------------------------------------------------------------- */
.ttyd-overlay {
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.82);
}

.ttyd-window {
    width: 80vw;
    height: 74vh;
    max-width: 1200px;
    display: flex;
    flex-direction: column;
    background: #0e0e0e;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #2a2a2a;
    box-shadow: 0 24px 80px rgba(0,0,0,0.8);
    animation: slideUp 0.15s ease;
}

.ttyd-titlebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 0.875rem;
    height: 44px;
    background: #1c1c1c;
    border-bottom: 1px solid #2a2a2a;
    flex-shrink: 0;
    user-select: none;
    gap: 0.75rem;
}

.ttyd-titlebar-title {
    font-size: 0.82rem;
    color: #aaa;
    font-weight: 600;
    font-family: var(--font-mono);
    flex: 1;
}

.ttyd-titlebar-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Panneau de statut de lancement ttyd (chargement / erreur / prêt) */
.ttyd-status-panel {
    background: #141414;
    border-bottom: 1px solid #2a2a2a;
    padding: 0.75rem 1rem;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.ttyd-status-msg {
    font-size: 0.83rem;
    color: #aaa;
    font-family: var(--font-mono);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ttyd-status-error {
    color: #f97583;
}

.ttyd-launch-btn {
    background: rgba(35, 134, 54, 0.2);
    color: #3fb950;
    border: 1px solid rgba(63, 185, 80, 0.4);
    border-radius: 4px;
    padding: 0.32rem 0.8rem;
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 600;
    font-family: var(--font-mono);
    white-space: nowrap;
    transition: background 0.15s;
}
.ttyd-launch-btn:hover:not(:disabled) { background: rgba(63, 185, 80, 0.3); }
.ttyd-launch-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.ttyd-frame {
    flex: 1;
    width: 100%;
    border: none;
    display: block;
    background: #0e0e0e;
    min-height: 0;
}

/* Mode mixed content (HTTPS→HTTP) : l'iframe est inutilisable, on affiche juste le statut */
.ttyd-window--compact {
    width: 420px;
    max-width: 95vw;
    height: auto;
    min-height: 0;
}
.ttyd-window--compact .ttyd-frame { display: none; }
.ttyd-window--compact .ttyd-status-panel { min-height: 72px; }

@media (max-width: 600px) {
    .ttyd-window { width: 99vw; height: 90vh; border-radius: 4px; }
}

/* ----------------------------------------------------------------
   17. Page de connexion
   ---------------------------------------------------------------- */
.login-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    background: var(--bg-primary);
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.875rem;
}

.login-card {
    width: 100%;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    box-shadow: var(--shadow);
}

.login-logo {
    display: flex;
    justify-content: center;
    color: var(--accent);
}

.login-logo svg {
    width: 48px;
    height: 48px;
}

.login-card h1 {
    text-align: center;
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.login-subtitle {
    text-align: center;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: -0.75rem;
}

.login-card form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.btn-full {
    width: 100%;
    margin-top: 0.25rem;
}

.login-footer {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-align: center;
}

.ban-countdown {
    margin-top: 0.3rem;
    font-size: 0.8rem;
    opacity: 0.85;
}

/* ----------------------------------------------------------------
   17. État vide
   ---------------------------------------------------------------- */
.empty-state {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 4rem 2rem;
    color: var(--text-muted);
    text-align: center;
}

.empty-state svg {
    width: 56px;
    height: 56px;
    opacity: 0.3;
}

.empty-state h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.empty-state p {
    font-size: 0.875rem;
}

/* ----------------------------------------------------------------
   18. Utilitaires
   ---------------------------------------------------------------- */
.text-muted { color: var(--text-muted); font-size: 0.85rem; }

/* Spinner de chargement inline */
.spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* Thème toggle */
[data-theme="dark"]  .icon-moon { display: none; }
[data-theme="light"] .icon-sun  { display: none; }

/* ----------------------------------------------------------------
   19. Responsive
   ---------------------------------------------------------------- */
@media (max-width: 640px) {
    .main-content { padding: 1rem; }
    .navbar { padding: 0 1rem; }
    .navbar-brand { font-size: 1rem; }
    .navbar-user  { display: none; }

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

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .form-row {
        flex-direction: column;
    }

    .modal { max-width: 100%; border-radius: var(--radius-md) var(--radius-md) 0 0; }
    .modal-overlay { align-items: flex-end; }
}

@media (max-width: 480px) {
    .device-actions { gap: 0.3rem; }
    .btn-sm { padding: 0.3rem 0.6rem; font-size: 0.78rem; }
}
