/* ===== VARIABLES ===== */
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #3b82f6;
    --secondary: #64748b;
    --success: #22c55e;
    --success-dark: #16a34a;
    --danger: #ef4444;
    --danger-dark: #dc2626;
    --warning: #f59e0b;
    --info: #06b6d4;
    --light: #f8fafc;
    --dark: #1e293b;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --white: #ffffff;
    --shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.08);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
    --radius: 8px;
    --radius-lg: 12px;
    --header-height: 60px;
}

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

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--gray-100);
    color: var(--dark);
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
}

a {
    color: var(--primary);
    text-decoration: none;
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 500;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
}
.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--gray-200);
    color: var(--gray-700);
}
.btn-secondary:hover:not(:disabled) {
    background: var(--gray-300);
}

.btn-success {
    background: var(--success);
    color: var(--white);
}
.btn-success:hover:not(:disabled) {
    background: var(--success-dark);
}

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

/* Anti-spam: Loading state */
.btn.loading,
.action-btn.loading,
button.loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.btn.loading::after,
.action-btn.loading::after,
button.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.btn-icon {
    padding: 12px;
    min-width: 48px;
    min-height: 48px;
}

.btn-large {
    padding: 16px 32px;
    font-size: 1.125rem;
}

.btn-block {
    width: 100%;
}

/* ===== FORMS ===== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--gray-700);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 14px 16px;
    font-size: 1rem;
    border: 2px solid var(--gray-300);
    border-radius: var(--radius);
    background: var(--white);
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.form-group input.full-width,
.form-group textarea.full-width {
    width: 100%;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
}

.checkbox-group label,
.checkbox-inline label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.checkbox-group input[type="checkbox"],
.checkbox-inline input[type="checkbox"] {
    width: 20px;
    height: 20px;
}

.password-input {
    position: relative;
}

.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.25rem;
}

/* CAPTCHA styling */
.captcha-group {
    background: var(--gray-100);
    padding: 12px 16px;
    border-radius: var(--radius);
    border: 2px dashed var(--gray-300);
}

.captcha-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--gray-700);
}

.captcha-group input {
    max-width: 100px;
    text-align: center;
    font-size: 1.25rem;
    font-weight: 600;
}

.error-message {
    background: #fef2f2;
    color: var(--danger);
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    border: 1px solid #fecaca;
}

/* ===== HEADER ===== */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--white);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
}

.logo-icon {
    font-size: 1.5rem;
}

.nav {
    display: flex;
    gap: 8px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    color: var(--gray-600);
    border-radius: var(--radius);
    transition: all 0.2s;
    font-weight: 500;
}

.nav-link:hover {
    background: var(--gray-100);
    color: var(--primary);
}

.nav-link.active {
    background: var(--primary);
    color: var(--white);
}

.nav-icon {
    font-size: 1.125rem;
}

.header-right {
    display: flex;
    align-items: center;
}

.user-menu {
    position: relative;
}

.user-menu-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: none;
    border: none;
    cursor: pointer;
    border-radius: var(--radius);
    transition: background 0.2s;
}

.user-menu-btn:hover {
    background: var(--gray-100);
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: var(--primary);
    color: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.user-name {
    font-weight: 500;
    color: var(--gray-700);
}

.user-role {
    color: var(--gray-500);
    font-size: 0.875rem;
}

.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 200px;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 8px;
    display: none;
}

.user-dropdown.show {
    display: block;
}

.user-dropdown-header {
    padding: 12px;
}

.user-dropdown-header strong {
    display: block;
}

.user-dropdown-header small {
    color: var(--gray-500);
}

.user-dropdown hr {
    border: none;
    border-top: 1px solid var(--gray-200);
    margin: 8px 0;
}

.user-dropdown button {
    width: 100%;
    padding: 12px;
    text-align: left;
    background: none;
    border: none;
    cursor: pointer;
    border-radius: var(--radius);
    transition: background 0.2s;
}

.user-dropdown button:hover {
    background: var(--gray-100);
}

.user-dropdown button.danger {
    color: var(--danger);
}

/* ===== MAIN CONTENT ===== */
.main-content {
    margin-top: var(--header-height);
    min-height: calc(100vh - var(--header-height));
    padding: 20px;
}

/* ===== LOGIN PAGE ===== */
.login-page {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 420px;
}

.language-selector {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 24px;
}

