/* ===== VARIABLES & THEMES ===== */
:root {
    --bg-primary: #f0f4ff;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-navbar: rgba(255,255,255,0.85);
    --text-primary: #1a1a2e;
    --text-secondary: #555577;
    --text-muted: #8888aa;
    --accent: #6c63ff;
    --accent-light: #a29bfe;
    --accent-dark: #4834d4;
    --accent-gradient: linear-gradient(135deg, #6c63ff, #a29bfe);
    --success: #00b894;
    --danger: #e17055;
    --warning: #fdcb6e;
    --border: #e0e0f0;
    --shadow: 0 4px 24px rgba(108,99,255,0.10);
    --shadow-hover: 0 8px 32px rgba(108,99,255,0.20);
    --radius: 16px;
    --radius-sm: 10px;
    --navbar-height: 70px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
    --bg-primary: #0f0e1a;
    --bg-secondary: #1a1a2e;
    --bg-card: #16213e;
    --bg-navbar: rgba(22,33,62,0.95);
    --text-primary: #eaeaff;
    --text-secondary: #aaaacc;
    --text-muted: #666688;
    --accent: #a29bfe;
    --accent-light: #6c63ff;
    --accent-dark: #c5beff;
    --accent-gradient: linear-gradient(135deg, #a29bfe, #6c63ff);
    --border: #2a2a4a;
    --shadow: 0 4px 24px rgba(0,0,0,0.4);
    --shadow-hover: 0 8px 32px rgba(162,155,254,0.2);
}

/* ===== RESET & BASE ===== */
* { 
	margin: 0; 
    padding: 0; 
    box-sizing: border-box; 
    touch-action: manipulation;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    transition: var(--transition);
    overscroll-behavior-y: contain;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 4px; }

/* ===== NAVBAR (haut) ===== */

i#edit{
    color: var(--accent);
}

.fa-copy{
    color: #b19d45;
}

.navbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--navbar-height);
    background: var(--bg-navbar);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 2rem;
    gap: 2rem;
    z-index: 1000;
    box-shadow: 0 2px 20px rgba(108,99,255,0.08);
    transition: var(--transition);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    flex-shrink: 0;
}

.nav-logo { 
    font-size: 1.6rem;
    animation: animTopBottom 3s ease-in-out infinite;
}

@keyframes animTopBottom {
    0%, 100% {
        transform: translateY(4px);
    }
    50% {
        transform: translateY(-4px);
    }
}

@keyframes animTopBottomIcon {
    0%, 100% {
        transform: translateY(4px);
    }
    50% {
        transform: translateY(0px);
    }
}

