/* Admin - Thème basé sur theme/style.css */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --bg-page: #f1f5f9;
    --bg-surface: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --radius-sm: 8px;
    --radius-md: 12px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --font-main: 'Inter', sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: var(--font-main);
    background: var(--bg-page);
    color: var(--text-main);
    line-height: 1.5;
}

/* Login */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-container { width: 100%; max-width: 400px; }
.login-card { background: #fff; padding: 2rem; border-radius: var(--radius-md); box-shadow: var(--shadow-md); }
.login-card h1 { font-size: 1.5rem; margin-bottom: 0.25rem; display: flex; align-items: center; gap: 0.5rem; }
.login-subtitle { color: var(--text-muted); margin-bottom: 1.5rem; font-size: 0.9rem; }
.login-form .form-group { margin-bottom: 1rem; }
.login-form label { display: block; margin-bottom: 0.5rem; font-weight: 500; }
.login-form input { width: 100%; padding: 0.75rem; border: 1px solid #e2e8f0; border-radius: var(--radius-sm); }
.btn-block { width: 100%; margin-top: 0.5rem; }

/* Dashboard layout */
.dash-layout { display: flex; min-height: 100vh; }
.dash-sidebar {
    width: 260px;
    background: #fff;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #e2e8f0;
}
.sidebar-header { padding: 1rem 1.5rem; border-bottom: 1px solid #e2e8f0; }
.brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-main);
    text-decoration: none;
}
.brand-logo { max-height: 36px; }
.sidebar-nav { padding: 1rem; flex: 1; overflow-y: auto; }
.nav-section { font-size: 0.7rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; margin: 1rem 0 0.5rem; padding-left: 0.5rem; }
.nav-section:first-child { margin-top: 0; }
.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: var(--radius-sm);
    margin-bottom: 0.25rem;
    transition: all 0.2s;
}
.nav-link:hover { background: #f8fafc; color: var(--text-main); }
.nav-link.active { background: #e0e7ff; color: var(--primary); }
.nav-link i { width: 20px; text-align: center; }
.sidebar-footer { padding: 1rem; border-top: 1px solid #e2e8f0; }
.user-info { margin-bottom: 0.5rem; }
.user-name { font-weight: 600; display: block; }
.user-role { font-size: 0.75rem; color: var(--text-muted); }

.dash-main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.dash-header {
    background: #fff;
    padding: 1rem 2rem;
    border-bottom: 1px solid #e2e8f0;
}
.dash-header h2 { font-size: 1.25rem; font-weight: 700; }
.dash-content { flex: 1; overflow-y: auto; padding: 1.5rem 2rem; }

/* Alerts */
.alert { padding: 0.75rem 1rem; border-radius: var(--radius-sm); margin-bottom: 1rem; }
.alert-success { background: #dcfce7; color: #166534; }
.alert-error { background: #fee2e2; color: #991b1b; }

/* Sections */
.admin-section { background: #fff; padding: 1.5rem; border-radius: var(--radius-md); box-shadow: var(--shadow-sm); margin-bottom: 1.5rem; }
.admin-section h3 { margin-bottom: 1rem; font-size: 1.1rem; }
.section-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem; margin-bottom: 1rem; }
.section-header h3 { margin-bottom: 0; }

/* Forms */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; margin-bottom: 0.5rem; font-weight: 500; font-size: 0.9rem; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
}
.form-group textarea { min-height: 100px; resize: vertical; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-row .form-group[style*="flex:2"] { grid-column: span 1; }
.hidden { display: none !important; }
.radio-label { display: block; margin: 0.25rem 0; }
.radio-label input { margin-right: 0.5rem; }
.color-input { display: flex; gap: 0.5rem; align-items: center; }
.config-form .btn { margin-top: 0.5rem; }
.form-inline { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.mapping-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.import-preview { margin-top: 1rem; overflow-x: auto; }
.form-actions { display: flex; gap: 0.5rem; margin-top: 1rem; }
.text-muted { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 0.5rem; }
.logo-preview { margin-top: 0.5rem; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: all 0.2s;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: #fff; color: var(--text-main); border: 1px solid #e2e8f0; }
.btn-secondary:hover { background: #f8fafc; }
.btn-danger { background: #ef4444; color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-sm { padding: 0.35rem 0.65rem; font-size: 0.8rem; }

/* Table */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { padding: 0.75rem 1rem; text-align: left; border-bottom: 1px solid #e2e8f0; }
.data-table th { background: #f8fafc; color: var(--text-muted); font-size: 0.8rem; font-weight: 600; text-transform: uppercase; }
.data-table tbody tr:hover { background: #f8fafc; }

/* Badges */
.badge { padding: 0.2rem 0.5rem; border-radius: 99px; font-size: 0.75rem; font-weight: 600; }
.badge-success { background: #dcfce7; color: #166534; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-primary { background: #e0e7ff; color: var(--primary); }
.badge-secondary { background: #f1f5f9; color: var(--text-muted); }
.badge-muted { background: #e2e8f0; color: #64748b; }

/* Stats */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card { background: #fff; padding: 1.25rem; border-radius: var(--radius-md); box-shadow: var(--shadow-sm); }
.stat-value { font-size: 1.75rem; font-weight: 800; }
.stat-label { font-size: 0.85rem; color: var(--text-muted); margin-top: 0.25rem; }

/* Modal */
.modal { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 1000; align-items: center; justify-content: center; padding: 20px; }
.modal.active { display: flex; }
.modal-content { background: #fff; padding: 1.5rem; border-radius: var(--radius-md); max-width: 500px; width: 100%; max-height: 90vh; overflow-y: auto; }
.modal-large { max-width: 700px; }

/* Filters */
.filters .filter-form { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.search-input { padding: 0.5rem 0.75rem; border: 1px solid #e2e8f0; border-radius: var(--radius-sm); min-width: 200px; }

/* Messages */
.messages-layout { display: grid; grid-template-columns: 300px 1fr; gap: 1rem; min-height: 400px; }
.messages-list { border: 1px solid #e2e8f0; border-radius: var(--radius-sm); overflow-y: auto; }
.message-item { padding: 1rem; border-bottom: 1px solid #e2e8f0; cursor: pointer; transition: background 0.2s; }
.message-item:hover, .message-item.active { background: #f8fafc; }
.message-item.unread { background: #eff6ff; }
.message-from { font-weight: 600; margin-bottom: 0.25rem; }
.message-preview { font-size: 0.85rem; color: var(--text-muted); }
.message-meta { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.25rem; }
.message-detail { border: 1px solid #e2e8f0; border-radius: var(--radius-sm); padding: 1rem; background: #fff; }
.message-full h4 { margin-bottom: 0.5rem; }
.reply-item { padding: 1rem; background: #f8fafc; border-radius: var(--radius-sm); margin-bottom: 0.5rem; }
.reply-form { margin-top: 1rem; }

/* Responsive */
@media (max-width: 768px) {
    .dash-sidebar { display: none; }
    .messages-layout { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
}