.lang-btn {
    padding: 8px 16px;
    background: rgba(255,255,255,0.2);
    color: var(--white);
    border: 2px solid transparent;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.lang-btn:hover {
    background: rgba(255,255,255,0.3);
}

.lang-btn.active {
    background: var(--white);
    color: var(--primary);
}

.login-box {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 40px;
    box-shadow: var(--shadow-lg);
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo {
    font-size: 4rem;
    margin-bottom: 16px;
}

.login-header h1 {
    font-size: 1.75rem;
    color: var(--dark);
    margin-bottom: 8px;
}

.login-header p {
    color: var(--gray-500);
}

.login-footer {
    text-align: center;
    margin-top: 24px;
    color: rgba(255,255,255,0.7);
}

/* ===== SCAN PAGE ===== */
.scan-page {
    max-width: 1200px;
    margin: 0 auto;
}

.scan-header {
    margin-bottom: 24px;
}

.scan-header h1 {
    font-size: 1.5rem;
}

.scan-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

/* Capture section - Native camera */
.capture-section {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow);
    text-align: center;
}

.capture-zone {
    background: linear-gradient(145deg, var(--gray-100), var(--gray-200));
    border: 3px dashed var(--gray-300);
    border-radius: var(--radius-lg);
    padding: 40px 24px;
    margin-bottom: 20px;
    cursor: pointer;
    transition: all 0.2s;
}

.capture-zone:hover {
    border-color: var(--primary);
    background: linear-gradient(145deg, var(--gray-50, #f8fafc), var(--gray-100));
}

.capture-zone:active {
    transform: scale(0.98);
}

.capture-content {
    pointer-events: none;
}

.capture-main-icon {
    font-size: 4rem;
    display: block;
    margin-bottom: 12px;
}

.capture-content p {
    margin: 0;
    color: var(--gray-700);
    font-size: 1.1rem;
    font-weight: 500;
}

.capture-subtitle {
    color: var(--gray-500) !important;
    font-size: 0.9rem !important;
    font-weight: 400 !important;
    margin-top: 4px !important;
}

/* Zone de capture */
.capture-zone {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
}

.capture-row {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
}

.capture-label {
    flex: 1;
    display: block;
    padding: 12px;
    background: var(--gray-100);
    border: 2px solid var(--gray-300);
    border-radius: var(--radius);
    text-align: center;
    font-weight: 500;
}

.capture-label input[type="file"] {
    display: block;
    width: 100%;
    margin-top: 8px;
}

/* Section images capturées */
.captured-section {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow);
}

.captured-section h3 {
    margin-bottom: 16px;
    font-size: 1.125rem;
}

.captured-images {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    min-height: 100px;
    padding: 8px;
    background: var(--gray-100);
    border-radius: var(--radius);
}

.capture-placeholder {
    width: 100%;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border-radius: var(--radius);
    color: var(--gray-500);
}

.captured-image {
    position: relative;
    width: 80px;
    height: 110px;
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    background: var(--white);
    border: 2px solid var(--white);
    transition: transform 0.2s, border-color 0.2s;
}

.captured-image:hover {
    transform: scale(1.05);
    border-color: var(--primary);
}

.captured-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: var(--gray-200);
}

.captured-image .remove-btn {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 20px;
    height: 20px;
    background: var(--danger);
    color: var(--white);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
}

.captured-image:hover .remove-btn {
    opacity: 1;
}

.send-section {
    grid-column: span 2;
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow);
}

.week-navigator {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.week-navigator span {
    font-weight: 600;
    font-size: 1.125rem;
}

.day-selector {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.day-btn {
    flex: 1;
    min-width: 80px;
    padding: 16px 12px;
    background: var(--gray-100);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
}

.day-btn:hover {
    border-color: var(--primary-light);
}

.day-btn.selected {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--white);
}

.day-btn .day-name {
    font-weight: 600;
    display: block;
}

.day-btn .day-date {
    font-size: 0.875rem;
    opacity: 0.8;
}

/* ===== TABLES ===== */
.table-container {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 16px;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}

.data-table th {
    background: var(--gray-50);
    font-weight: 600;
    color: var(--gray-700);
    white-space: nowrap;
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tr:hover {
    background: var(--gray-50);
}

.data-table .loading {
    text-align: center;
    color: var(--gray-500);
    padding: 40px;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
}

.status-badge.active {
    background: #dcfce7;
    color: #166534;
}

.status-badge.inactive {
    background: #fee2e2;
    color: #991b1b;
}

.actions-cell {
    display: flex;
    gap: 8px;
}

.action-btn {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.action-btn:hover {
    transform: scale(1.1);
}

.action-btn.edit {
    background: var(--info);
    color: var(--white);
}

.action-btn.view {
    background: var(--primary);
    color: var(--white);
}

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

.action-btn.toggle {
    background: var(--warning);
    color: var(--white);
}

/* ===== FILTERS ===== */
.filters-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 20px;
    padding: 16px;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    align-items: flex-end;
}

.filter-group {
    flex: 1;
    min-width: 150px;
}

.filter-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--gray-600);
}

