@import url('https://api.fontshare.com/v2/css?f[]=satoshi@400,500,700&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --color-primary: #01696f;
    --color-primary-hover: #0c4e54;
    --color-bg: #f7f6f2;
    --color-surface: #ffffff;
    --color-border: #dcd9d5;
    --color-text: #28251d;
    --color-text-muted: #7a7974;
    --color-error: #a12c7b;
    --color-success: #437a22;
    --radius: 0.625rem;
    --shadow: 0 2px 12px rgba(0,0,0,0.08);
    --font: 'Satoshi', 'Helvetica Neue', sans-serif;
}

body {
    font-family: var(--font);
    font-size: 1rem;
    color: var(--color-text);
    background: var(--color-bg);
    min-height: 100dvh;
    -webkit-font-smoothing: antialiased;
}

/* ── AUTH ── */
.auth-container {
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}
.auth-card {
    background: var(--color-surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 420px;
}
.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}
.logo h1 { font-size: 1.75rem; font-weight: 700; color: var(--color-primary); }
.auth-card h2 { font-size: 1.25rem; margin-bottom: 1.5rem; }

.form-group { margin-bottom: 1.25rem; }
.form-group label { display: block; font-size: 0.875rem; font-weight: 500; margin-bottom: 0.4rem; }
.form-group input {
    width: 100%; padding: 0.65rem 0.875rem;
    border: 1px solid var(--color-border);
    border-radius: 0.5rem; font-size: 1rem;
    background: var(--color-bg);
    transition: border-color 180ms ease, box-shadow 180ms ease;
}
.form-group input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(1,105,111,0.15);
}

.btn-primary {
    width: 100%; padding: 0.75rem;
    background: var(--color-primary); color: #fff;
    border: none; border-radius: 0.5rem;
    font-size: 1rem; font-weight: 600; cursor: pointer;
    transition: background 180ms ease;
    margin-top: 0.5rem;
}
.btn-primary:hover { background: var(--color-primary-hover); }

.alert { padding: 0.75rem 1rem; border-radius: 0.5rem; margin-bottom: 1rem; font-size: 0.9rem; }
.alert-error { background: #fdf0f7; color: var(--color-error); border: 1px solid #e8c8dc; }
.alert-success { background: #f0f7ec; color: var(--color-success); border: 1px solid #c8dcc0; }
.auth-link { text-align: center; margin-top: 1.25rem; font-size: 0.9rem; color: var(--color-text-muted); }
.auth-link a { color: var(--color-primary); text-decoration: none; font-weight: 500; }

/* ── APP LAYOUT ── */
body.app { display: flex; flex-direction: column; }

.app-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 1.5rem; height: 60px;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    position: sticky; top: 0; z-index: 100;
}
.header-left { display: flex; align-items: center; gap: 0.75rem; }
.app-name { font-size: 1.2rem; font-weight: 700; color: var(--color-primary); }
.header-right { display: flex; align-items: center; gap: 1rem; }
.welcome-msg { font-size: 0.9rem; color: var(--color-text-muted); }

.btn-logout {
    padding: 0.4rem 1rem;
    border: 1px solid var(--color-border);
    border-radius: 2rem; font-size: 0.875rem;
    color: var(--color-text-muted); text-decoration: none;
    transition: all 180ms ease;
}
.btn-logout:hover { border-color: var(--color-primary); color: var(--color-primary); }

.app-layout { display: flex; flex: 1; min-height: calc(100dvh - 60px); }

/* SIDEBAR */
.sidebar {
    width: 240px; flex-shrink: 0;
    background: var(--color-surface);
    border-right: 1px solid var(--color-border);
    padding: 1.5rem 1rem;
    display: flex; flex-direction: column; gap: 1.5rem;
}
.sidebar-user { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem; background: var(--color-bg); border-radius: var(--radius); }
.avatar {
    width: 40px; height: 40px; border-radius: 50%;
    background: var(--color-primary); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 1.1rem; flex-shrink: 0;
}
.sidebar-username { font-weight: 600; font-size: 0.9rem; }
.sidebar-email { font-size: 0.75rem; color: var(--color-text-muted); }

.sidebar-nav { display: flex; flex-direction: column; gap: 0.25rem; }
.nav-item {
    display: flex; align-items: center; gap: 0.5rem;
    padding: 0.6rem 0.875rem; border-radius: 0.5rem;
    text-decoration: none; color: var(--color-text-muted);
    font-size: 0.9rem; font-weight: 500;
    transition: all 180ms ease;
}
.nav-item:hover, .nav-item.active {
    background: rgba(1,105,111,0.08); color: var(--color-primary);
}

/* MAIN */
.main-content { flex: 1; padding: 2rem; overflow-y: auto; }
.page-header { margin-bottom: 2rem; }
.page-header h1 { font-size: 1.5rem; font-weight: 700; }
.page-header p { color: var(--color-text-muted); margin-top: 0.25rem; }

.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.25rem; }
.card {
    background: var(--color-surface); border-radius: var(--radius);
    border: 1px solid var(--color-border); padding: 1.5rem;
    box-shadow: var(--shadow);
}
.card h3 { font-size: 1rem; font-weight: 600; margin-bottom: 0.75rem; }
.card p { font-size: 0.9rem; line-height: 1.6; }
.text-muted { color: var(--color-text-muted); margin-top: 0.25rem; }

/* PROFIL */
.profil-avatar {
    width: 72px; height: 72px; border-radius: 50%;
    background: var(--color-primary); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 2rem; font-weight: 700; margin: 0 auto 1.5rem;
}
.profil-table { width: 100%; border-collapse: collapse; }
.profil-table th, .profil-table td { padding: 0.75rem; text-align: left; border-bottom: 1px solid var(--color-border); font-size: 0.9rem; }
.profil-table th { color: var(--color-text-muted); font-weight: 500; width: 40%; }

@media (max-width: 700px) {
    .app-layout { flex-direction: column; }
    .sidebar { width: 100%; flex-direction: row; flex-wrap: wrap; }
    .sidebar-nav { flex-direction: row; }
    .main-content { padding: 1rem; }
    .welcome-msg { display: none; }
}

/* Bouton secondaire */
.btn-secondary {
    background: var(--color-bg);
    color: var(--color-text);
    border: 1px solid var(--color-border);
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 180ms ease;
    display: inline-block;
}
.btn-secondary:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}
