/* === Reset & Base === */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --primary: #188ecd;
    --primary-dark: #126fa3;
    --primary-light: #e8f0fe;
    --danger: #d32f2f;
    --success: #2e7d32;
    --gray-50: #fafafa;
    --gray-100: #f5f5f5;
    --gray-200: #eeeeee;
    --gray-300: #e0e0e0;
    --gray-500: #9e9e9e;
    --gray-700: #616161;
    --gray-900: #212121;
    --radius: 6px;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--gray-100);
    color: var(--gray-900);
    line-height: 1.5;
    min-height: 100vh;
}

/* === Login === */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1rem;
}

.login-card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2.5rem;
    width: 100%;
    max-width: 400px;
}

.login-card h1 {
    color: var(--primary);
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.login-subtitle {
    color: var(--gray-500);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

/* === Forms === */
.form-field {
    margin-bottom: 1rem;
}

.form-field label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.3rem;
    font-size: 0.9rem;
    color: var(--gray-700);
}

.form-field input,
.form-field select,
.form-field textarea {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 0.95rem;
    transition: border-color 0.2s;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(24, 142, 205, 0.1);
}

/* === Buttons === */
.btn {
    display: inline-block;
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s;
}

.btn-primary {
    background: var(--primary);
    color: white;
    width: 100%;
}

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

.btn-secondary {
    background: var(--gray-200);
    color: var(--gray-900);
}

.btn-secondary:hover {
    background: var(--gray-300);
}

/* === Messages === */
.error-message {
    background: #fdecea;
    color: var(--danger);
    padding: 0.6rem 0.75rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.success-message {
    background: #e8f5e9;
    color: var(--success);
    padding: 0.6rem 0.75rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.info-message {
    background: var(--primary-light);
    color: var(--primary);
    padding: 0.6rem 0.75rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

/* === Layout principal === */
.app-header {
    background: white;
    border-bottom: 1px solid var(--gray-200);
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.app-header h1 {
    color: var(--primary);
    font-size: 1.2rem;
}

.app-header a {
    color: var(--gray-500);
    text-decoration: none;
    font-size: 0.85rem;
}

.app-header a:hover {
    color: var(--gray-700);
}

.app-main {
    max-width: 720px;
    margin: 2rem auto;
    padding: 0 1rem;
}

/* === Sections === */
.section {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.section h2 {
    font-size: 1.1rem;
    color: var(--primary);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary-light);
}

/* === Champs dynamiques === */
.dynamic-fields {
    display: grid;
    gap: 0.75rem;
}

.field-required label::after {
    content: " *";
    color: var(--danger);
}

/* === Spinner / Loading === */
.loading {
    display: none;
    text-align: center;
    padding: 1rem;
    color: var(--gray-500);
}

.loading.active {
    display: block;
}

/* === Upload zone === */
.upload-zone {
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.upload-zone:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

/* === Sous-sections === */
.subsection-title {
    font-size: 0.95rem;
    color: var(--gray-700);
    margin-bottom: 0.25rem;
    font-weight: 600;
}

.subsection-desc {
    color: var(--gray-500);
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
}

.section-divider {
    border: none;
    border-top: 1px solid var(--gray-200);
    margin: 1.5rem 0;
}

/* === Tableau PDF exemples === */
.pdf-list-container {
    margin-top: 1rem;
}

.pdf-list {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.pdf-list th {
    text-align: left;
    padding: 0.5rem 0.75rem;
    border-bottom: 2px solid var(--gray-200);
    color: var(--gray-700);
    font-weight: 600;
    font-size: 0.85rem;
}

.pdf-list td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--gray-200);
}

.pdf-list tr:last-child td {
    border-bottom: none;
}

/* === Badges statut === */
.status-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
}

.status-uploaded {
    background: #fff3e0;
    color: #e65100;
}

.status-ready {
    background: #e8f5e9;
    color: var(--success);
}

/* === Responsive === */
@media (max-width: 600px) {
    .app-main {
        margin: 1rem auto;
    }

    .section {
        padding: 1rem;
    }
}