.filter-group input,
.filter-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 0.875rem;
}

/* ===== PAGINATION ===== */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
}

.pagination button {
    padding: 10px 16px;
    border: 1px solid var(--gray-300);
    background: var(--white);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
}

.pagination button:hover:not(:disabled) {
    background: var(--gray-100);
}

.pagination button.active {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ===== MODALS ===== */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--white);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-content.modal-small {
    max-width: 400px;
}

.modal-content.modal-large {
    max-width: 800px;
}

.modal-content.modal-fullscreen {
    max-width: 95vw;
    max-height: 95vh;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--gray-200);
}

.modal-header h3 {
    font-size: 1.25rem;
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--gray-100);
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: var(--gray-200);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--gray-200);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.text-center {
    text-align: center;
}

.success-icon {
    font-size: 4rem;
    margin-bottom: 16px;
}

/* ===== ADMIN LAYOUT ===== */
.admin-page {
    display: flex;
    gap: 24px;
    max-width: 1400px;
    margin: 0 auto;
}

.admin-sidebar {
    width: 240px;
    flex-shrink: 0;
}

.admin-nav {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 12px;
    box-shadow: var(--shadow);
    position: sticky;
    top: calc(var(--header-height) + 20px);
}

.admin-nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    color: var(--gray-600);
    border-radius: var(--radius);
    margin-bottom: 4px;
    transition: all 0.2s;
}

.admin-nav-link:hover {
    background: var(--gray-100);
    color: var(--primary);
}

.admin-nav-link.active {
    background: var(--primary);
    color: var(--white);
}

.admin-content {
    flex: 1;
    min-width: 0;
}

.admin-content h1 {
    margin-bottom: 24px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

/* ===== STATS GRID ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 20px;
    text-align: center;
    box-shadow: var(--shadow);
}

.stat-icon {
    font-size: 2rem;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
}

.stat-label {
    color: var(--gray-500);
    font-size: 0.875rem;
}

/* ===== DASHBOARD GRID ===== */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.dashboard-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow);
}

.dashboard-card h3 {
    margin-bottom: 16px;
    font-size: 1.125rem;
}

.recent-list {
    max-height: 300px;
    overflow-y: auto;
}

.recent-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid var(--gray-100);
}

.recent-item:last-child {
    border-bottom: none;
}

.recent-item-info {
    flex: 1;
}

.recent-item-title {
    font-weight: 500;
}

.recent-item-meta {
    font-size: 0.875rem;
    color: var(--gray-500);
}

/* ===== CONFIG SECTIONS ===== */
.config-sections {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.config-section {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow);
}

.config-section h2 {
    font-size: 1.25rem;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--gray-200);
}

.variables-help {
    background: var(--gray-100);
    padding: 16px;
    border-radius: var(--radius);
    margin-top: 16px;
    font-size: 0.875rem;
}

.variables-help h4 {
    margin-bottom: 8px;
}

.variables-help code {
    background: var(--white);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
}

/* ===== CARDS GRID ===== */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.provider-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
}

.provider-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.provider-card h3 {
    font-size: 1.25rem;
    margin-bottom: 8px;
}

.provider-card p {
    color: var(--gray-500);
    margin-bottom: 16px;
}

.provider-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.provider-docs-count {
    font-size: 0.875rem;
    color: var(--gray-600);
}

/* ===== DOCUMENTS LIST ===== */
.documents-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.document-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: var(--gray-50);
    border-radius: var(--radius);
}

.document-icon {
    font-size: 2rem;
}

.document-info {
    flex: 1;
}

.document-name {
    font-weight: 500;
    margin-bottom: 4px;
}

.document-meta {
    font-size: 0.875rem;
    color: var(--gray-500);
}

.document-actions {
    display: flex;
    gap: 8px;
}

.section-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--gray-200);
}

.empty-message {
    padding: 20px;
    text-align: center;
    color: var(--gray-500);
    background: var(--gray-50);
    border-radius: var(--radius);
    font-style: italic;
}

.status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    margin-left: 8px;
}

.status-badge.sent {
    background: var(--success);
    color: white;
}

.status-badge.pending {
    background: var(--warning);
    color: white;
}

.scan-item {
    background: var(--white);
    border: 1px solid var(--gray-200);
}

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

.action-btn.email {
    background: var(--info);
    color: white;
}

.action-btn.report {
    background: #8b5cf6;
    color: white;
}

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

.email-info-content {
    padding: 10px 0;
}

.email-info-content p {
    margin-bottom: 12px;
}

.email-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.email-list li {
    padding: 8px 12px;
    background: var(--gray-100);
    border-radius: var(--radius);
    margin-bottom: 8px;
}

