/* =============================================================================
   INDPNS CLOUD — app.css  (thème Google Cloud / Material)
   Styles PARTAGÉS : barre du haut + barre latérale + zone de contenu.
   Les pages enfants utilisent ces variables ; modifier ici = tout le site.
   ============================================================================= */

:root {
    /* Surfaces */
    --bg: #ffffff;
    --bg-card: #ffffff;
    --bg-page: #f8f9fa;
    --surface: #f8f9fa;
    --surface-hover: #f1f3f4;
    /* Bordures */
    --border: #dadce0;
    --border-focus: #1a73e8;
    --border-hover: #bdc1c6;
    /* Texte */
    --text: #202124;
    --text-secondary: #5f6368;
    --text-muted: #80868b;
    /* Accent Google Blue */
    --blue: #1a73e8;
    --blue-hover: #1765cc;
    --blue-dark: #174ea6;
    --blue-soft: #e8f0fe;
    /* États */
    --error: #d93025;
    --error-bg: #fce8e6;
    --warning: #b06000;
    --warning-bg: #fef7e0;
    --success: #188038;
    --success-bg: #e6f4ea;
    /* Formes */
    --radius: 4px;
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 8px;
    --radius-xl: 12px;
    --shadow-sm: 0 1px 2px rgba(60,64,67,.3), 0 1px 3px 1px rgba(60,64,67,.15);
    --shadow-md: 0 1px 3px rgba(60,64,67,.3), 0 4px 8px 3px rgba(60,64,67,.15);
    --shadow-lg: 0 4px 12px rgba(60,64,67,.2), 0 8px 24px 6px rgba(60,64,67,.12);
    --transition-fast: .15s ease;
    --transition-base: .25s ease;
    --font: 'Google Sans', 'Google Sans Text', Roboto, Arial, sans-serif;
    --mono: 'Roboto Mono', 'JetBrains Mono', ui-monospace, Menlo, monospace;
    --sidebar-width: 256px;
    --topbar-h: 56px;

    /* Alias hérités (pages à variables --color-*) */
    --color-primary: #1a73e8;
    --color-primary-dark: #1765cc;
    --color-primary-light: #669df6;
    --color-bg: #f8f9fa;
    --color-surface: #ffffff;
    --color-surface-hover: #f1f3f4;
    --color-text: #202124;
    --color-text-muted: #5f6368;
    --color-text-light: #80868b;
    --color-border: #dadce0;
    --color-border-dark: #bdc1c6;
    --color-error: #d93025;
    --color-error-bg: #fce8e6;
    --color-success: #188038;
    --color-success-bg: #e6f4ea;
    --color-warning: #b06000;
    --color-warning-bg: #fef7e0;
    --color-info: #1a73e8;
    --color-info-bg: #e8f0fe;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; overflow-x: hidden; }
html { scroll-behavior: smooth; }

body {
    font-family: var(--font);
    background: var(--bg-page);
    color: var(--text);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    line-height: 1.5;
    font-size: 14px;
}
body.sidebar-locked { overflow: hidden; }
a { color: var(--blue); }
code, pre, kbd { font-family: var(--mono); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
    outline: 2px solid var(--blue); outline-offset: 2px;
}

/* Barre de progression */
.nav-progress { position: fixed; top: 0; left: 0; height: 3px; width: 0; background: var(--blue);
    z-index: 1000; opacity: 0; pointer-events: none; transition: width .4s ease, opacity .25s ease; }
.nav-progress.active { opacity: 1; width: 75%; transition: width 8s cubic-bezier(.1,.7,.2,1); }
.nav-progress.done { opacity: 0; width: 100%; transition: width .2s ease, opacity .4s ease .1s; }

/* ------------------------------ TOP BAR ---------------------------------- */
.top-bar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    height: var(--topbar-h); padding: 0 16px;
    background: #fff; border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 100;
}
.top-bar-left { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 0 0 auto; }

