/* Variables CSS pour les couleurs et transitions */
:root {
    --primary: #4361ee;
    --primary-light: #4895ef;
    --primary-dark: #3f37c9;
    --secondary: #f72585;
    --secondary-light: #ff758f;
    --success: #4cc9f0;
    --warning: #ffd166;
    --danger: #ef476f;
    --light: #f8f9fa;
    --dark: #212529;
    --gray: #dee2e6;
    --gray-dark: #343a40;
    --white: #ffffff;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --radius: 8px;
    --transition: all 0.2s ease-in-out;
    --highlight: rgba(67, 97, 238, 0.15);
    --highlight-active: rgba(67, 97, 238, 0.3);
    --border: #e9ecef;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f0f2f5;
    color: var(--dark);
    line-height: 1.6;
    font-size: 16px;
}

/* Layout principal */
.container {
    display: flex;
    min-height: 100vh;
    position: relative;
}

header {
    background-color: var(--primary);
    color: var(--white);
    padding: 1rem 2rem;
    position: fixed;
    width: 100%;
    z-index: 100;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo i {
    font-size: 1.5rem;
}

/* Sidebar */
.sidebar {
    width: 360px;
    background-color: var(--white);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    overflow-y: auto;
    padding-top: 5rem;
    border-right: 1px solid var(--border);
}

/* Contenu principal */
.main-content {
    flex: 1;
    margin-left: 360px;
    padding: 2rem;
    padding-top: 5rem;
}

/* Conteneur du document */
.document-container {
    background-color: var(--white);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
    min-height: 80vh;
    overflow-y: auto;
}

/* Stylisation de boutons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border-radius: var(--radius);
    font-weight: 500;
    font-size: 0.9rem;
    height: 2.5rem;
    padding: 0 1.25rem;
    transition: var(--transition);
    cursor: pointer;
    border: none;
}

.btn i {
    font-size: 1rem;
}

.btn-primary {
    background-color: var(--primary);
    color: var(--white);
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    box-shadow: 0 2px 8px rgba(67, 97, 238, 0.3);
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: var(--secondary);
    color: var(--white);
}

.btn-secondary:hover {
    background-color: var(--secondary-light);
    box-shadow: 0 2px 8px rgba(247, 37, 133, 0.3);
    transform: translateY(-1px);
}

.btn-success {
    background-color: var(--success);
    color: var(--white);
}

.btn-success:hover {
    background-color: #3dbeeb;
    box-shadow: 0 2px 8px rgba(76, 201, 240, 0.3);
    transform: translateY(-1px);
}

.btn-outline {
    background-color: transparent;
    border: 1px solid var(--primary);
    color: var(--primary);
}

.btn-outline:hover {
    background-color: var(--primary);
    color: var(--white);
    box-shadow: 0 2px 8px rgba(67, 97, 238, 0.2);
    transform: translateY(-1px);
}

.btn-active {
    background-color: var(--primary);
    color: var(--white);
}

.btn-icon {
    width: 2.5rem;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Conteneur de téléversement */
.upload-area {
    border: 2px dashed var(--primary-light);
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
    transition: var(--transition);
    margin-bottom: 1.5rem;
    background-color: rgba(67, 97, 238, 0.05);
    cursor: pointer;
}

.upload-area:hover {
    border-color: var(--primary);
    background-color: rgba(67, 97, 238, 0.1);
}

.upload-area i {
    font-size: 2.5rem;
    color: var(--primary);
    margin-bottom: 1rem;
}

.upload-area p {
    color: var(--dark);
    margin-bottom: 0.5rem;
}

.upload-area span {
    font-size: 0.875rem;
    color: var(--gray-dark);
}

.file-input {
    display: none;
}

.file-info {
    display: flex;
    align-items: center;
    background-color: rgba(67, 97, 238, 0.05);
    padding: 0.75rem;
    border-radius: var(--radius);
    margin-top: 1rem;
}

.file-info i {
    color: var(--primary);
    margin-right: 0.75rem;
    font-size: 1.5rem;
}

.file-info-content {
    flex: 1;
}

.file-name {
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.file-meta {
    font-size: 0.75rem;
    color: var(--gray-dark);
}

/* Barre d'outils */
.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.625rem;
    margin-bottom: 1.5rem;
}

.toolbar-group {
    display: flex;
    gap: 0.5rem;
}

.divider {
    width: 1px;
    background-color: var(--border);
    margin: 0 0.5rem;
}

/* Cards et éléments du sidebar */
.card {
    background-color: var(--white);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: var(--transition);
    margin-bottom: 1rem;
    border: 1px solid var(--border);
}

.card:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.card-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    background-color: rgba(67, 97, 238, 0.03);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-title i {
    color: var(--primary);
}

.card-actions {
    display: flex;
    gap: 0.5rem;
}

.card-content {
    padding: 1rem;
}

/* Formulaires */
.form-group {
    margin-bottom: 1rem;
}

.form-group:last-child {
    margin-bottom: 0;
}

.label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--gray-dark);
}

.input {
    display: block;
    width: 100%;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background-color: var(--white);
    padding: 0.625rem 0.75rem;
    font-size: 0.9375rem;
    transition: var(--transition);
}

.input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.15);
}