.pdf-generated {
    background: var(--gray-50);
    border-left: 3px solid var(--primary);
}

.pdf-generated .document-meta em {
    color: var(--primary);
    font-size: 0.8rem;
}

.email-subject-box {
    background: var(--gray-100);
    padding: 12px 16px;
    border-radius: var(--radius);
    font-weight: 600;
    color: var(--dark);
    border-left: 3px solid var(--primary);
}

.email-body-box {
    background: var(--white);
    border: 1px solid var(--gray-200);
    padding: 16px;
    border-radius: var(--radius);
    font-family: monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    max-height: 300px;
    overflow-y: auto;
    white-space: pre-wrap;
}

.email-header-info {
    background: var(--gray-50);
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 15px;
}

.email-header-info p {
    margin-bottom: 6px;
}

.email-header-info p:last-child {
    margin-bottom: 0;
}

.upload-zone {
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius);
    padding: 40px;
    text-align: center;
    margin-bottom: 20px;
    cursor: pointer;
    transition: all 0.2s;
}

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

.upload-zone input {
    display: none;
}

.upload-zone label {
    cursor: pointer;
    font-size: 1.125rem;
    color: var(--gray-600);
}

.pdf-viewer-body {
    padding: 0;
    height: 80vh;
}

.pdf-viewer-body iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* ===== TOAST NOTIFICATIONS ===== */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast {
    padding: 16px 20px;
    background: var(--dark);
    color: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease;
    max-width: 350px;
}

.toast.success {
    background: var(--success);
}

.toast.error {
    background: var(--danger);
}

.toast.warning {
    background: var(--warning);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ===== ERROR PAGE ===== */
.error-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.error-container {
    text-align: center;
    padding: 40px;
}

.error-icon {
    font-size: 5rem;
    margin-bottom: 24px;
}

.error-container h1 {
    font-size: 2rem;
    margin-bottom: 16px;
}

.error-container p {
    color: var(--gray-500);
    margin-bottom: 24px;
}

.error-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

/* ===== BREADCRUMB ===== */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    color: var(--gray-500);
    margin-bottom: 8px;
}

.breadcrumb a {
    color: var(--primary);
}

.breadcrumb a:hover {
    text-decoration: underline;
}

/* ===== INFO TEXT ===== */
.info-text {
    color: var(--gray-600);
    margin-bottom: 20px;
    padding: 16px;
    background: var(--gray-100);
    border-radius: var(--radius);
}

/* ===== LOADING ===== */
.loading-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 40px;
    text-align: center;
    box-shadow: var(--shadow);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .scan-container {
        grid-template-columns: 1fr;
    }

    .send-section {
        grid-column: span 1;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .admin-page {
        flex-direction: column;
    }

    .admin-sidebar {
        width: 100%;
    }

    .admin-nav {
        position: static;
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        padding: 8px;
    }

    .admin-nav-link {
        flex: 1;
        min-width: 120px;
        justify-content: center;
        margin-bottom: 0;
    }
}

