:root {
    --primary: #2563eb;
    --primary-light: #dbeafe;
    --primary-hover: #1d4ed8;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --bg: #f1f5f9;
    --text: #0f172a;
    --text-muted: #64748b;
    --card: #ffffff;
    --border: #e2e8f0;
}

body {
    font-family: 'Inter', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    margin: 0;
    line-height: 1.6;
}

/* Navbar */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 5%;
    background: var(--card);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo { font-size: 1.5rem; font-weight: 800; color: var(--primary); }

.role-selector button {
    border: 1px solid var(--border);
    padding: 8px 20px;
    background: white;
    cursor: pointer;
    border-radius: 25px;
    font-weight: 600;
    margin-left: 10px;
    transition: all 0.3s ease;
}

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

/* Layout */
.container { max-width: 1100px; margin: 2rem auto; padding: 0 1rem; }
.section-header { text-align: center; margin-bottom: 2rem; }
.hidden { display: none !important; }

/* Cards */
.card {
    background: var(--card);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

/* Stats Bar (Spécifique Pharmacien) */
.stats-bar {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-item {
    background: var(--card);
    padding: 1.2rem 2rem;
    border-radius: 12px;
    flex: 1;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

.stat-item .label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 700;
}

.stat-item .value {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--primary);
}

/* Scanner */
.upload-box {
    border: 3px dashed var(--border);
    border-radius: 12px;
    padding: 3rem;
    text-align: center;
    transition: 0.3s;
    cursor: pointer;
}

.upload-box:hover { border-color: var(--primary); background: #f8fafc; }
.upload-label .icon { font-size: 3rem; margin-bottom: 1rem; }

#extractedText {
    width: 100%;
    height: 150px;
    margin: 1.5rem 0;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    resize: vertical;
}

/* Historique Patient & Grille */
.grid-history, .patient-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

.history-card-item, .patient-card-item {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    border-left: 5px solid var(--primary);
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    transition: transform 0.2s;
}

.history-card-item:hover, .patient-card-item:hover {
    transform: translateY(-3px);
}

/* Tableau Pharmacien */
.table-container { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; margin-top: 1rem; }
th { background: #f8fafc; text-align: left; padding: 12px; font-weight: 600; border-bottom: 2px solid var(--border); color: var(--text-muted); }
td { padding: 12px; border-bottom: 1px solid var(--border); }

/* Status Badges */
.status-badge, .badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    display: inline-block;
}
.status-pending { background: #fef3c7; color: #92400e; }
.status-done { background: #dcfce7; color: #166534; }

/* Buttons */
.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    transition: 0.2s;
}

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

/* Animation Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* Utils */
.warning-tag {
    font-size: 0.75rem;
    background: #ffedd5;
    color: #9a3412;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: bold;
}

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