/* Highlight du texte */
.highlight {
    background-color: var(--highlight);
    border-radius: 3px;
    padding: 0 2px;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.highlight:hover {
    background-color: var(--highlight-active);
}

.highlight.active {
    background-color: var(--highlight-active);
    outline: 2px solid var(--primary);
}

.highlight-tooltip {
    position: absolute;
    top: -24px;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--dark);
    color: var(--white);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
}

.highlight:hover .highlight-tooltip {
    opacity: 1;
}

/* Mode sélection */
.selection-mode-indicator {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.75rem;
    background-color: rgba(67, 97, 238, 0.1);
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    border: 1px solid rgba(67, 97, 238, 0.2);
}

.selection-mode-indicator i {
    color: var(--primary);
    font-size: 1.25rem;
}

.selection-mode-indicator.active {
    background-color: rgba(67, 97, 238, 0.2);
    border-color: var(--primary);
}

/* Popup pour sélection de type */
.popup {
    position: absolute; /* au lieu de fixed */
    background-color: var(--white);
    border-radius: var(--radius);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
    padding: 1.25rem;
    z-index: 50;
    width: 300px;
    animation: fadeIn 0.2s;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.popup-header {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.popup-header i {
    color: var(--primary);
}

.popup-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1rem;
}

/* Select */
.select {
    display: block;
    width: 100%;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background-color: var(--white);
    padding: 0.625rem 0.75rem;
    font-size: 0.9375rem;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23212529' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px;
    padding-right: 2.5rem;
    transition: var(--transition);
}

.select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.15);
}

/* Status message */
.status-message {
    padding: 0.875rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.status-message i {
    font-size: 1.25rem;
}

.status-success {
    background-color: rgba(76, 201, 240, 0.15);
    color: #0b7285;
    border: 1px solid rgba(76, 201, 240, 0.3);
}

.status-success i {
    color: var(--success);
}

.status-error {
    background-color: rgba(239, 71, 111, 0.15);
    color: #a3133a;
    border: 1px solid rgba(239, 71, 111, 0.3);
}

.status-error i {
    color: var(--danger);
}

.status-info {
    background-color: rgba(67, 97, 238, 0.15);
    color: #233499;
    border: 1px solid rgba(67, 97, 238, 0.3);
}

.status-info i {
    color: var(--primary);
}

/* Instructions */
.instructions {
    background-color: var(--white);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border);
}

.instructions h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--primary-dark);
}

.instructions h3 i {
    color: var(--primary);
}

.instructions-steps {
    counter-reset: step;
}

.instruction-step {
    display: flex;
    margin-bottom: 0.75rem;
    position: relative;
    padding-left: 2.5rem;
}

.instruction-step:before {
    counter-increment: step;
    content: counter(step);
    position: absolute;
    left: 0;
    top: 0;
    width: 1.75rem;
    height: 1.75rem;
    background-color: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 600;
}

.instruction-step-content {
    flex: 1;
}

.instruction-step-title {
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.instruction-step-desc {
    font-size: 0.875rem;
    color: var(--gray-dark);
}

/* Messages initiaux */
.initial-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    text-align: center;
    color: var(--gray-dark);
}

.initial-message i {
    font-size: 4rem;
    color: var(--primary-light);
    margin-bottom: 1.5rem;
}

.initial-message h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--dark);
}

.initial-message p {
    max-width: 30rem;
    margin-bottom: 1.5rem;
}

/* Animation highlight */
@keyframes pulse {
    0% { background-color: var(--highlight); }
    50% { background-color: var(--highlight-active); }
    100% { background-color: var(--highlight); }
}

.pulse {
    animation: pulse 1.5s infinite;
}

/* Les champs pour "Aides Habitat" auront une couleur spéciale */
.highlight[data-field-type="company_name"] {
    background-color: rgba(76, 201, 240, 0.15);
}

.highlight[data-field-type="company_name"]:hover {
    background-color: rgba(76, 201, 240, 0.3);
}

.highlight[data-field-type="company_name"].active {
    background-color: rgba(76, 201, 240, 0.3);
    outline: 2px solid var(--success);
}

/* Badge pour les types de champs */
.field-type-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    background-color: rgba(67, 97, 238, 0.1);
    color: var(--primary);
    margin-left: 0.5rem;
}

.field-type-badge[data-type="company_name"] {
    background-color: rgba(76, 201, 240, 0.15);
    color: #0b7285;
}

.field-type-badge[data-type="siret"] {
    background-color: rgba(255, 209, 102, 0.15);
    color: #7a4f01;
}

.field-type-badge[data-type="address"] {
    background-color: rgba(239, 71, 111, 0.15);
    color: #a3133a;
}

/* No fields message */
.no-fields-message {
    text-align: center;
    padding: 2rem;
    color: var(--gray-dark);
}

.no-fields-message i {
    font-size: 3rem;
    color: var(--gray);
    margin-bottom: 1rem;
}

.no-fields-message p {
    margin-bottom: 0.5rem;
}

/* Éléments additionnels */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 40;
    display: none;
    backdrop-filter: blur(2px);
}

/* Responsivité */
@media (max-width: 1200px) {
    .sidebar {
        width: 320px;
    }
    .main-content {
        margin-left: 320px;
    }
}

@media (max-width: 992px) {
    .sidebar {
        width: 280px;
    }
    .main-content {
        margin-left: 280px;
        padding: 1.5rem;
        padding-top: 5rem;
    }
    .document-container {
        padding: 1.5rem;
    }
}