﻿:root {
    --bg-app: #f3f7fb;
    --bg-panel: #ffffff;
    --bg-header: #0f172a;
    --bg-header-soft: #1e293b;
    --bg-accent: #2563eb;
    --bg-accent-hover: #1d4ed8;
    --bg-success-soft: #d1fae5;
    --bg-danger: #ef4444;
    --bg-danger-hover: #dc2626;
    --border: #dbe4ee;
    --border-strong: #bfd0e2;
    --text-main: #0f172a;
    --text-soft: #64748b;
    --text-white: #ffffff;
    --shadow-sm: 0 2px 10px rgba(15, 23, 42, 0.05);
    --shadow-md: 0 10px 30px rgba(15, 23, 42, 0.08);
    --radius-xl: 20px;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    height: 100%;
    font-family: Inter, Arial, Helvetica, sans-serif;
    background: var(--bg-app);
    color: var(--text-main);
}

body {
    overflow: hidden;
}

button,
input,
select {
    font: inherit;
}

.app-shell {
    display: flex;
    flex-direction: column;
    height: 100vh;
    min-height: 0;
}

.topbar {
    min-height: 76px;
    background: linear-gradient(135deg, #0f172a 0%, #172554 55%, #0f172a 100%);
    color: var(--text-white);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 22px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    box-shadow: var(--shadow-sm);
    gap: 20px;
    flex-shrink: 0;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
}

.brand-mark {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: linear-gradient(135deg, #2563eb 0%, #06b6d4 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.28);
    flex-shrink: 0;
}

.brand-mark-icon {
    position: relative;
    width: 22px;
    height: 24px;
}

    .brand-mark-icon::before,
    .brand-mark-icon::after {
        content: "";
        position: absolute;
        background: white;
        border-radius: 3px;
    }

    .brand-mark-icon::before {
        left: 0;
        top: 0;
        width: 15px;
        height: 20px;
        opacity: 0.95;
    }

    .brand-mark-icon::after {
        right: 0;
        bottom: 0;
        width: 15px;
        height: 20px;
        opacity: 0.7;
        transform: translate(2px, 2px);
    }

.brand-stack {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.logo {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1;
}

.project-name {
    font-size: 13px;
    color: rgba(255,255,255,0.78);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 300px;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.user-box {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255,255,255,0.08);
    color: var(--text-white);
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.1);
    max-width: 320px;
    backdrop-filter: blur(4px);
}

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 999px;
    background: linear-gradient(135deg, #2563eb 0%, #06b6d4 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.25);
    flex-shrink: 0;
}

.user-avatar-doc {
    position: relative;
    width: 16px;
    height: 18px;
}

    .user-avatar-doc::before,
    .user-avatar-doc::after {
        content: "";
        position: absolute;
        border-radius: 2px;
        background: #fff;
    }

    .user-avatar-doc::before {
        width: 12px;
        height: 16px;
        left: 0;
        top: 0;
        opacity: 0.95;
    }

    .user-avatar-doc::after {
        width: 12px;
        height: 16px;
        right: 0;
        bottom: 0;
        opacity: 0.65;
        transform: translate(2px, 2px);
    }

    .user-avatar-doc span {
        position: absolute;
        left: 7px;
        top: 2px;
        width: 2px;
        height: 14px;
        background: rgba(15, 23, 42, 0.18);
        border-radius: 999px;
        z-index: 2;
    }

.user-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 1px;
}

.user-email {
    font-size: 12px;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #ffffff;
}

.user-status {
    font-size: 11px;
    color: rgba(255,255,255,0.72);
    line-height: 1.1;
}

.futuristic-user-box {
    display: flex;
    align-items: center;
    gap: 9px;
    background: linear-gradient(135deg, rgba(255,255,255,0.10) 0%, rgba(255,255,255,0.05) 100%);
    color: var(--text-white);
    padding: 7px 11px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.12);
    max-width: 300px;
    backdrop-filter: blur(6px);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
}

