/**
 * Suite Église - Règles responsive globales
 * Améliore l'affichage sur mobile et tablettes
 */

/* --- Police globale : Segoe UI pour l'ensemble de l'application --- */
html, body {
    font-family: "Segoe UI", Segoe, Tahoma, Geneva, Verdana, sans-serif;
}

/* --- Base --- */
html { overflow-x: hidden; }
body { overflow-x: hidden; min-width: 0; }
img { max-width: 100%; height: auto; }
.container-fluid { padding-left: 0.75rem; padding-right: 0.75rem; }

/* --- Tableaux : défilement horizontal sur petit écran --- */
.table-responsive-wrapper { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-responsive-wrapper table { min-width: 500px; }
@media (max-width: 991.98px) {
    .card .card-body { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .tab-content .tab-pane { overflow-x: auto; }
    .table-responsive-wrapper table { font-size: 0.9rem; }
    table.dataTable, table.table { font-size: 0.85rem; }
    table thead th { font-size: 0.9rem !important; padding: 0.5rem; }
    table tbody td { padding: 0.5rem; }
}

/* --- Admin : Navbar --- */
@media (max-width: 991.98px) {
    .navbar .container-fluid { padding-left: 0.5rem; padding-right: 0.5rem; }
    .navbar-brand span { font-size: 0.95rem; }
    .navbar-nav .nav-link { padding: 0.5rem 0.75rem; font-size: 0.9rem; }
    .admin-dropdown-details .dropdown-menu { min-width: 260px; }
}

/* --- Admin : Dashboard --- */
@media (max-width: 991.98px) {
    .dashboard-wrap .stats-row .col-4 { flex: 0 0 50%; max-width: 50%; }
    .dashboard-wrap .stats-row .col-md-2 { flex: 0 0 50%; max-width: 50%; }
    .dashboard-chart-container { max-width: 100%; height: 220px; }
    .dashboard-charts-row .chart-card { height: auto; min-height: 220px; }
    .dashboard-charts-row .chart-card .card-body { height: 200px; }
    .dashboard-charts-row .col-lg-4 { margin-bottom: 0.75rem; }
}
@media (max-width: 575.98px) {
    .dashboard-wrap .stats-row .col-4,
    .dashboard-wrap .stats-row .col-md-2 { flex: 0 0 100%; max-width: 100%; }
    .dashboard-wrap .module-icon { font-size: 1.5rem; }
    .dashboard-wrap h3 { font-size: 1.2rem; }
    .dashboard-charts-row .chart-card .card-body { height: 180px; }
}

/* --- Admin : Paramètres / formulaires --- */
@media (max-width: 767.98px) {
    .nav-tabs .nav-link { font-size: 0.85rem; padding: 0.5rem 0.75rem; }
    .card .card-body .row > [class^="col-"] { margin-bottom: 0.5rem; }
    .form-label { font-size: 0.9rem; }
    .form-control, .form-select { font-size: 1rem; }
}
@media (max-width: 575.98px) {
    .nav-tabs { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .nav-tabs .nav-item { flex-shrink: 0; }
}

/* --- Dashboard layout (Budget, Membres, Annonces) --- */
@media (max-width: 768px) {
    .dashboard-container { overflow-x: hidden; }
    .dashboard-content { overflow-x: auto; -webkit-overflow-scrolling: touch; padding: 10px; }
    .eglise-name { font-size: 14px; max-width: 50vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .user-menu-btn { min-height: 44px; padding: 10px 14px; }
}
@media (max-width: 480px) {
    .dashboard-header { padding: 0 10px; height: 56px; }
    .eglise-name { font-size: 13px; }
    .dashboard-content { padding: 8px; }
}

/* --- Formulaires : champs pleine largeur sur mobile --- */
@media (max-width: 575.98px) {
    .form-group .form-control,
    .form-group select,
    .mb-3 input:not([type="checkbox"]):not([type="radio"]),
    .mb-3 select { width: 100% !important; }
    .btn-group .btn { min-height: 44px; }
}

/* --- Cartes et panels --- */
@media (max-width: 767.98px) {
    .card .card-header { font-size: 0.95rem; padding: 0.5rem 0.75rem; }
    .card .card-body { padding: 0.75rem; }
    .panel-heading { font-size: 0.95rem; padding: 0.5rem 0.75rem; }
}

/* --- Zones cliquables (touch) --- */
@media (hover: none) and (pointer: coarse) {
    .btn { min-height: 44px; padding-top: 0.5rem; padding-bottom: 0.5rem; }
    .nav-link { min-height: 44px; display: inline-flex; align-items: center; }
    .dropdown-item { min-height: 40px; display: flex; align-items: center; }
}

/* --- DataTables --- */
@media (max-width: 767.98px) {
    .dataTables_wrapper .dataTables_length,
    .dataTables_wrapper .dataTables_filter { text-align: left; margin-bottom: 0.5rem; }
    .dataTables_wrapper .dataTables_length select { padding: 0.25rem 1.5rem; }
    .dataTables_wrapper .dataTables_filter input { width: 100%; max-width: 200px; }
    .dataTables_wrapper .dataTables_info,
    .dataTables_wrapper .dataTables_paginate { font-size: 0.8rem; margin-top: 0.5rem; }
}

/* --- Utilitaires --- */
@media (max-width: 575.98px) {
    .d-mobile-block { display: block !important; }
    .d-mobile-none { display: none !important; }
    .text-mobile-center { text-align: center; }
}