.nav-title {
    font-size: 1.3rem;
    font-weight: 800;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Desktop nav links (inside top navbar) */
.nav-links {
    display: flex;
    list-style: none;
    gap: 0.25rem;
    flex: 1;
}

.nav-links a {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.9rem;
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.9rem;
    transition: var(--transition);
}

.nav-links a:hover,
.nav-links a.active {
    background: linear-gradient(135deg, rgba(108,99,255,0.15), rgba(162,155,254,0.1));
    color: var(--accent);
}

.nav-links a.active { font-weight: 700; }

.nav-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.user-avatar {
    width: 36px; height: 36px;
    background: var(--accent-gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 0.95rem;
    flex-shrink: 0;
}

.username {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.btn-logout {
    padding: 0.4rem 1rem;
    background: rgba(225,112,85,0.12);
    color: var(--danger);
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    transition: var(--transition);
    white-space: nowrap;
}

.btn-logout:hover {
    background: var(--danger);
    color: white;
}

.theme-toggle {
    width: 40px; height: 40px;
    border: none;
    background: rgba(108,99,255,0.1);
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}

.theme-toggle:hover {
    background: var(--accent);
    transform: rotate(20deg);
}

/* ===== BOTTOM NAV (mobile uniquement) ===== */
.bottom-nav {
    display: none; /* caché par défaut sur desktop */
}

@media (max-width: 768px) {
    /* Cacher les liens desktop dans la navbar du haut */
    .nav-links-desktop { display: none !important; }
    .username { display: none; }

    /* Navbar du haut simplifiée sur mobile */
    .navbar {
        display: flex;
        justify-content: space-around;
        padding: 0 1rem;
        gap: 3.5rem;
        height: 56px;
        --navbar-height: 56px;
    }

    .nav-logo { font-size: 1.3rem; }
    .nav-title { font-size: 1.1rem; }
    .user-avatar { width: 30px; height: 30px; font-size: 0.8rem; }

    /* Cacher le bouton déconnexion du haut sur mobile (il est dans la bottom nav) */
    .btn-logout { display: none; }

    /* ===== BOTTOM NAV visible sur mobile ===== */
    .bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0; left: 0; right: 0;
        height: 62px;
        background: var(--bg-navbar);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-top: 1px solid var(--border);
        z-index: 999;
        box-shadow: 0 -2px 20px rgba(0,0,0,0.08);
        /* safe area pour iPhone avec encoche */
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }

    .bottom-nav-item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        text-decoration: none;
        color: var(--text-muted);
        font-size: 0.62rem;
        font-weight: 600;
        padding: 0.3rem 0.2rem;
        border-radius: 0;
        transition: var(--transition);
        position: relative;
    }

    .bottom-nav-item:hover,
    .bottom-nav-item.active {
        color: var(--accent);
    }

    /* Indicateur actif : petit trait en haut */
    .bottom-nav-item.active::before {
        content: '';
        position: absolute;
        top: 0; left: 20%; right: 20%;
        height: 2.5px;
        background: var(--accent-gradient);
        border-radius: 0 0 4px 4px;
    }

    .bottom-nav-icon {
        font-size: 1.3rem;
        line-height: 1;
        transition: transform 0.2s;
    }

    .bottom-nav-item.active .bottom-nav-icon {
        transform: scale(1.15);
    }

    .bottom-nav-label {
        line-height: 1;
        white-space: nowrap;
    }

    /* Déconnexion en rouge */
    .bottom-nav-logout { color: var(--danger); opacity: 0.75; }
    .bottom-nav-logout:hover { opacity: 1; color: var(--danger); }

    /* Contenu principal : espace pour navbar haut + bas */
    .main-content {
        padding-top: calc(56px + 1.25rem);
        padding-left: 1rem;
        padding-right: 1rem;
        padding-bottom: calc(62px + env(safe-area-inset-bottom, 0px) + 1rem);
    }

    /* FAB au-dessus de la bottom nav */
    .fab {
        bottom: calc(62px + env(safe-area-inset-bottom, 0px) + 0.75rem);
        right: 1rem;
        width: 52px; height: 52px;
        font-size: 1.4rem;
    }

    /* Toast au-dessus de la bottom nav */
    .toast-container {
        bottom: calc(62px + env(safe-area-inset-bottom, 0px) + 0.75rem);
    }
}

/* ===== MAIN CONTENT ===== */
.main-content {
    padding-top: calc(var(--navbar-height) + 2rem);
    min-height: 100vh;
    padding-left: 2rem;
    padding-right: 2rem;
    padding-bottom: 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

/* ===== LOGIN PAGE ===== */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    position: relative;
    overflow: hidden;
}

.login-bg {
    position: absolute;
    inset: 0;
    background: 
        radial-gradient(circle at 20% 50%, rgba(108,99,255,0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(162,155,254,0.12) 0%, transparent 50%),
        radial-gradient(circle at 60% 80%, rgba(108,99,255,0.08) 0%, transparent 50%);
    pointer-events: none;
}

.login-card {
    background: var(--bg-card);
    border-radius: 24px;
    padding: 3rem;
    max-width: 440px;
    box-shadow: var(--shadow), 0 0 0 1px var(--border);
    position: relative;
    z-index: 1;
    animation: slideUp 0.5s ease;
}

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

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo {
    font-size: 3.5rem;
    display: block;
    margin-bottom: 0.75rem;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.login-title {
    font-size: 1.8rem;
    font-weight: 800;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-subtitle {
    color: var(--text-muted);
    margin-top: 0.3rem;
    font-size: 0.95rem;
}

/* ===== FORMS ===== */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.form-input {
    width: 100%;
    padding: 0.85rem 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 1rem;
    transition: var(--transition);
    outline: none;
}

.form-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(108,99,255,0.12);
}

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

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.85rem 1.75rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn-primary {
    background: var(--accent-gradient);
    color: white;
    box-shadow: 0 4px 15px rgba(108,99,255,0.35);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(108,99,255,0.45);
}

.btn-secondary {
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 2px solid var(--border);
}

.btn-secondary:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.btn-danger {
    background: rgba(225,112,85,0.1);
    color: var(--danger);
    border: 2px solid transparent;
}

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

.btn-full { width: 100%; }

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}

.btn-icon {
    width: 40px; height: 40px;
    padding: 0;
    border-radius: 50%;
}

/* ===== ALERTS ===== */
.alert {
    padding: 0.85rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.25rem;
    font-weight: 500;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.alert-error {
    background: rgba(225,112,85,0.12);
    color: var(--danger);
    border: 1px solid rgba(225,112,85,0.3);
}

.alert-success {
    background: rgba(0,184,148,0.12);
    color: var(--success);
    border: 1px solid rgba(0,184,148,0.3);
}

/* ===== HOME PAGE ===== */
.home-header {
    text-align: center;
    padding: 2rem 0 3rem;
}

.home-header h1 {
    font-size: 2.5rem;
    font-weight: 800;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.home-header p {
    color: var(--text-muted);
    font-size: 1.1rem;
}

.home-grid {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    max-width: 900px;
    margin: 0 auto;
}

.home-card {
    min-width: 200px;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding-top: 2.5rem;
    padding-bottom: 2.5rem;
    text-align: center;
    text-decoration: none;
    color: var(--text-primary);
    transition: var(--transition);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.home-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-hover);
    border-color: var(--accent);
}

.home-card-icon {
    font-size: 3rem;
    width: 80px; height: 80px;
    background: linear-gradient(135deg, rgba(108,99,255,0.12), rgba(162,155,254,0.08));
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.home-card:hover .home-card-icon {
    background: var(--accent-gradient);
    transform: scale(1.1);
}

.home-card-title {
    font-size: 1.2rem;
    font-weight: 700;
}

.home-card-desc {
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* ===== PAGE HEADERS ===== */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-title {
    font-size: 1.8rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ===== CARDS ===== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

/* ===== BREADCRUMB ===== */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.breadcrumb a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}

.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb span { color: var(--text-muted); }

/* ===== FILE GRID ===== */
.files-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
}

.file-item {
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1.25rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    user-select: none;
}

.file-item:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.file-icon {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 0.5rem;
}

.file-name {
    font-size: 0.85rem;
    font-weight: 600;
    word-break: break-all;
    color: var(--text-primary);
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.file-actions {
    position: absolute;
    top: 6px; right: 6px;
    display: none;
    gap: 4px;
}

.file-item:hover .file-actions { display: flex; }

.file-action-btn {
    width: 26px; height: 26px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    background: var(--bg-secondary);
    color: var(--text-primary);
    text-decoration: none;
}

.file-action-btn.delete:hover { background: var(--danger); color: white; }
.file-action-btn.download:hover { background: var(--success); color: white; }

/* ===== TOOLBAR ===== */
.toolbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

/* ===== MODAL ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition);
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.modal {
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 2rem;
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    box-shadow: var(--shadow-hover);
    transform: scale(0.95);
    transition: var(--transition);
    border: 1px solid var(--border);
}

.modal-overlay.active .modal {
    transform: scale(1);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
}

.modal-title {
    font-size: 1.2rem;
    font-weight: 700;
}

.modal-close {
    width: 32px; height: 32px;
    border: none;
    background: var(--bg-primary);
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.modal-close:hover { background: var(--danger); color: white; }

/* ===== NOTES ===== */
.notes-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.25rem;
}

.fa-map-pin{
    color: var(--accent);
}

.note-card {
    background: var(--bg-card);
    border-top-right-radius: 4px;
    border-top-left-radius: 4px;
    border-bottom-left-radius: var(--radius);
    border-bottom-right-radius: var(--radius);
    padding: 1.5rem;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow);
    position: relative;
    min-height: 180px;
    display: flex;
    flex-direction: column;
}

.note-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
    border-color: var(--accent);
}

.note-card.pinned {
            border: 2px solid var(--accent);
    		border-top-right-radius: 8px;
    		border-top-left-radius: 8px;
    		border-bottom-left-radius: var(--radius);
    		border-bottom-right-radius: var(--radius);
            box-shadow: 0 0 0 3px rgba(108,99,255,.12), var(--shadow) !important;
        }

.note-card-color {
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 5px;
    border-radius: var(--radius) var(--radius) 0 0;
}

.note-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    margin-top: 0.25rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.note-preview {
    font-size: 0.88rem;
    color: var(--text-muted);
    flex: 1;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
}

.note-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}

.note-meta {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.note-author {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent);
}

.note-author-dot {
    width: 20px; height: 20px;
    border-radius: 50%;
    background: var(--accent-gradient);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.65rem;
    font-weight: 800;
}

.note-delete {
    position: absolute;
    background: rgba(225, 112, 85, .12);
    top: 12px; right: 12px;
    opacity: 0;
    transition: var(--transition);
}

.note-delete:hover {
    background: rgb(255 49 0 / 54%);
}

.note-card:hover .note-delete { opacity: 1; }

.fab {
    position: fixed;
    bottom: 2rem; right: 2rem;
    width: 58px; height: 58px;
    background: var(--accent-gradient);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 1.6rem;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(108,99,255,0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    z-index: 100;
}

.fab:hover {
    transform: scale(1.12) rotate(90deg);
    box-shadow: 0 8px 30px rgba(108,99,255,0.55);
}

/* ===== NOTE EDITOR ===== */
.note-editor-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition);
}