.top-bar-menu-btn, .top-bar-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    width: 40px; height: 40px; border: 0; background: transparent; color: var(--text-secondary);
    border-radius: 50%; cursor: pointer; text-decoration: none; font: 500 14px var(--font);
    transition: background var(--transition-fast), color var(--transition-fast); flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
}
.top-bar-menu-btn:hover, .top-bar-btn:hover { background: var(--surface-hover); color: var(--text); }
.top-bar-menu-btn svg, .top-bar-btn svg { width: 20px; height: 20px; }
.top-bar-btn span { display: none; }
.top-bar-btn.dev:hover, .top-bar-btn.admin:hover { color: var(--blue); background: var(--blue-soft); }
.top-bar-btn.logout:hover { color: var(--error); background: var(--error-bg); }
.top-bar-btn.primary, .top-bar-btn.text { width: auto; padding: 0 16px; border-radius: 4px; height: 36px; }
.top-bar-btn.primary { background: var(--blue); color: #fff; }
.top-bar-btn.primary:hover { background: var(--blue-hover); color: #fff; }
.top-bar-btn.text { color: var(--blue); }
.top-bar-btn.text:hover { background: var(--blue-soft); color: var(--blue-dark); }
.top-bar-btn.text span, .top-bar-btn.primary span { display: inline; }

.top-bar-brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text-secondary);
    font-size: 20px; letter-spacing: -.1px; white-space: nowrap; padding: 0 4px; }
.top-bar-brand b { color: var(--text); font-weight: 500; }
.top-bar-brand .brand-logo { width: 28px; height: 28px; flex-shrink: 0; }

.top-bar-search { flex: 1; max-width: 640px; height: 40px; margin: 0 24px; background: #f1f3f4; border-radius: 8px;
    display: flex; align-items: center; gap: 12px; padding: 0 14px; color: var(--text-secondary); }
.top-bar-search:focus-within { background: #fff; box-shadow: var(--shadow-sm); }
.top-bar-search svg { width: 18px; height: 18px; flex-shrink: 0; }
.top-bar-search input { flex: 1; min-width: 0; border: 0; background: transparent; font: 14px var(--font); color: var(--text); outline: none; }
.top-bar-search kbd { font-size: 11px; background: #fff; border: 1px solid var(--border); border-radius: 4px; padding: 1px 6px; }

.top-bar-actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.top-bar-user { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%;
    text-decoration: none; flex-shrink: 0; }
.top-bar-user:hover { background: var(--surface-hover); }
.top-bar-user-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--blue); color: #fff;
    display: flex; align-items: center; justify-content: center; font-weight: 500; font-size: 14px; overflow: hidden; }
.top-bar-user-avatar img { width: 100%; height: 100%; object-fit: cover; }
.top-bar-user-name { display: none; }

/* ------------------------------ LAYOUT ----------------------------------- */
.account-layout { display: flex; align-items: flex-start; min-height: calc(100vh - var(--topbar-h)); }
.sidebar-overlay { display: none; position: fixed; inset: var(--topbar-h) 0 0 0; background: rgba(32,33,36,.5);
    z-index: 90; opacity: 0; transition: opacity .25s ease; }
.sidebar-overlay.active { display: block; opacity: 1; }

/* ------------------------------ SIDEBAR ---------------------------------- */
.account-sidebar {
    width: var(--sidebar-width); flex-shrink: 0; background: #fff; border-right: 1px solid var(--border);
    padding: 8px 0 24px; position: sticky; top: var(--topbar-h); height: calc(100vh - var(--topbar-h));
    height: calc(100dvh - var(--topbar-h)); overflow-y: auto; overscroll-behavior: contain;
    scrollbar-width: thin; scrollbar-color: var(--border) transparent;
    transition: transform .25s ease, margin-left .25s ease; z-index: 1;
}
.account-sidebar::-webkit-scrollbar { width: 6px; }
.account-sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
@media (min-width: 901px) { body.sidebar-collapsed .account-sidebar { margin-left: calc(var(--sidebar-width) * -1); } }

.account-sidebar-header { display: flex; align-items: center; gap: 12px; margin: 8px 12px 8px; padding: 12px;
    border: 1px solid var(--border); border-radius: 8px; text-decoration: none; }
.account-sidebar-header:hover { background: var(--surface); }
.account-sidebar-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--blue); color: #fff;
    display: flex; align-items: center; justify-content: center; font-weight: 500; font-size: 16px; flex-shrink: 0; overflow: hidden; }