@media (max-width: 768px) {
    .header {
        padding: 0 12px;
    }

    .logo-text {
        display: none;
    }

    .nav {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: var(--white);
        padding: 8px;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
        justify-content: space-around;
        z-index: 100;
    }

    .nav-link {
        flex-direction: column;
        padding: 8px;
        font-size: 0.75rem;
        gap: 4px;
    }

    .nav-text {
        display: block;
    }

    .user-name,
    .user-role {
        display: none;
    }

    .main-content {
        margin-bottom: 70px;
        padding: 12px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .filters-bar {
        flex-direction: column;
    }

    .filter-group {
        width: 100%;
    }

    .day-selector {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
    }

    .day-btn {
        min-width: 70px;
        flex-shrink: 0;
    }

    .modal-content {
        margin: 10px;
        max-height: calc(100vh - 20px);
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .cards-grid {
        grid-template-columns: 1fr;
    }
}

/* ===== EMAIL QUEUE ===== */
.schedule-config {
    margin-bottom: 24px;
}

.schedule-config h3 {
    margin-bottom: 16px;
    font-size: 1.125rem;
}

.form-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.form-row .form-group {
    flex: 1;
    min-width: 200px;
}

.checkbox-group {
    display: flex;
    align-items: center;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.filters-bar {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
    align-items: center;
    flex-wrap: wrap;
}

.filter-actions {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

.email-dest {
    font-weight: 500;
}

.subject-cell {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.status-badge.pending {
    background: var(--warning);
    color: var(--gray-900);
}

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

.text-error {
    color: var(--danger);
}

.email-details {
    padding: 16px 0;
}

.email-details p {
    margin-bottom: 8px;
}

.email-body {
    background: var(--gray-100);
    padding: 16px;
    border-radius: var(--radius);
    white-space: pre-wrap;
    font-family: inherit;
    font-size: 0.9rem;
    max-height: 300px;
    overflow-y: auto;
}

/* Form sections for provider modal */
.form-section {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--gray-200);
}

.form-section:last-of-type {
    border-bottom: none;
}

.form-section h4 {
    font-size: 1rem;
    margin-bottom: 12px;
    color: var(--gray-700);
}

.form-hint {
    display: block;
    margin-top: 4px;
    font-size: 0.8rem;
    color: var(--gray-500);
}

/* Header actions */
.header-actions {
    display: flex;
    gap: 12px;
}

/* ===== CHECKBOX LIST (for scenarios) ===== */
.checkbox-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px;
    background: var(--gray-100);
    border-radius: var(--radius);
    max-height: 200px;
    overflow-y: auto;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--white);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid var(--gray-200);
}

.checkbox-item:hover {
    border-color: var(--primary-light);
}

.checkbox-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.checkbox-item input[type="checkbox"]:disabled + span {
    color: var(--gray-400);
}

.checkbox-item input[type="checkbox"]:checked + span {
    color: var(--primary);
    font-weight: 500;
}

/* ===== INFO BOX ===== */
.info-box {
    background: #e0f2fe;
    border: 1px solid #7dd3fc;
    color: #0369a1;
    padding: 16px;
    border-radius: var(--radius);
    margin-bottom: 20px;
}

.info-box p {
    margin: 0;
}

/* ===== DROPDOWN MENU ===== */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 200px;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 100;
    margin-top: 4px;
    padding: 8px 0;
}

.dropdown-menu.show {
    display: block;
}

.dropdown-menu button {
    display: block;
    width: 100%;
    padding: 12px 16px;
    text-align: left;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.95rem;
    transition: background 0.2s;
}

.dropdown-menu button:hover {
    background: var(--gray-100);
}

/* ===== PERIOD BUTTONS ===== */
.period-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.period-buttons .btn {
    flex: 1;
    min-width: 100px;
}

/* ===== CAMERA OFF MESSAGE ===== */
.camera-off-message {
    text-align: center;
    padding: 20px;
}

.camera-off-message .camera-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 12px;
}

.camera-off-message p {
    margin-bottom: 16px;
    color: var(--gray-300);
}

/* ===== IMAGE EDITOR ===== */
.image-editor-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px;
    background: linear-gradient(145deg, #1a1a1a, #2d2d2d);
    min-height: 350px;
    overflow: hidden;
}

.image-editor-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-height: 55vh;
    overflow: visible;
}

.image-editor-container canvas {
    display: block;
    border-radius: var(--radius);
    box-shadow: 0 8px 32px rgba(0,0,0,0.6);
    max-width: 100%;
    max-height: 55vh;
}

.crop-corner {
    position: absolute;
    width: 44px;
    height: 44px;
    background: var(--primary);
    border: 3px solid var(--white);
    border-radius: 50%;
    cursor: move;
    transform: translate(-50%, -50%);
    z-index: 10;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    touch-action: none;
    transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
    display: none;
}

.crop-corner:hover,
.crop-corner.dragging {
    background: var(--primary-light);
    transform: translate(-50%, -50%) scale(1.25);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.6);
}

.crop-corner::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 10px;
    height: 10px;
    background: var(--white);
    border-radius: 50%;
}

.editor-tools {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

.editor-tools .btn {
    background: rgba(255,255,255,0.1);
    color: var(--white);
    border: 1px solid rgba(255,255,255,0.25);
    padding: 10px 18px;
    font-size: 0.95rem;
    backdrop-filter: blur(4px);
}

.editor-tools .btn:hover {
    background: rgba(255,255,255,0.2);
    border-color: rgba(255,255,255,0.4);
}

/* ===== SELECTED DATES DISPLAY ===== */
.selected-dates {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.selected-date-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--primary);
    color: var(--white);
    padding: 6px 10px;
    border-radius: 20px;
    font-size: 0.875rem;
}

.selected-date-tag button {
    background: none;
    border: none;
    color: var(--white);
    cursor: pointer;
    font-size: 1rem;
    padding: 0;
    margin-left: 4px;
    opacity: 0.8;
}

.selected-date-tag button:hover {
    opacity: 1;
}

/* ===== IMAGE BADGES ===== */
.captured-image .image-number {
    position: absolute;
    bottom: 2px;
    left: 2px;
    background: rgba(0,0,0,0.75);
    color: var(--white);
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
}

.captured-image .edited-badge {
    position: absolute;
    bottom: 2px;
    right: 2px;
    background: var(--success);
    color: var(--white);
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
}