.note-editor-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.note-editor {
    background: var(--bg-card);
    border-radius: var(--radius);
    width: 100%;
    max-width: 700px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-hover);
    border: 1px solid var(--border);
    transform: scale(0.95);
    transition: var(--transition);
    overflow: hidden;
}

.note-editor-overlay.active .note-editor { transform: scale(1); }

.note-editor-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.note-editor-title {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    outline: none;
}

.note-editor-title::placeholder { color: var(--text-muted); }

.note-color-picker {
    display: flex;
    gap: 6px;
}

.color-dot {
    width: 20px; height: 20px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: var(--transition);
}

.color-dot.active, .color-dot:hover { transform: scale(1.2); border-color: var(--text-primary); }

.note-editor-body {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.note-textarea {
    flex: 1;
    padding: 1.5rem;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 1rem;
    line-height: 1.7;
    resize: none;
    outline: none;
    min-height: 300px;
    font-family: inherit;
}

.note-editor-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.note-editor-info {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ===== UPLOAD ZONE ===== */
.upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: var(--bg-card);
}

.upload-zone:hover, .upload-zone.drag-over {
    border-color: var(--accent);
    background: rgba(108,99,255,0.04);
}

.upload-zone-icon { font-size: 2.5rem; margin-bottom: 0.5rem; }
.upload-zone-text { color: var(--text-muted); font-size: 0.95rem; }
.upload-zone-text strong { color: var(--accent); }

/* ===== PROGRESS BAR ===== */
.progress-bar {
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 0.5rem;
}

.progress-fill {
    height: 100%;
    background: var(--accent-gradient);
    border-radius: 3px;
    transition: width 0.3s ease;
    width: 0%;
}

/* ===== THUMBNAIL ===== */
.thumbnail {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    background: var(--bg-primary);
}

/* ===== AUDIO PLAYER ===== */

.audio-card {
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

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

.audio-card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.audio-icon {
    width: 48px; height: 48px;
    background: var(--accent-gradient);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}

.audio-name {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.audio-size {
    font-size: 0.8rem;
    color: var(--text-muted);
}

audio {
    width: 100%;
    border-radius: 8px;
    height: 36px;
    accent-color: var(--accent);
}

#mpAudio{
    display: none;
}

/* ===== DOCUMENTS LIST ===== */
.doc-list {
    margin-bottom: 65px;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.doc-item {
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: var(--transition);
}

.doc-item:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow);
}

.doc-icon { font-size: 2rem; flex-shrink: 0; }

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

.doc-name {
    font-weight: 600;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    flex-direction: column;
}

strong{
    color: var(--accent);
}

.doc-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

.doc-actions { display: flex; gap: 0.5rem; flex-shrink: 0; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {

    /* --- Page header --- */
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .page-header > div {
        width: 100%;
        justify-content: flex-start;
    }

    /* --- Home --- */
    .home-header h1 { font-size: 1.8rem; }
    .home-header p { font-size: 1rem; }

    /* --- Home grid: 2 columns --- */
    .home-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .home-card { 
        padding: 1.75rem 1rem; 
        min-width: 0;
    }
    .home-card-icon { width: 64px; height: 64px; font-size: 2.4rem; }

    /* --- Titles --- */
    .page-title { font-size: 1.3rem; }

    /* --- Files grid --- */
    .files-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 0.75rem; }

    /* --- File actions always visible on mobile (no hover) --- */
    .file-actions { display: flex !important; }

    /* --- Breadcrumb --- */
    .breadcrumb { font-size: 0.82rem; }

    /* --- Documents list --- */
    .doc-item {
        flex-wrap: wrap;
        gap: 0.75rem;
        padding: 0.85rem 1rem;
    }

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

    .doc-meta {
        white-space: normal;
        font-size: 0.75rem;
    }

    .doc-actions {
        width: 100%;
        justify-content: flex-end;
    }

    /* --- Notes grid --- */
    .notes-container { grid-template-columns: 1fr 1fr; gap: 0.85rem; }

    /* --- Note delete always visible on mobile --- */
    .note-delete { opacity: 1 !important; }

    /* --- Note editor : bottom sheet --- */
    /* --- Note editor : PLEIN ÉCRAN sur mobile --- */
	.note-editor-overlay {
    	padding: 0 !important;
    	align-items: stretch !important;
    	justify-content: stretch !important;
	}

	.note-editor {
    	width: 100% !important;
   		max-width: 100% !important;
    	height: 100% !important;
    	max-height: 100% !important;
    	border-radius: 0 !important;
    	margin: 0 !important;
    	transform: translateY(100%) !important;
    	transition: transform .3s cubic-bezier(.4,0,.2,1) !important;
    	display: flex;
    	flex-direction: column;
	}

	.note-editor-overlay.active .note-editor {
    	transform: translateY(0) !important;
	}

	.note-editor-header {
    	flex-wrap: wrap;
    	gap: .5rem;
   		padding: .85rem 1rem;
    	flex-shrink: 0;
	}

	.note-editor-title {
    	font-size: 1.1rem;
    	padding: 10px;
    	min-width: 0;
    	flex: 1 1 100%;
    	order: 1;
	}

	.note-color-picker { order: 2; flex: 1; }
	.note-editor-header .modal-close { order: 3; }

	.note-editor-body {
    	flex: 1 1 0;
    	overflow-y: auto;
    	-webkit-overflow-scrolling: touch;
    	display: flex;
    	flex-direction: column;
	}

	.note-textarea {
    	flex: 1;
    	min-height: 0 !important;
    	padding: 1rem;
    	font-size: 1rem;
    	line-height: 1.75;
	}

	.note-editor-footer {
    	flex-direction: row;
    	gap: .6rem;
    	padding: .85rem 1rem;
    	flex-shrink: 0;
	}
	.note-editor-footer > div { width: auto; flex: 1; display: flex; gap: .6rem; }
	.note-editor-footer .btn { flex: 1; }
	.note-editor-info { display: none; }
    
    .fab{ bottom: 6rem; }

    /* --- Modals --- */
    .modal-overlay { padding: 0.75rem; }
    .modal { padding: 1.5rem 1.25rem; }

    /* --- Upload zone --- */
    .upload-zone { padding: 1.5rem 1rem; }

    /* --- Music grid --- */
    .music-grid { grid-template-columns: 1fr; }
	}

/* Small phones */
@media (max-width: 480px) {
    .login-card { padding: 1.75rem 1.25rem; }
    .login-logo { font-size: 3rem; }
    .login-title { font-size: 1.5rem; }

    .home-grid { grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
    .home-card { padding: 1.25rem 0.75rem; }
    .home-card-title { font-size: 1rem; }
    .home-card-desc { font-size: 0.8rem; }

    .notes-container { grid-template-columns: 1fr; }

    .page-title { font-size: 1.1rem; }

    /* Buttons in toolbar: smaller */
    .toolbar .btn { font-size: 0.82rem; padding: 0.5rem 0.85rem; }

    /* Color picker: smaller dots */
    .color-dot { width: 17px; height: 17px; }

    /* Files grid: 2 columns */
    .files-grid { grid-template-columns: repeat(2, 1fr); }

    /* Breadcrumb: wrap freely */
    .breadcrumb { font-size: 0.78rem; }
}

/* Very small phones */
@media (max-width: 360px) {
    .main-content { padding-left: 0.75rem; padding-right: 0.75rem; }
    .home-grid { grid-template-columns: 1fr 1fr; gap: 0.5rem; }
    .nav-links a { min-width: 44px; padding: 0.3rem 0.3rem; }
}

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
}

.empty-icon { font-size: 4rem; margin-bottom: 1rem; display: block; }
.empty-title { font-size: 1.2rem; font-weight: 600; margin-bottom: 0.5rem; color: var(--text-secondary); }
.empty-desc { font-size: 0.9rem; }

/* ===== TOAST ===== */
.toast-container {
    position: fixed;
    bottom: 2rem; left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}

.toast {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1.25rem;
    box-shadow: var(--shadow-hover);
    font-weight: 500;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    animation: toastIn 0.3s ease;
    white-space: nowrap;
}

.toast.success { border-color: var(--success); color: var(--success); }
.toast.error { border-color: var(--danger); color: var(--danger); }

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

/* ===== VIDEO ===== */
.video-card {
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: var(--transition);
}

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

video {
    width: 100%;
    display: block;
    background: #000;
    border-radius: 0;
    max-height: 200px;
}

.video-name {
    padding: 0.75rem;
    font-weight: 600;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* ===== BADGE ===== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    background: rgba(108,99,255,0.12);
    color: var(--accent);
}

/* ===== NAV USER DROPDOWN ===== */
.nav-avatar-wrap {
    display: flex;
    align-items: center;
    gap: .5rem;
    cursor: pointer;
    padding: .35rem .6rem;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    position: relative;
    user-select: none;
}

.nav-avatar-wrap:hover {
    background: rgba(108,99,255,.08);
}

.user-avatar-img {
    width: 36px !important;
    height: 36px !important;
    object-fit: cover;
    border-radius: 50% !important;
    font-size: 0 !important;
}

.user-dropdown {
    position: absolute;
    top: calc(100% + .5rem);
    right: 0;
    width: 220px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-hover);
    z-index: 2000;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-8px) scale(.97);
    transition: opacity .2s ease, transform .2s ease;
}