.futuristic-avatar {
    width: 36px;
    height: 36px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: radial-gradient(circle at 30% 30%, #a78bfa 0%, #2563eb 45%, #06b6d4 100%);
    box-shadow: 0 0 0 1px rgba(255,255,255,0.10), 0 8px 18px rgba(37, 99, 235, 0.30), 0 0 18px rgba(6, 182, 212, 0.22);
    position: relative;
}

    .futuristic-avatar::after {
        content: "";
        position: absolute;
        inset: 3px;
        border-radius: 999px;
        border: 1px solid rgba(255,255,255,0.10);
        pointer-events: none;
    }

.futuristic-avatar-core {
    position: relative;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.futuristic-doc-stack {
    position: relative;
    width: 18px;
    height: 18px;
}

    .futuristic-doc-stack .doc-back,
    .futuristic-doc-stack .doc-front {
        position: absolute;
        display: block;
        border-radius: 3px;
        background: rgba(255,255,255,0.95);
    }

    .futuristic-doc-stack .doc-back {
        width: 11px;
        height: 14px;
        left: 1px;
        top: 2px;
        opacity: 0.55;
        transform: translate(3px, 1px);
    }

    .futuristic-doc-stack .doc-front {
        width: 11px;
        height: 14px;
        left: 2px;
        top: 1px;
        opacity: 0.98;
    }

    .futuristic-doc-stack .doc-split-line {
        position: absolute;
        display: block;
        width: 2px;
        height: 12px;
        left: 8px;
        top: 2px;
        border-radius: 999px;
        background: rgba(15, 23, 42, 0.20);
        z-index: 3;
        box-shadow: 0 0 8px rgba(6, 182, 212, 0.22);
    }

.user-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 1px;
}

.user-email {
    font-size: 13px;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #ffffff;
}

.user-status {
    font-size: 11px;
    color: rgba(255,255,255,0.72);
    line-height: 1.1;
    white-space: nowrap;
}

.btn {
    border: 1px solid transparent;
    border-radius: 12px;
    padding: 10px 15px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
    transition: 0.18s ease;
    box-shadow: none;
}

    .btn:hover {
        transform: translateY(-1px);
    }

    .btn:disabled {
        opacity: 0.55;
        cursor: not-allowed;
        transform: none;
    }

.btn-primary {
    background: var(--bg-accent);
    color: var(--text-white);
}

    .btn-primary:hover {
        background: var(--bg-accent-hover);
    }

.btn-secondary {
    background: var(--bg-header-soft);
    color: var(--text-white);
    border-color: rgba(255,255,255,0.08);
}

    .btn-secondary:hover {
        background: #334155;
    }

.btn-light {
    background: #ffffff;
    color: var(--text-main);
    border-color: var(--border);
}

    .btn-light:hover {
        background: #f8fafc;
        border-color: var(--border-strong);
    }

.workspace {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 18px;
    padding: 18px;
    height: calc(100vh - 76px);
    min-height: 0;
}

.panel {
    background: var(--bg-panel);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

/* Panneau gauche : structure en 2 zones */
.panel-left {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    min-height: 0;
}

.panel-left-top {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 12px 12px 12px 12px;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
    min-height: 0;
}


.sidebar-projects-status {
    color: #6b7280;
    font-size: 13px;
    margin-top: 8px;
}

.sidebar-projects-actions {
    margin-top: 10px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.pdf-pages-header {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-shrink: 0;
}

.panel-content {
    padding: 14px;
    overflow: auto;
    min-height: 0;
    flex: 1 1 auto;
}

.panel-left-content {
    min-height: 0;
    overflow: auto;
}

.panel-header {
    padding: 18px 18px 14px 18px;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
    flex-shrink: 0;
}

.panel-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.panel-title {
    font-size: 16px;
    font-weight: 800;
    letter-spacing: -0.01em;
    color: var(--text-main);
}

.panel-subtitle {
    font-size: 13px;
    color: var(--text-soft);
}

.thumb-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
    align-content: start;
}

.thumb-card {
    border: 1px solid var(--border);
    border-radius: 14px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    padding: 8px;
    cursor: pointer;
    transition: 0.18s ease;
    box-shadow: 0 2px 10px rgba(15,23,42,0.03);
}

    .thumb-card:hover {
        border-color: #93c5fd;
        box-shadow: 0 10px 24px rgba(37, 99, 235, 0.10);
        transform: translateY(-1px);
    }

    .thumb-card.selected {
        border-color: var(--bg-accent);
        background: linear-gradient(180deg, #eff6ff 0%, #f8fbff 100%);
        box-shadow: 0 10px 24px rgba(37, 99, 235, 0.16);
    }

    .thumb-card.assigned {
        box-shadow: inset 0 0 0 1px #10b981;
    }

.thumb-preview {
    height: 160px;
    border-radius: 10px;
    background: linear-gradient(180deg, #ffffff 0%, #edf3f8 100%);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-soft);
    font-size: 13px;
    margin-bottom: 10px;
    overflow: hidden;
}

    .thumb-preview img {
        max-width: 100%;
        max-height: 100%;
        display: block;
    }

.thumb-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.thumb-status {
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 999px;
    background: #e2e8f0;
    color: #334155;
    font-weight: 700;
}

    .thumb-status.assigned {
        background: var(--bg-success-soft);
        color: #065f46;
    }

.right-panel-header-actions {
    display: flex;
    gap: 10px;
}

.documents-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.document-bin {
    border: 1px solid var(--border);
    border-radius: 16px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    overflow: hidden;
    box-shadow: 0 4px 18px rgba(15,23,42,0.04);
}

.document-bin-header {
    padding: 14px 16px;
    background: linear-gradient(180deg, #f8fbff 0%, #eef6ff 100%);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--border);
}

.document-bin-title {
    font-size: 15px;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.01em;
}

.document-bin-count {
    font-size: 12px;
    color: var(--text-soft);
    margin-top: 3px;
}

.document-bin-body {
    padding: 14px;
    min-height: 96px;
}

.document-pages {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.doc-thumb {
    width: 118px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    padding: 6px;
    text-align: center;
    font-size: 12px;
    position: relative;
    min-height: 162px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    box-shadow: 0 2px 10px rgba(15,23,42,0.03);
}

.doc-thumb-preview {
    height: 118px;
    border: 1px solid #e5edf5;
    border-radius: 8px;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.doc-thumb-image {
    max-width: 100%;
    max-height: 100%;
    display: block;
}

.doc-thumb-fallback {
    color: var(--text-soft);
    font-size: 12px;
    padding: 8px;
}

.doc-thumb-label {
    font-size: 12px;
    color: #334155;
    font-weight: 600;
}

.doc-thumb-remove {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 20px;
    height: 20px;
    border: none;
    border-radius: 999px;
    background: var(--bg-danger);
    color: #fff;
    font-size: 12px;
    line-height: 20px;
    cursor: pointer;
    padding: 0;
    box-shadow: 0 6px 12px rgba(239,68,68,0.25);
}

    .doc-thumb-remove:hover {
        background: var(--bg-danger-hover);
    }

.empty-state {
    color: var(--text-soft);
    font-size: 13px;
    font-style: italic;
}

.selection-bar {
    display: none;
    position: fixed;
    left: 50%;
    bottom: 20px;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.96);
    color: #fff;
    padding: 14px 16px;
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    z-index: 50;
    align-items: center;
    gap: 12px;
    border: 1px solid rgba(255,255,255,0.08);
}

    .selection-bar.visible {
        display: flex;
    }

.selection-count {
    font-size: 14px;
    font-weight: 800;
}

.modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.50);
    z-index: 100;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

    .modal-backdrop.visible {
        display: flex;
    }

.modal {
    width: 460px;
    max-width: calc(100vw - 30px);
    background: #fff;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(15,23,42,0.20);
    border: 1px solid rgba(255,255,255,0.5);
}

.modal-header {
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -0.01em;
}

.modal-body {
    padding: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

    .form-group label {
        font-size: 14px;
        font-weight: 700;
        color: var(--text-main);
    }

    .form-group input,
    .form-group select {
        height: 44px;
        border: 1px solid var(--border);
        border-radius: 12px;
        padding: 0 14px;
        font-size: 14px;
        background: #fff;
        color: var(--text-main);
        transition: 0.16s ease;
    }

        .form-group input:focus,
        .form-group select:focus {
            outline: none;
            border-color: #60a5fa;
            box-shadow: 0 0 0 4px rgba(37,99,235,0.10);
        }

.field-error {
    color: #b91c1c;
    font-size: 13px;
    margin-top: 10px;
    display: none;
}

.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    background: #fcfdff;
}
    
.my-projects-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.my-project-item {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 14px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.my-project-item-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.my-project-item-title {
    font-size: 15px;
    font-weight: 800;
    color: var(--text-main);
}

.my-project-item-meta {
    font-size: 12px;
    color: var(--text-soft);
}

.my-project-item-id {
    font-size: 12px;
    color: #94a3b8;
    font-family: Consolas, monospace;
}

.sidebar-projects-card {
    border: 1px solid var(--border);
    border-radius: 14px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    padding: 10px 12px;
    box-shadow: 0 2px 10px rgba(15,23,42,0.03);
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.sidebar-projects-collapsible {
    padding: 10px 12px;
}
 
.sidebar-projects-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    border: none;
    background: transparent;
    padding: 0;
    cursor: pointer;
    font-size: 14px;
    font-weight: 800;
    color: var(--text-main);
    text-align: left;
}

.sidebar-projects-toggle-icon {
    width: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--bg-accent);
    font-size: 13px;
    flex-shrink: 0;
}

.sidebar-projects-hint {
    margin-top: 6px;
}

.sidebar-projects-card.expanded .sidebar-projects-body {
    display: block;
}

.sidebar-projects-card.expanded .sidebar-projects-hint {
    display: none;
}

.sidebar-project-delete:hover {
        background: var(--bg-danger-hover);
    }

.sidebar-projects-body {
    display: none;
    margin-top: 10px;
    max-height: 118px;
    overflow: hidden;
}

.sidebar-projects-card.expanded .sidebar-projects-body {
    display: block;
}

.sidebar-projects-card.expanded .sidebar-projects-hint {
    display: none;
}

.sidebar-projects-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 118px;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 6px;
    scrollbar-gutter: stable;
}

.sidebar-project-item {
    border: 1px solid var(--border);
    border-radius: 10px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    padding: 7px 9px;
    cursor: pointer;
    transition: 0.16s ease;
    box-shadow: 0 2px 8px rgba(15,23,42,0.03);
    overflow: hidden;
    min-height: 34px;
}

    .sidebar-project-item:hover {
        background: #eef4ff;
        border-color: #93c5fd;
        transform: translateY(-1px);
    }

    .sidebar-project-item.active {
        background: #dbeafe;
        border-color: var(--bg-accent);
        box-shadow: 0 10px 22px rgba(37,99,235,0.12);
    }

.sidebar-project-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-width: 0;
}

.sidebar-project-main {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    min-width: 0;
    overflow: hidden;
}

.sidebar-project-title {
    font-size: 11px;
    font-weight: 800;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    line-height: 1.2;
}

.sidebar-project-meta {
    font-size: 10px;
    color: var(--text-soft);
    white-space: nowrap;
    flex-shrink: 0;
    line-height: 1.2;
}

.sidebar-project-delete {
    border: none;
    background: var(--bg-danger);
    color: #fff;
    width: 18px;
    height: 18px;
    border-radius: 999px;
    cursor: pointer;
    font-size: 12px;
    line-height: 18px;
    padding: 0;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 8px rgba(239,68,68,0.22);
}

    .sidebar-project-delete:hover {
        background: var(--bg-danger-hover);
    }

.sidebar-project-item:hover {
        background: #eef4ff;
        border-color: #93c5fd;
        transform: translateY(-1px);
    }

.sidebar-project-item.active {
        background: #dbeafe;
        border-color: var(--bg-accent);
        box-shadow: 0 10px 22px rgba(37,99,235,0.12);
    }

.sidebar-project-delete:hover {
        background: var(--bg-danger-hover);
    }

.btn-success {
    background: #10b981;
    color: #ffffff;
    border-color: transparent;
}

.btn-success:hover {
        background: #059669;
    }

.sidebar-projects-list::-webkit-scrollbar {
    width: 8px;
}

.sidebar-projects-list::-webkit-scrollbar-track {
    background: #eef2f7;
    border-radius: 999px;
}

.sidebar-projects-list::-webkit-scrollbar-thumb {
    background: #94a3b8;
    border-radius: 999px;
}

    .sidebar-projects-list::-webkit-scrollbar-thumb:hover {
        background: #64748b;
    }

@media (max-width: 1200px) {
    .workspace {
        grid-template-columns: 340px 1fr;
    }
}

@media (max-width: 980px) {
    .workspace {
        grid-template-columns: 1fr;
        height: auto;
        overflow: auto;
    }

    body {
        overflow: auto;
    }

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

    .topbar-right {
        display: flex;
        align-items: center;
        gap: 8px;
        flex-wrap: nowrap;
        justify-content: flex-end;
        min-width: 0;
    }

    .btn-topbar {
        padding: 8px 12px;
        font-size: 13px;
        border-radius: 10px;
        white-space: nowrap;
        line-height: 1.1;
    }

    .panel-left {
        min-height: 600px;
    }

    
    
}