.account-sidebar-avatar img { width: 100%; height: 100%; object-fit: cover; }
.account-sidebar-user { flex: 1; min-width: 0; }
.account-sidebar-name { font-weight: 500; font-size: 13px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.account-sidebar-email { font-size: 12px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.account-nav { display: flex; flex-direction: column; gap: 0; padding-right: 12px; }
.account-nav-section-label { font-size: 11px; font-weight: 500; color: var(--text-muted); text-transform: uppercase;
    letter-spacing: .8px; padding: 18px 24px 6px; }
.account-nav-item { display: flex; align-items: center; gap: 16px; height: 40px; padding: 0 16px 0 24px;
    border-radius: 0 20px 20px 0; font-size: 14px; font-weight: 500; color: #3c4043; text-decoration: none;
    transition: background var(--transition-fast); cursor: pointer; position: relative; -webkit-tap-highlight-color: transparent; }
.account-nav-item:hover { background: var(--surface-hover); color: var(--text); }
.account-nav-item.active { background: var(--blue-soft); color: var(--blue-dark); font-weight: 600; }
.account-nav-item svg { width: 20px; height: 20px; flex-shrink: 0; }
.account-nav-item.danger { color: var(--error); }
.account-nav-item.danger:hover { background: var(--error-bg); }
.account-nav-badge { margin-left: auto; font-size: 10px; font-weight: 600; padding: 2px 8px; border-radius: 12px;
    background: var(--warning-bg); color: var(--warning); text-transform: uppercase; letter-spacing: .4px; }
.account-nav-badge.new { background: var(--blue-soft); color: var(--blue-dark); }
.account-nav-divider { height: 1px; background: var(--border); margin: 12px 0; }

/* ------------------------------ CONTENU ---------------------------------- */
.account-main { flex: 1; padding: 32px 40px 60px; min-width: 0; max-width: 1000px; animation: pageIn .25s ease both; }
.account-main.wide { max-width: 1280px; }
.account-main.full { max-width: none; }
@keyframes pageIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.account-main-header { margin-bottom: 28px; }
.account-main-title { font-size: 28px; font-weight: 400; color: var(--text); margin-bottom: 8px; letter-spacing: -.2px; }
.account-main-subtitle { font-size: 14px; color: var(--text-secondary); line-height: 1.5; }

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .account-main, .account-sidebar, .sidebar-overlay, .nav-progress { animation: none !important; transition: none !important; }
}

/* ----------- Composants communs (boutons / cartes / formulaires) --------- */
.btn, .btn-primary, .btn-secondary, .btn-danger { font-family: var(--font); }
.btn-primary, .btn.primary { background: var(--blue); color: #fff; border: 1px solid var(--blue); border-radius: 4px; font-weight: 500; }
.btn-primary:hover, .btn.primary:hover { background: var(--blue-hover); border-color: var(--blue-hover); }
.btn-secondary { background: #fff; color: var(--blue); border: 1px solid var(--border); border-radius: 4px; font-weight: 500; }
.btn-secondary:hover { background: var(--blue-soft); }
.btn-danger { background: #fff; color: var(--error); border: 1px solid var(--border); border-radius: 4px; }
.btn-danger:hover { background: var(--error-bg); }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=number], input[type=search], select, textarea {
    font-family: var(--font); color: var(--text); }

/* ------------------------------ RESPONSIVE ------------------------------- */
@media (max-width: 900px) {
    .account-layout { position: relative; }
    .top-bar-search { display: none; }
    .account-sidebar { position: fixed; top: var(--topbar-h); left: 0; bottom: 0; height: auto; transform: translateX(-100%);
        box-shadow: var(--shadow-lg); width: min(300px, 86vw); z-index: 95; visibility: hidden;
        transition: transform .25s ease, visibility 0s linear .25s; }
    .account-sidebar.open { transform: translateX(0); visibility: visible; transition: transform .25s ease; }
    .account-main { padding: 24px 16px 40px; }
}
@media (max-width: 480px) {
    .top-bar { padding: 0 8px; }
    .top-bar-brand { font-size: 17px; }
    .account-main-title { font-size: 22px; }
}