.user-dropdown.open {
    opacity: 1;
    pointer-events: all;
    transform: translateY(0) scale(1);
}

.user-dropdown-header {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: 1rem;
    background: linear-gradient(135deg, rgba(108,99,255,.07), rgba(162,155,254,.04));
}

.dropdown-avatar {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: var(--accent-gradient);
    display: flex; align-items: center; justify-content: center;
    color: white; font-weight: 800; font-size: 1rem;
    flex-shrink: 0;
}

.dropdown-avatar-img {
    width: 40px; height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.dropdown-name {
    font-weight: 700;
    font-size: .9rem;
    color: var(--text-primary);
}

.dropdown-role {
    font-size: .75rem;
    color: var(--text-muted);
}

.dropdown-divider {
    height: 1px;
    background: var(--border);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .8rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: .9rem;
    font-weight: 500;
    transition: var(--transition);
}

.dropdown-item:hover, .dropdown-item.active {
    background: rgba(108,99,255,.07);
    color: var(--accent);
}

.dropdown-item-danger { color: var(--danger) !important; }
.dropdown-item-danger:hover { background: rgba(225,112,85,.08) !important; }

.profil-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 1.5rem;
    max-width: 900px;
    margin: 0 auto;
}

/* ===== Sidebar gauche ===== */
.profil-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.profil-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem 1.5rem;
    text-align: center;
    box-shadow: var(--shadow);
}

/* Grande photo de profil */
.profil-avatar-wrap {
    position: relative;
    width: 110px;
    height: 110px;
    margin: 0 auto 1rem;
}

.profil-avatar {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.8rem;
    font-weight: 800;
    color: white;
    box-shadow: 0 4px 20px rgba(108,99,255,0.35);
    overflow: hidden;
}
    
.profil-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Bouton edit photo (overlay) */
.profil-avatar-edit {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 32px;
    height: 32px;
    background: var(--accent);
    border: 2px solid var(--bg-card);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: .85rem;
    transition: var(--transition);
}

.profil-avatar-edit:hover { background: var(--accent-dark); transform: scale(1.1); }

.profil-name {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: .25rem;
}

.profil-since {
    font-size: .8rem;
    color: var(--text-muted);
}