/* ===== FORM HINTS ===== */
.form-group label .hint,
.form-group label small.hint {
    font-weight: normal;
    font-size: 0.75rem;
    color: var(--gray-500);
}

/* ===== DAY BUTTON TODAY ===== */
.day-btn.today {
    border-color: var(--success);
}

.day-btn.today:not(.selected)::after {
    content: '●';
    display: block;
    color: var(--success);
    font-size: 8px;
    margin-top: 4px;
}

/* ===== PRESTATIONS ===== */
.prestations-section {
    background: var(--gray-100);
    border-radius: var(--radius);
    padding: 15px;
    margin-bottom: 15px;
}

.prestation-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.prestation-checkbox:hover {
    border-color: var(--primary);
    background: var(--gray-50);
}

.prestation-checkbox input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-top: 2px;
    flex-shrink: 0;
}

.prestation-checkbox .prestation-name {
    font-weight: 500;
    color: var(--dark);
}

.prestation-checkbox .prestation-desc {
    display: block;
    font-size: 0.85em;
    color: var(--gray-500);
    margin-top: 2px;
}

.prestation-questions-group {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 15px;
    margin-bottom: 15px;
}

.prestation-questions-group .questions-title {
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 15px;
    display: block;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--gray-200);
}

.question-field {
    margin-bottom: 12px;
}

.question-field label {
    display: block;
    font-size: 0.9em;
    color: var(--gray-600);
    margin-bottom: 5px;
}

.question-field input,
.question-field select,
.question-field textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 1rem;
    background: var(--white);
}

.question-field input:focus,
.question-field select:focus,
.question-field textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.multiselect-options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

/* Repeater question type */
.repeater-container {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 15px;
}

.repeater-count-input {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px dashed var(--gray-200);
}

.repeater-count-input label {
    font-weight: 500;
    color: var(--gray-600);
    margin-bottom: 0 !important;
}

.repeater-count-input input[type="number"] {
    width: 80px;
    text-align: center;
}

.repeater-rows {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.repeater-row {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    padding: 12px;
}

.repeater-row-header {
    margin-bottom: 10px;
}

.repeater-row-number {
    font-weight: 600;
    color: var(--primary);
    background: rgba(37, 99, 235, 0.1);
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.85em;
}

.repeater-row-fields {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.repeater-field {
    display: flex;
    flex-direction: column;
}

.repeater-field label {
    font-size: 0.85em;
    color: var(--gray-600);
    margin-bottom: 5px;
}

.repeater-field input {
    padding: 8px 10px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: 0.95em;
}

.repeater-field input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

@media (max-width: 600px) {
    .repeater-row-fields {
        grid-template-columns: 1fr;
    }
}

/* Per-day toggle */
.per-day-toggle {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px dashed var(--gray-300);
}

.per-day-toggle .checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9em;
    color: var(--gray-600);
    cursor: pointer;
}

.per-day-toggle .checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
}

/* Date tabs for per-day questions */
.date-tabs-container {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 15px;
}

.date-tabs {
    display: flex;
    overflow-x: auto;
    background: var(--gray-100);
    border-bottom: 1px solid var(--gray-200);
    padding: 0;
}

.date-tab {
    flex: 1;
    min-width: 80px;
    padding: 12px 16px;
    border: none;
    background: transparent;
    color: var(--gray-600);
    font-size: 0.9em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 3px solid transparent;
    white-space: nowrap;
}

.date-tab:hover {
    background: var(--gray-200);
    color: var(--dark);
}

.date-tab.active {
    background: var(--white);
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.date-tab-content {
    padding: 15px;
    background: var(--white);
}

@media (max-width: 600px) {
    .date-tabs {
        justify-content: flex-start;
    }

    .date-tab {
        min-width: 70px;
        padding: 10px 12px;
        font-size: 0.85em;
    }
}

.checkbox-option {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.9em;
}

.checkbox-option:hover {
    background: var(--gray-100);
}

.checkbox-option input[type="checkbox"] {
    width: 16px;
    height: 16px;
}

/* Prestations dans les détails de scan */
.scan-prestations {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--gray-200);
}

.scan-prestations h4 {
    color: var(--primary);
    margin-bottom: 10px;
}

.prestation-detail {
    background: var(--gray-50);
    border-radius: var(--radius);
    padding: 12px;
    margin-bottom: 10px;
}

.prestation-detail .prestation-title {
    font-weight: 600;
    margin-bottom: 8px;
}

.prestation-detail .reponse-item {
    display: flex;
    gap: 8px;
    font-size: 0.9em;
    padding: 4px 0;
}

.prestation-detail .reponse-item .question-label {
    color: var(--gray-500);
}

.prestation-detail .reponse-item .reponse-value {
    color: var(--dark);
    font-weight: 500;
}

