/**
 * Porokhane Digital Consulting - Styles responsive (mobile & tablette)
 */

html {
    -webkit-text-size-adjust: 100%;
}

body {
    overflow-x: hidden;
}

/* --- Layout AdminLTE --- */
@media (max-width: 991.98px) {
    .content-wrapper,
    .main-footer {
        margin-left: 0 !important;
    }

    .main-header .navbar-nav.ml-auto {
        margin-left: auto !important;
    }

    .brand-text {
        font-size: 0.9rem;
    }
}

@media (max-width: 767.98px) {
    .content-wrapper > .content {
        padding: 0.75rem !important;
    }

    .content-header {
        padding: 0.75rem 0.75rem 0 !important;
    }

    .content-header h1 {
        font-size: 1.35rem;
    }

    .content-header .breadcrumb {
        font-size: 0.8rem;
        padding: 0.25rem 0;
    }

    .content-header .row {
        flex-direction: column;
        gap: 0.5rem;
    }

    .content-header .float-sm-right,
    .content-header .breadcrumb.float-sm-right {
        float: none !important;
        text-align: left;
    }

    .main-footer {
        text-align: center;
        font-size: 0.85rem;
    }

    .main-footer .float-right {
        float: none !important;
        display: block;
        margin-top: 0.25rem;
    }
}

/* --- Navbar --- */
@media (max-width: 575.98px) {
    .main-header .nav-link span.ml-1,
    .main-header .navbar-nav .nav-link > span:not(.badge) {
        display: none;
    }

    .notification-dropdown {
        width: calc(100vw - 24px) !important;
        max-width: 360px !important;
        left: auto !important;
        right: 12px !important;
    }

    .dropdown-menu-right {
        right: 0;
        left: auto;
    }
}

/* --- Cartes & KPI --- */
@media (max-width: 767.98px) {
    .small-box {
        margin-bottom: 0.75rem;
    }

    .small-box .inner h3 {
        font-size: 1.75rem;
    }

    .small-box .icon {
        font-size: 2.5rem;
        top: 10px;
    }

    .info-box {
        margin-bottom: 0.75rem;
        min-height: auto;
    }

    .card {
        margin-bottom: 0.75rem;
    }

    .card-header {
        padding: 0.75rem 1rem;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .card-header .card-title {
        font-size: 1rem;
        width: 100%;
    }

    .card-header .btn,
    .card-header .btn-group {
        width: 100%;
    }

    .card-header .btn-group .btn {
        flex: 1;
    }

    .card-body {
        padding: 0.75rem;
    }

    .chart-container {
        height: 220px;
    }

    .quick-stats {
        grid-template-columns: 1fr 1fr;
    }

    .stat-value {
        font-size: 1.5rem;
    }
}

@media (max-width: 400px) {
    .quick-stats {
        grid-template-columns: 1fr;
    }
}

/* --- Tableaux --- */
.table-responsive-mobile {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 767.98px) {
    .table-responsive,
    .card-body > .table,
    .card-body.p-0 > .table-responsive {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .table {
        font-size: 0.85rem;
    }

    .table th,
    .table td {
        white-space: nowrap;
        vertical-align: middle;
    }

    .table .btn-action,
    .table .btn-xs,
    .table .btn-sm {
        padding: 0.25rem 0.4rem;
        font-size: 0.7rem;
    }
}

/* --- Kanban tâches --- */
@media (max-width: 991.98px) {
    .kanban-board {
        flex-direction: column;
        gap: 12px;
        padding: 10px 0;
    }

    .kanban-column {
        min-width: 100%;
        width: 100%;
        flex: none;
    }
}

@media (max-width: 575.98px) {
    .kanban-card {
        padding: 12px;
    }

    .kanban-card h6 {
        font-size: 0.95rem;
    }
}

/* --- Filtres --- */
@media (max-width: 767.98px) {
    .filter-section {
        padding: 12px;
    }

    .filter-section .row > [class*="col-"] {
        margin-bottom: 0.5rem;
    }

    .filter-section .btn {
        width: 100%;
        margin-bottom: 0.35rem;
    }
}

/* --- Pointage --- */
@media (max-width: 767.98px) {
    .pointage-clock {
        font-size: 2rem;
    }

    .pointage-action-btn {
        min-width: unset;
        width: 100%;
        max-width: 100%;
    }

    .pointage-workflow-card .card-body {
        min-height: auto;
        padding: 1.25rem !important;
    }

    .pointage-stat-box h3,
    .pointage-stat-box h4 {
        font-size: 1.25rem;
    }
}

/* --- Modals --- */
@media (max-width: 575.98px) {
    .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }

    .modal-dialog.modal-lg,
    .modal-dialog.modal-xl {
        max-width: calc(100% - 1rem);
    }

    .modal-body {
        padding: 1rem;
    }

    .modal-footer {
        flex-direction: column;
        gap: 0.5rem;
    }

    .modal-footer .btn {
        width: 100%;
        margin: 0;
    }
}

/* --- Boutons & formulaires --- */
@media (max-width: 767.98px) {
    .btn-lg {
        padding: 0.6rem 1rem;
        font-size: 1rem;
    }

    .content .float-right,
    .content .float-end {
        float: none !important;
        width: 100%;
        margin-top: 0.5rem;
    }

    .content .btn-group {
        display: flex;
        flex-wrap: wrap;
        width: 100%;
        gap: 4px;
    }

    .content .btn-group .btn {
        flex: 1 1 auto;
        min-width: calc(33% - 4px);
    }

    .d-flex.flex-wrap.gap-2,
    .btn-toolbar,
    .page-actions {
        flex-direction: column;
        width: 100%;
    }

    .d-flex.flex-wrap.gap-2 .btn,
    .page-actions .btn {
        width: 100%;
    }

    .input-group {
        flex-wrap: wrap;
    }

    .nav-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border-bottom: 1px solid #dee2e6;
    }

    .nav-tabs .nav-link {
        white-space: nowrap;
        font-size: 0.85rem;
    }
}