/* Nav sidebar */
.profil-nav {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.profil-nav-item {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .9rem 1.25rem;
    cursor: pointer;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: .9rem;
    border-left: 3px solid transparent;
    transition: var(--transition);
    text-decoration: none;
}

.profil-nav-item:hover {
    background: rgba(108,99,255,.06);
    color: var(--accent);
}

.profil-nav-item.active {
    background: rgba(108,99,255,.08);
    color: var(--accent);
    border-left-color: var(--accent);
}

.profil-nav-item + .profil-nav-item {
    border-top: 1px solid var(--border);
}

/* ===== Sections droite ===== */
.profil-sections {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

#section-password{
	margin-bottom: 50px;
}

.profil-section {
        background: var(--bg-card);
        border: 1px solid var(--border);
        border-radius: var(--radius);
        padding: 1.75rem;
        box-shadow: var(--shadow);
}

.section-title {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: .5rem;
    padding-bottom: .85rem;
    border-bottom: 1px solid var(--border);
}

/* Avatar picker dans la section photo */
.avatar-preview-row {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    margin-bottom: 1.25rem;
}

.avatar-preview {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 800;
    color: white;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: var(--shadow);
}

.avatar-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Password strength bar */
.pw-strength {
    height: 4px;
    border-radius: 2px;
    background: var(--border);
    margin-top: .4rem;
    overflow: hidden;
}

.pw-strength-fill {
    height: 100%;
    border-radius: 2px;
    transition: width .3s, background .3s;
    width: 0%;
}

.pw-hint {
    font-size: .78rem;
    color: var(--text-muted);
    margin-top: .3rem;
}

/* Input avec toggle mdp */
.input-pw-wrap {
    position: relative;
}

.input-pw-wrap .form-input {
    padding-right: 3rem;
}
.toggle-pw {
    position: absolute;
    right: .75rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    color: var(--text-muted);
}

@media(max-width:768px) {
    .profil-layout {
        grid-template-columns: 1fr;
    }
    .profil-sidebar {
        flex-direction: row;
        flex-wrap: wrap;
    }
    .profil-card { flex: 1; min-width: 200px; }
    .profil-nav { flex: 1; min-width: 200px; }
}

/* ===== MINI PLAYER ===== */
/* ===========================
   MINI PLAYER — enhanced
   =========================== */
.mini-player {
    position: fixed;
    top: var(--navbar-height);
    left: 0; right: 0;
    height: 68px;
    background: var(--bg-navbar);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 998;
    box-shadow: 0 4px 20px rgba(0,0,0,.1);
    transform: translateY(-100%);
    opacity: 0;
    transition: transform .3s cubic-bezier(.4,0,.2,1), opacity .3s ease;
    pointer-events: none;
}
 
.mini-player.visible {
    transform: translateY(0);
    opacity: 1;
    pointer-events: all;
}
 
/* Progress bar — full width, top of player */
.mini-progress-wrap {
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--border);
    cursor: pointer;
    z-index: 2;
}
.mini-progress-fill {
    height: 100%;
    background: var(--accent-gradient);
    width: 0%;
    transition: width .1s linear;
    pointer-events: none;
}
.mini-progress-wrap:hover .mini-progress-fill {
    height: 100%;
    background: var(--accent);
}
 
/* Main row */
.mini-player-row {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: 0 1rem;
    flex: 1;
    min-height: 0;
    margin-top: 3px; /* offset for progress bar */
}
 
/* Cover */
.mini-cover {
    width: 36px; height: 36px;
    border-radius: 25px;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .95rem;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,.2);
    transition: background .3s;
    overflow: hidden;
    background-size: cover;
    background-position: center;
}
 
.mini-cover.spinning { animation: miniSpin 8s linear infinite; }
 
@keyframes miniSpin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}
 
/* Info */
.mini-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: .05rem;
}
 
.mini-track-name {
    font-size: .82rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    line-height: 1.2;
}
 
.mini-time {
    font-size: .68rem;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    letter-spacing: .02em;
}
 
/* Controls */
.mini-controls {
    display: flex;
    align-items: center;
    gap: .25rem;
    flex-shrink: 0;
}
 
.mini-btn {
    width: 30px; height: 30px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    border-radius: 50%;
    cursor: pointer;
    font-size: .85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color .15s, background .15s, transform .15s;
    text-decoration: none;
    flex-shrink: 0;
}
 
.mini-btn:hover {
    color: var(--accent);
    background: rgba(108,99,255,.1);
    transform: scale(1.08);
}
 
.mini-btn-play {
    width: 34px; height: 34px;
    background: var(--accent-gradient);
    color: white;
    font-size: .9rem;
    box-shadow: 0 2px 10px rgba(108,99,255,.35);
}
.mini-btn-play:hover {
    box-shadow: 0 4px 16px rgba(108,99,255,.5);
    transform: scale(1.1);
    color: white;
    background: var(--accent-gradient);
}
 
/* Volume */
.mini-volume-wrap {
    display: flex;
    align-items: center;
    gap: .3rem;
    flex-shrink: 0;
}
 
.mini-volume {
    -webkit-appearance: none;
    appearance: none;
    width: 64px;
    height: 3px;
    border-radius: 2px;
    background: var(--border);
    outline: none;
    cursor: pointer;
    accent-color: var(--accent);
}
.mini-volume::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px; height: 12px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    box-shadow: 0 0 4px rgba(108,99,255,.4);
}
 
.mini-btn-close {
    color: var(--danger);
    font-size: .8rem;
}
.mini-btn-close:hover {
    background: rgba(225,112,85,.12);
    color: var(--danger);
}
 
body.has-mini-player .main-content {
    padding-top: calc(var(--navbar-height) + 68px + 1.25rem);
}
 
/* Mobile */
@media (max-width: 768px) {
    .mini-player {
        top: auto;
        bottom: calc(62px + env(safe-area-inset-bottom, 0px));
        border-bottom: none;
        border-top: 1px solid var(--border);
        transform: translateY(100%);
        box-shadow: 0 -4px 20px rgba(0,0,0,.1);
        height: 60px;
    }
    .mini-player.visible { transform: translateY(0); }
 
    /* Hide volume on mobile */
    .mini-volume-wrap { display: none; }
 
    body.has-mini-player .main-content {
        padding-top: calc(56px + 1.25rem);
        padding-bottom: calc(62px + 60px + env(safe-area-inset-bottom, 0px) + 1rem);
    }
    body.has-mini-player .fab {
        bottom: calc(62px + 60px + env(safe-area-inset-bottom, 0px) + .75rem);
    }
    body.has-mini-player .toast-container {
        bottom: calc(62px + 60px + env(safe-area-inset-bottom, 0px) + .75rem);
    }
}

#unpinnedContainer{
	margin-bottom: 65px;
}

#releasesGrid{
	margin-bottom: 65px;
}


#shareUrlInput{
    border: var(--border) 1px solid;
    border-radius: 15px;
    padding: 21px;
    color: var(--text-primary);
}

/* CANVA */


/* ═══════════════════════════════════════════════════════════════════
   CANVAS.CSS — Legacy Cloud Canvas
═══════════════════════════════════════════════════════════════════ */

/* ── LISTE DES TABLEAUX ──────────────────────────────────────────── */
.boards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.25rem;
}

.board-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    position: relative;
    transition: var(--transition);
    box-shadow: var(--shadow);
}
.board-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
    border-color: var(--accent-light);
}