/* Repeater display in history */
.repeater-count {
    display: inline-block;
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.85em;
    margin-bottom: 5px;
}

.repeater-items {
    margin-top: 5px;
    margin-left: 10px;
    border-left: 2px solid var(--gray-200);
    padding-left: 10px;
}

.repeater-row-display {
    font-size: 0.9em;
    color: var(--gray-600);
    margin-bottom: 4px;
    line-height: 1.4;
}

.repeater-row-display strong {
    color: var(--gray-700);
}

/* Toggle prestation par jour dans le formulaire scan */
.prestation-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.prestation-day-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85em;
    color: var(--gray-600);
    cursor: pointer;
    padding: 4px 8px;
    background: var(--gray-100);
    border-radius: var(--radius);
    white-space: nowrap;
}

.prestation-day-toggle:hover {
    background: var(--gray-200);
}

.prestation-day-toggle input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.prestation-questions-group.prestation-disabled {
    opacity: 0.5;
    background: var(--gray-100);
}

.prestation-questions-group.prestation-disabled .questions-title {
    text-decoration: line-through;
}

.no-questions-msg {
    font-size: 0.85em;
    color: var(--gray-500);
    font-style: italic;
    padding: 8px 0;
}

/* Signature électronique */
.signature-section {
    margin-top: 15px;
}

.signature-container {
    background: var(--white);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    overflow: hidden;
}

.signature-container canvas {
    display: block;
    width: 100%;
    max-width: 350px;
    height: 150px;
    touch-action: none;
    cursor: crosshair;
}

.signature-actions {
    padding: 8px;
    background: var(--gray-50);
    border-top: 1px solid var(--gray-200);
    text-align: right;
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.85em;
}

/* Géolocalisation */
.geoloc-section {
    margin-top: 10px;
}

.geoloc-info {
    padding: 10px 12px;
    background: var(--gray-50);
    border-radius: var(--radius);
    font-size: 0.9em;
}

.geoloc-status {
    color: var(--gray-600);
}

/* Groupes de prestations par date dans l'historique */
.date-prestations-group {
    margin-bottom: 15px;
    padding: 10px;
    background: var(--gray-100);
    border-radius: var(--radius);
}

.date-group-header {
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--gray-200);
    font-size: 0.95em;
}

.date-prestations-group .prestation-detail {
    background: var(--white);
    margin-bottom: 8px;
}

.date-prestations-group .prestation-detail:last-child {
    margin-bottom: 0;
}

/* ===== SERVER ADMIN ===== */
.server-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.server-stat-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow);
}

.server-stat-card .stat-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.server-stat-card .stat-icon {
    font-size: 1.5rem;
}

.server-stat-card .stat-title {
    font-weight: 600;
    color: var(--gray-600);
}

.stat-bar-container {
    height: 12px;
    background: var(--gray-200);
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 10px;
}

.stat-bar {
    height: 100%;
    border-radius: 6px;
    transition: width 0.5s ease, background-color 0.3s;
}