/* --- Login --- */
@media (max-width: 575.98px) {
    .login-page {
        padding: 15px;
        align-items: flex-start;
        padding-top: 2rem;
    }

    .login-box {
        width: 100%;
        max-width: 100%;
        margin: 0;
    }

    .login-card-body {
        padding: 20px 16px;
    }

    .login-logo img {
        max-width: 90px;
    }

    .login-logo h4 {
        font-size: 1.15rem;
    }
}

/* --- Discussions (complément styles inline) --- */
@media (max-width: 767.98px) {
    .chat-container {
        height: calc(100vh - 120px) !important;
        min-height: 400px;
    }

    .chat-sidebar {
        max-height: 35vh !important;
    }

    .chat-messages {
        padding: 12px !important;
    }

    .message-item {
        max-width: 92% !important;
    }

    .chat-input {
        padding: 10px !important;
    }

    .chat-input .form-control {
        font-size: 16px; /* évite zoom iOS */
    }
}

/* --- Utilisateurs / détail --- */
@media (max-width: 767.98px) {
    .user-avatar {
        width: 32px;
        height: 32px;
    }

    .timeline-item {
        padding-left: 30px;
    }
}

/* --- Alertes flash --- */
@media (max-width: 575.98px) {
    .alert.m-3 {
        margin: 0.5rem !important;
        font-size: 0.9rem;
    }
}

/* --- Bandeau PWA install --- */
@media (max-width: 575.98px) {
    #install-banner {
        left: 10px !important;
        right: 10px !important;
        transform: none !important;
        width: calc(100% - 20px) !important;
        flex-direction: column !important;
        text-align: center;
        padding: 12px !important;
    }

    #install-banner button {
        width: 100%;
        margin-top: 6px;
    }
}

/* --- Utilitaires --- */
.d-mobile-block {
    display: none !important;
}

@media (max-width: 767.98px) {
    .d-mobile-none {
        display: none !important;
    }

    .d-mobile-block {
        display: block !important;
    }

    .w-mobile-100 {
        width: 100% !important;
    }

    .text-mobile-center {
        text-align: center !important;
    }
}