.board-preview {
    width: 100%;
    aspect-ratio: 16/9;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: rgba(255,255,255,.18);
    position: relative;
    overflow: hidden;
}
/* Fonds de preview */
.board-preview.dots-dark  { background: #0f0f1a; background-image: radial-gradient(circle, #444 1px, transparent 1px); background-size: 24px 24px; }
.board-preview.dots-light { background: #f8f8f8; background-image: radial-gradient(circle, #bbb 1px, transparent 1px); background-size: 24px 24px; }
.board-preview.grid-dark  { background: #0f0f1a; background-image: linear-gradient(#2a2a3e 1px,transparent 1px),linear-gradient(90deg,#2a2a3e 1px,transparent 1px); background-size: 32px 32px; }
.board-preview.grid-light { background: #f8f8f8; background-image: linear-gradient(#ddd 1px,transparent 1px),linear-gradient(90deg,#ddd 1px,transparent 1px); background-size: 32px 32px; }
.board-preview.plain-dark  { background: #0a0a0f; }
.board-preview.plain-light { background: #ffffff; }

.board-info {
    padding: .75rem;
}
.board-title {
    font-size: .92rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: .25rem;
}
.board-meta {
    display: flex;
    gap: .75rem;
    font-size: .73rem;
    color: var(--text-muted);
}
.board-delete-btn {
    position: absolute;
    top: 7px; right: 7px;
    width: 28px; height: 28px;
    background: rgba(0,0,0,.55);
    border: none; border-radius: 50%;
    color: white; cursor: pointer;
    font-size: .75rem;
    display: flex; align-items: center; justify-content: center;
    opacity: 0; transition: opacity .2s;
    backdrop-filter: blur(4px);
}
.board-card:hover .board-delete-btn { opacity: 1; }
@media (max-width: 768px) { .board-delete-btn { opacity: 1; } }

/* ── WORKSPACE ───────────────────────────────────────────────────── */
#canvasView {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    background: #0f0f1a;
}

.cv-workspace {
    flex: 1;
    overflow: hidden;
    position: relative;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
}
.cv-workspace.grabbing { cursor: grabbing; }
.cv-workspace.tool-text { cursor: crosshair; }

/* Le canvas infini transformé par JS */
.cv-canvas {
    position: absolute;
    top: 0; left: 0;
    width: 0; height: 0;
    transform-origin: 0 0;
}

/* ── FONDS DU WORKSPACE ──────────────────────────────────────────── */
.cv-workspace.dots-dark  { background: #0f0f1a; background-image: radial-gradient(circle, #333 1px, transparent 1px); background-size: 28px 28px; }
.cv-workspace.dots-light { background: #f4f4f8; background-image: radial-gradient(circle, #bbb 1px, transparent 1px); background-size: 28px 28px; }
.cv-workspace.grid-dark  { background: #0f0f1a; background-image: linear-gradient(#1e1e2e 1px,transparent 1px),linear-gradient(90deg,#1e1e2e 1px,transparent 1px); background-size: 32px 32px; }
.cv-workspace.grid-light { background: #f4f4f8; background-image: linear-gradient(#ddd 1px,transparent 1px),linear-gradient(90deg,#ddd 1px,transparent 1px); background-size: 32px 32px; }
.cv-workspace.plain-dark  { background: #0a0a0f; }
.cv-workspace.plain-light { background: #ffffff; }

/* ── TOOLBAR ─────────────────────────────────────────────────────── */
.cv-toolbar {
    height: 52px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: 0 .75rem;
    flex-shrink: 0;
    z-index: 10;
    position: relative;
}
.cv-toolbar-left  { display: flex; align-items: center; gap: .5rem; flex-shrink: 0; }
.cv-toolbar-right { display: flex; align-items: center; gap: .5rem; margin-left: auto; flex-shrink: 0; }

.cv-tools {
    display: flex;
    align-items: center;
    gap: .2rem;
    flex: 1;
    justify-content: center;
    overflow-x: auto;
    scrollbar-width: none;
}
.cv-tools::-webkit-scrollbar { display: none; }

.cv-tool, .cv-btn {
    width: 34px; height: 34px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    border-radius: 8px;
    cursor: pointer;
    font-size: .9rem;
    display: flex; align-items: center; justify-content: center;
    transition: background .15s, color .15s;
    flex-shrink: 0;
}
.cv-tool:hover, .cv-btn:hover { background: var(--bg-primary); color: var(--text-primary); }
.cv-tool.active { background: rgba(108,99,255,.18); color: var(--accent); }
.cv-btn-back { color: var(--text-secondary); }
.cv-btn-delete-sel { color: var(--danger) !important; }
.cv-btn-save {
    width: auto; padding: 0 .85rem;
    gap: .4rem;
    background: var(--accent-gradient);
    color: white !important;
    border-radius: 8px;
    font-weight: 700; font-size: .82rem;
}
.cv-btn-save:hover { opacity: .88; background: var(--accent-gradient) !important; }
.cv-save-label { display: inline; }

.cv-separator {
    width: 1px; height: 20px;
    background: var(--border);
    margin: 0 .25rem;
    flex-shrink: 0;
}

.cv-title-input {
    border: none; outline: none;
    background: transparent;
    color: var(--text-primary);
    font-size: .95rem;
    font-weight: 700;
    width: 160px;
    padding: .25rem .4rem;
    border-radius: 6px;
}
.cv-title-input:focus { background: var(--bg-primary); }

/* Zoom */
.cv-zoom-ctrl {
    display: flex; align-items: center; gap: .1rem;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0 .2rem;
}
.cv-zoom-ctrl span {
    font-size: .78rem;
    font-weight: 700;
    color: var(--text-secondary);
    min-width: 40px;
    text-align: center;
}

/* Sélecteur de fond */
.cv-bg-picker { position: relative; }
.cv-bg-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: .5rem;
    display: none;
    gap: .4rem;
    flex-wrap: wrap;
    width: 164px;
    box-shadow: var(--shadow-hover);
    z-index: 100;
}
.cv-bg-dropdown.open { display: flex; }
.cv-bg-option {
    width: 44px; height: 36px;
    border-radius: 6px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color .15s, transform .15s;
    flex-shrink: 0;
}
.cv-bg-option:hover { transform: scale(1.07); }
.cv-bg-option.active, .cv-bg-option:has(input:checked) { border-color: var(--accent); }
.cv-bg-option.dots-dark  { background: #0f0f1a; background-image: radial-gradient(circle, #444 1px, transparent 1px); background-size: 10px 10px; }
.cv-bg-option.dots-light { background: #f4f4f8; background-image: radial-gradient(circle, #bbb 1px, transparent 1px); background-size: 10px 10px; }
.cv-bg-option.grid-dark  { background: #0f0f1a; background-image: linear-gradient(#2a2a3e 1px,transparent 1px),linear-gradient(90deg,#2a2a3e 1px,transparent 1px); background-size: 12px 12px; }
.cv-bg-option.grid-light { background: #f4f4f8; background-image: linear-gradient(#ddd 1px,transparent 1px),linear-gradient(90deg,#ddd 1px,transparent 1px); background-size: 12px 12px; }
.cv-bg-option.plain-dark  { background: #0a0a0f; }
.cv-bg-option.plain-light { background: #ffffff; border: 2px solid #ddd; }

/* Modal fond — grille */
.cv-bg-picker-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .6rem;
    margin-top: .25rem;
}
.cv-bg-pick-item {
    display: flex; flex-direction: column; align-items: center; gap: .35rem;
    cursor: pointer;
}
.cv-bg-pick-item input { display: none; }
.cv-bg-pick-item .cv-bg-option { width: 100%; height: 44px; border-radius: 8px; }
.cv-bg-pick-item span { font-size: .72rem; color: var(--text-muted); }
.cv-bg-pick-item input:checked + .cv-bg-option { border-color: var(--accent); }

/* ── ÉLÉMENTS DU CANVAS ──────────────────────────────────────────── */
.cv-el {
    position: absolute;
    box-sizing: border-box;
    cursor: move;
    user-select: none;
    -webkit-user-select: none;
}
.cv-el.selected {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Poignées de redimensionnement */
.cv-handle {
    position: absolute;
    width: 10px; height: 10px;
    background: var(--accent);
    border: 2px solid white;
    border-radius: 50%;
    z-index: 10;
    cursor: nwse-resize;
}
.cv-handle.tl { top: -5px;  left: -5px;  cursor: nwse-resize; }
.cv-handle.tr { top: -5px;  right: -5px; cursor: nesw-resize; }
.cv-handle.bl { bottom: -5px; left: -5px;  cursor: nesw-resize; }
.cv-handle.br { bottom: -5px; right: -5px; cursor: nwse-resize; }
.cv-handle.tm { top: -5px;  left: 50%; transform: translateX(-50%); cursor: ns-resize; }
.cv-handle.bm { bottom: -5px; left: 50%; transform: translateX(-50%); cursor: ns-resize; }
.cv-handle.ml { left: -5px; top: 50%; transform: translateY(-50%); cursor: ew-resize; }
.cv-handle.mr { right: -5px; top: 50%; transform: translateY(-50%); cursor: ew-resize; }

/* ── ÉLÉMENT TEXTE ───────────────────────────────────────────────── */
.cv-el-text {
    background: rgba(30,30,50,.85);
    border-radius: 8px;
    padding: .5rem .75rem;
    color: white;
    font-size: 16px;
    min-width: 80px;
    min-height: 36px;
    word-break: break-word;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255,255,255,.08);
}
.cv-el-text[contenteditable="true"] {
    cursor: text;
    outline: none;
    caret-color: var(--accent);
}
.cv-el-text.transparent-bg {
    background: transparent;
    border-color: transparent;
    backdrop-filter: none;
}

/* ── ÉLÉMENT IMAGE ───────────────────────────────────────────────── */
.cv-el-image img {
    width: 100%; height: 100%;
    object-fit: cover;
    border-radius: 6px;
    display: block;
    pointer-events: none;
}
.cv-el-image { border-radius: 6px; overflow: hidden; }

/* ── FORMES ──────────────────────────────────────────────────────── */
.cv-el-shape { display: flex; align-items: center; justify-content: center; }

.cv-shape-rect {
    width: 100%; height: 100%;
    background: rgba(108,99,255,.3);
    border: 2px solid var(--accent);
    border-radius: 8px;
    transition: background .15s;
}
.cv-shape-circle {
    width: 100%; height: 100%;
    background: rgba(108,99,255,.3);
    border: 2px solid var(--accent);
    border-radius: 50%;
}
.cv-shape-triangle {
    width: 0; height: 0;
    background: transparent !important;
    border-left: 50px solid transparent;
    border-right: 50px solid transparent;
    border-bottom: 86px solid rgba(108,99,255,.5);
    /* Taille dynamique gérée par JS via CSS var */
}

/* ── ÉLÉMENT YOUTUBE ─────────────────────────────────────────────── */
.cv-el-youtube {
    border-radius: 10px;
    overflow: hidden;
    background: #000;
    border: 1px solid rgba(255,255,255,.1);
}
.cv-el-youtube iframe {
    width: 100%; height: 100%;
    display: block;
    pointer-events: all;
    border: none;
}

/* ── ÉLÉMENT LIEN ────────────────────────────────────────────────── */
.cv-el-link {
    background: rgba(30,30,50,.9);
    border: 1px solid rgba(108,99,255,.4);
    border-radius: 10px;
    padding: .6rem .9rem;
    display: flex;
    align-items: center;
    gap: .6rem;
    cursor: pointer;
    backdrop-filter: blur(4px);
    text-decoration: none;
    overflow: hidden;
}
.cv-el-link .cv-link-icon { color: var(--accent); font-size: 1.1rem; flex-shrink: 0; }
.cv-el-link .cv-link-text {
    color: var(--text-primary);
    font-size: .85rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cv-el-link .cv-link-url {
    color: var(--text-muted);
    font-size: .72rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── TABLEAU ─────────────────────────────────────────────────────── */
.cv-el-table {
    background: rgba(20,20,35,.92);
    border-radius: 8px;
    overflow: auto;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255,255,255,.1);
}
.cv-table {
    border-collapse: collapse;
    width: 100%;
    min-width: 100%;
    font-size: .85rem;
    color: var(--text-primary);
}
.cv-table th, .cv-table td {
    border: 1px solid rgba(255,255,255,.12);
    padding: .35rem .6rem;
    min-width: 60px;
    outline: none;
    white-space: nowrap;
}
.cv-table th {
    background: rgba(108,99,255,.2);
    font-weight: 700;
    color: var(--accent);
}
.cv-table td:focus, .cv-table th:focus {
    background: rgba(108,99,255,.12);
    box-shadow: inset 0 0 0 2px var(--accent);
}

/* ── LISTE ───────────────────────────────────────────────────────── */
.cv-el-list {
    background: rgba(20,20,35,.92);
    border-radius: 8px;
    padding: .6rem .85rem;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255,255,255,.1);
    min-width: 140px;
}
.cv-list-item {
    display: flex;
    align-items: flex-start;
    gap: .5rem;
    padding: .2rem 0;
    color: var(--text-primary);
    font-size: .88rem;
}
.cv-list-item::before {
    content: '•';
    color: var(--accent);
    font-weight: 900;
    flex-shrink: 0;
    margin-top: 1px;
}
.cv-list-item[contenteditable="true"] {
    outline: none;
    caret-color: var(--accent);
}
.cv-list-item[contenteditable="true"]:focus {
    background: rgba(108,99,255,.08);
    border-radius: 4px;
}

/* ── PANNEAU PROPRIÉTÉS ──────────────────────────────────────────── */
.cv-props-panel {
    position: fixed;
    right: -280px;
    top: 52px;
    bottom: 0;
    width: 260px;
    background: var(--bg-card);
    border-left: 1px solid var(--border);
    z-index: 100;
    transition: right .25s cubic-bezier(.4,0,.2,1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.cv-props-panel.open { right: 0; }

.cv-props-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .85rem 1rem;
    border-bottom: 1px solid var(--border);
    font-weight: 700;
    font-size: .88rem;
    color: var(--text-primary);
    flex-shrink: 0;
}
.cv-props-close {
    width: 26px; height: 26px;
    border: none; background: none;
    color: var(--text-muted); cursor: pointer;
    border-radius: 6px; font-size: .85rem;
    display: flex; align-items: center; justify-content: center;
}
.cv-props-close:hover { background: var(--bg-primary); color: var(--text-primary); }
.cv-props-body {
    flex: 1;
    overflow-y: auto;
        padding: .85rem 1rem;
    display: flex;
    flex-direction: column;
    gap: .75rem;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

/* Groupes de propriétés */
.cv-prop-group { display: flex; flex-direction: column; gap: .35rem; }
.cv-prop-label {
    font-size: .72rem; font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase; letter-spacing: .05em;
}
.cv-prop-row { display: flex; gap: .4rem; align-items: center; }
.cv-prop-row input[type="text"],
.cv-prop-row input[type="number"],
.cv-prop-row select {
    flex: 1; padding: .4rem .6rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: .83rem; outline: none;
}
.cv-prop-row input:focus, .cv-prop-row select:focus { border-color: var(--accent); }
.cv-prop-row input[type="color"] {
    width: 34px; height: 30px; padding: 2px;
    border: 1px solid var(--border); border-radius: 6px;
    background: var(--bg-primary); cursor: pointer;
}
.cv-prop-btn {
    flex: 1; padding: .4rem .5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-primary);
    color: var(--text-secondary);
    font-size: .78rem; font-weight: 700;
    cursor: pointer; text-align: center;
    transition: border-color .15s, color .15s;
}
.cv-prop-btn:hover { border-color: var(--accent); color: var(--accent); }
.cv-prop-btn.active { background: rgba(108,99,255,.15); border-color: var(--accent); color: var(--accent); }
.cv-prop-divider { height: 1px; background: var(--border); margin: .2rem 0; }

/* Palette de couleurs rapide */
.cv-color-palette {
    display: flex; gap: .3rem; flex-wrap: wrap;
}
.cv-color-swatch {
    width: 22px; height: 22px; border-radius: 50%;
    cursor: pointer; border: 2px solid transparent;
    transition: transform .12s, border-color .12s;
    flex-shrink: 0;
}
.cv-color-swatch:hover { transform: scale(1.2); }
.cv-color-swatch.active { border-color: white; transform: scale(1.15); }

/* ── FAB MOBILE ──────────────────────────────────────────────────── */
.cv-mobile-fab {
    display: none;
    position: fixed;
    bottom: 80px;
    right: 1rem;
    z-index: 500;
    flex-direction: column-reverse;
    align-items: center;
    gap: .5rem;
}
.cv-fab-main {
    width: 50px; height: 50px;
    border-radius: 50%;
    background: var(--accent-gradient);
    border: none; color: white;
    font-size: 1.3rem; cursor: pointer;
    box-shadow: 0 4px 20px rgba(108,99,255,.4);
    display: flex; align-items: center; justify-content: center;
    transition: transform .2s;
    z-index: 2;
}
.cv-fab-main.open { transform: rotate(45deg); }
.cv-fab-menu {
    display: flex; flex-direction: column-reverse;
    gap: .45rem; align-items: center;
    max-height: 0; overflow: hidden;
    transition: max-height .3s cubic-bezier(.4,0,.2,1);
}
.cv-fab-menu.open { max-height: 500px; }
.cv-fab-menu button {
    width: 42px; height: 42px; border-radius: 50%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-primary); font-size: .9rem;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    box-shadow: var(--shadow);
    transition: background .15s, border-color .15s;
}
.cv-fab-menu button:hover { background: var(--bg-primary); border-color: var(--accent); }

/* ── RESPONSIVE ──────────────────────────────────────────────────── */
@media (max-width: 900px) {
    .boards-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 1rem; }
}

@media (max-width: 768px) {
    /* Toolbar compacte */
    .cv-toolbar { height: 48px; padding: 0 .5rem; gap: .25rem; }
    .cv-title-input { width: 110px; font-size: .85rem; }
    .cv-save-label { display: none; }
    .cv-btn-save { width: 34px; padding: 0; }

    /* Outils : masquer les séparateurs et certains outils sur mobile */
    .cv-separator { display: none; }
    .cv-tools { gap: .1rem; }

    /* Panneau props : bottom sheet sur mobile */
    .cv-props-panel {
        right: 0 !important;
        bottom: -100%;
        top: auto;
        width: 100%;
        max-height: 55vh;
        border-left: none;
        border-top: 1px solid var(--border);
        border-radius: var(--radius) var(--radius) 0 0;
        transition: bottom .25s cubic-bezier(.4,0,.2,1);
    }
    .cv-props-panel.open { bottom: 0px; }

    /* FAB visible sur mobile */
    .cv-mobile-fab { display: flex; }

    /* Masquer outils toolbar sur mobile (on utilise le FAB) */
    #cvTools { display: none; }

    .boards-grid { grid-template-columns: repeat(2, 1fr); gap: .75rem; }
    .board-preview { aspect-ratio: 4/3; font-size: 2rem; }
}

@media (max-width: 400px) {
    .boards-grid { grid-template-columns: 1fr 1fr; gap: .6rem; }
    .cv-title-input { width: 80px; font-size: .8rem; }
    .cv-zoom-ctrl { display: none; }
}

/* ── ANIMATIONS ──────────────────────────────────────────────────── */
@keyframes cvElEnter {
    from { opacity: 0; transform: scale(.88); }
    to   { opacity: 1; transform: scale(1); }
}
.cv-el { animation: cvElEnter .18s ease; }

/* Indicateur sauvegarde */
.cv-save-dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: #fdcb6e; display: inline-block;
    margin-left: .3rem; animation: cvBlink 1s infinite;
}
@keyframes cvBlink { 0%,100%{opacity:1} 50%{opacity:.2} }
.cv-save-dot.saved { background: #00b894; animation: none; }