.stat-bar.cpu-bar { background: linear-gradient(90deg, #3b82f6, #60a5fa); }
.stat-bar.ram-bar { background: linear-gradient(90deg, #10b981, #34d399); }
.stat-bar.disk-bar { background: linear-gradient(90deg, #8b5cf6, #a78bfa); }

.stat-bar.warning { background: linear-gradient(90deg, #f59e0b, #fbbf24) !important; }
.stat-bar.danger { background: linear-gradient(90deg, #ef4444, #f87171) !important; }

.stat-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stat-percent {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--dark);
}

.stat-info {
    font-size: 0.85rem;
    color: var(--gray-500);
}

.stat-extra {
    font-size: 0.8rem;
    color: var(--gray-500);
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--gray-200);
}

.stat-uptime {
    text-align: center;
    padding: 10px 0;
}

.stat-uptime.secondary {
    border-top: 1px solid var(--gray-200);
    margin-top: 10px;
    padding-top: 15px;
}

.uptime-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--dark);
}

.uptime-label {
    font-size: 0.8rem;
    color: var(--gray-500);
    margin-top: 4px;
}

/* Chart */
.chart-card {
    margin-bottom: 24px;
}

.chart-card .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.chart-legend {
    display: flex;
    gap: 20px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--gray-600);
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

.legend-color.cpu { background: #3b82f6; }
.legend-color.ram { background: #10b981; }

.chart-container {
    height: 200px;
    position: relative;
}

/* Server Tabs */
.server-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    background: var(--white);
    padding: 10px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.server-tab {
    padding: 10px 20px;
    border: none;
    background: transparent;
    color: var(--gray-600);
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
}

.server-tab:hover {
    background: var(--gray-100);
}

.server-tab.active {
    background: var(--primary);
    color: var(--white);
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

/* Config Sections */
.config-section {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.config-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--gray-200);
    background: var(--gray-50);
}

.config-header h3 {
    margin: 0;
    font-size: 1.1rem;
}

.config-body {
    padding: 20px;
}

.config-footer {
    display: flex;
    gap: 10px;
    padding: 20px;
    border-top: 1px solid var(--gray-200);
    background: var(--gray-50);
    flex-wrap: wrap;
}

.header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--gray-300);
    transition: 0.3s;
    border-radius: 26px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--success);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(24px);
}

/* Form Sections */
.form-section {
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--gray-200);
}

.form-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.form-section h4 {
    margin-bottom: 15px;
    font-size: 0.95rem;
    color: var(--gray-700);
}

.form-row {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.form-row:last-child {
    margin-bottom: 0;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 6px;
}

.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.checkbox-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
}

/* SMTP Info Box */
.smtp-info-box {
    background: linear-gradient(135deg, #e0f2fe 0%, #f0f9ff 100%);
    border: 1px solid #7dd3fc;
    border-radius: 8px;
    padding: 16px 20px;
    margin-top: 10px;
}

.smtp-info-box p {
    margin: 0;
    color: #0369a1;
    font-size: 0.95rem;
}

.smtp-info-box p:first-child {
    margin-bottom: 8px;
}

.smtp-info-box a {
    color: #0284c7;
    text-decoration: underline;
}

.smtp-info-box a:hover {
    color: #0369a1;
}

/* Warning Box */
.warning-box {
    background: linear-gradient(135deg, #fef3c7 0%, #fffbeb 100%);
    border: 1px solid #f59e0b;
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 20px;
}

.warning-box p {
    margin: 0;
    color: #92400e;
    font-size: 0.95rem;
}

/* Backups List */
.backups-list {
    padding: 20px;
    border-top: 1px solid var(--gray-200);
}

.backups-list h4 {
    margin-bottom: 15px;
}

.backups-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.backup-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: var(--gray-50);
    border-radius: var(--radius);
    gap: 15px;
}

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

.backup-name {
    font-weight: 500;
    word-break: break-all;
}

.backup-meta {
    font-size: 0.8rem;
    color: var(--gray-500);
}

.backup-actions {
    display: flex;
    gap: 8px;
}

/* Logs */
.logs-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 20px;
}

.logs-section h4 {
    margin-bottom: 10px;
}

.logs-section pre {
    background: var(--dark);
    color: #22c55e;
    padding: 15px;
    border-radius: var(--radius);
    font-size: 0.75rem;
    line-height: 1.6;
    overflow-x: auto;
    max-height: 300px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

#logsError pre {
    color: #ef4444;
}

/* Maintenance */
.maintenance-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    padding: 20px;
}

.maintenance-card {
    background: var(--gray-50);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
}

.maintenance-icon {
    font-size: 2rem;
    margin-bottom: 10px;
}

.maintenance-card h4 {
    margin-bottom: 8px;
}

.maintenance-card p {
    font-size: 0.85rem;
    color: var(--gray-600);
    margin-bottom: 15px;
    min-height: 40px;
}

/* Status texts */
.success-text { color: var(--success); }
.error-text { color: var(--danger); }
.warning-text { color: var(--warning); }

/* Small buttons */
.btn-small {
    padding: 6px 12px;
    font-size: 0.85rem;
}

/* Empty message */
.empty-message {
    text-align: center;
    color: var(--gray-500);
    padding: 20px;
}

/* Modal large */
.modal-large .modal-content {
    max-width: 800px;
}

/* Data table in modals */
.modal .data-table {
    width: 100%;
    border-collapse: collapse;
}

.modal .data-table th,
.modal .data-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}

.modal .data-table th {
    background: var(--gray-50);
    font-weight: 600;
}

/* Connection test result */
#connectionTestResult {
    padding: 8px 12px;
    border-radius: var(--radius);
    font-size: 0.85rem;
}

/* Responsive */
@media (max-width: 768px) {
    .server-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .config-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }

    .header-actions {
        width: 100%;
    }

    .form-row {
        flex-direction: column;
    }

    .form-group {
        width: 100% !important;
    }

    .server-tabs {
        justify-content: center;
    }

    .server-tab {
        flex: 1;
        min-width: 100px;
        text-align: center;
    }
}

/* ===== PRINT ===== */
@media print {
    .header,
    .nav,
    .admin-sidebar,
    .filters-bar,
    .pagination,
    .form-actions {
        display: none !important;
    }

    .main-content {
        margin: 0;
        padding: 0;
    }

    .table-container {
        box-shadow: none;
    }
}
