/* Mobile Improvements - Sistema de Chamados */

/* Base Mobile Optimizations */
@media (max-width: 768px) {
    
    /* Header e Navegação */
    .navbar-brand {
        font-size: 1rem !important;
    }
    
    .navbar-nav .nav-link {
        padding: 0.5rem 0.75rem !important;
        font-size: 0.9rem;
    }
    
    /* Cards e Layout */
    .card {
        margin-bottom: 1rem;
        border-radius: 0.5rem;
        box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    }
    
    .card-header {
        padding: 0.75rem 1rem !important;
        font-size: 0.9rem;
    }
    
    .card-body {
        padding: 1rem !important;
    }
    
    /* Dashboard KPIs */
    .row.mb-4 .col-xl-3,
    .row.mb-4 .col-xl-2 {
        margin-bottom: 1rem !important;
    }
    
    .card.border-left-primary,
    .card.border-left-warning,
    .card.border-left-success,
    .card.border-left-danger,
    .card.border-left-info,
    .card.border-left-secondary {
        border-left: 4px solid !important;
    }
    
    /* Métricas Cards */
    .text-xs {
        font-size: 0.7rem !important;
        line-height: 1.2;
    }
    
    .h5 {
        font-size: 1.1rem !important;
        margin-bottom: 0.2rem !important;
    }
    
    .fa-2x {
        font-size: 1.5em !important;
    }
    
    /* Botões */
    .btn-group {
        display: flex;
        flex-wrap: wrap;
        gap: 0.25rem;
        width: 100%;
    }
    
    .btn-group .btn {
        flex: 1;
        min-width: auto;
        font-size: 0.875rem;
        padding: 0.375rem 0.5rem;
    }
    
    .btn-toolbar {
        justify-content: center;
        margin-bottom: 1rem !important;
    }
    
    .btn-sm {
        padding: 0.25rem 0.5rem !important;
        font-size: 0.775rem !important;
    }
    
    /* Tabelas */
    .table-responsive {
        font-size: 0.875rem;
        border-radius: 0.375rem;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .table th,
    .table td {
        padding: 0.5rem !important;
        border-top: 1px solid #dee2e6;
    }
    
    .table thead th {
        font-size: 0.8rem;
        font-weight: 600;
        border-bottom: 2px solid #dee2e6;
    }
    
    /* Badges */
    .badge {
        font-size: 0.7rem;
        padding: 0.35em 0.5em;
    }
    
    /* Formulários */
    .form-control,
    .form-select {
        font-size: 0.9rem;
        padding: 0.5rem 0.75rem;
    }
    
    .form-label {
        font-size: 0.9rem;
        font-weight: 500;
        margin-bottom: 0.25rem;
    }
    
    /* Search e Filtros */
    .search-container {
        margin-bottom: 1rem;
    }
    
    .search-filters {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .filter-row {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .filter-row .form-control,
    .filter-row .form-select {
        flex: 1;
        min-width: 120px;
    }
    
    /* Sidebar */
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 280px;
        background-color: #f8f9fa;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 1050;
        overflow-y: auto;
        box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .sidebar-backdrop {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 1040;
        display: none;
    }
    
    .sidebar-backdrop.show {
        display: block;
    }
    
    /* Menu Toggle */
    .menu-toggle {
        display: block !important;
        background: none;
        border: none;
        font-size: 1.2rem;
        color: #6c757d;
        padding: 0.5rem;
    }
    
    /* Gráficos */
    .chart-container {
        position: relative;
        height: 250px !important;
        margin: 1rem 0;
    }
    
    .chart-container canvas {
        max-height: 250px !important;
    }
    
    /* Alerts */
    .alert {
        font-size: 0.9rem;
        padding: 0.75rem 1rem;
        margin-bottom: 1rem;
        border-radius: 0.375rem;
    }
    
    /* Pagination */
    .pagination {
        justify-content: center;
        margin-top: 1rem;
    }
    
    .page-link {
        font-size: 0.875rem;
        padding: 0.375rem 0.75rem;
    }
    
    /* Modal Improvements */
    .modal-dialog {
        margin: 1rem;
        max-width: calc(100% - 2rem);
    }
    
    .modal-header {
        padding: 1rem;
        border-bottom: 1px solid #dee2e6;
    }
    
    .modal-body {
        padding: 1rem;
    }
    
    .modal-footer {
        padding: 0.75rem 1rem;
        border-top: 1px solid #dee2e6;
    }
    
    /* Ticket Details */
    .ticket-header {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 0.5rem;
    }
    
    .ticket-actions {
        width: 100%;
        justify-content: flex-start;
    }
    
    .ticket-meta {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
        margin-top: 0.5rem;
    }
    
    .ticket-meta .badge {
        flex-shrink: 0;
    }
    
    /* Comments */
    .comment-item {
        margin-bottom: 1rem;
        padding: 0.75rem;
        background-color: #f8f9fa;
        border-radius: 0.375rem;
        border-left: 3px solid #007bff;
    }
    
    .comment-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 0.5rem;
        font-size: 0.875rem;
    }
    
    .comment-body {
        font-size: 0.9rem;
        line-height: 1.4;
    }
    
    /* Tags */
    .tag-container {
        display: flex;
        flex-wrap: wrap;
        gap: 0.25rem;
        margin-top: 0.5rem;
    }
    
    .tag-badge {
        font-size: 0.7rem;
        padding: 0.25rem 0.5rem;
        border-radius: 1rem;
        white-space: nowrap;
    }
}

/* Extra Small Devices */
@media (max-width: 576px) {
    .container-fluid {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    
    .card {
        border-radius: 0.25rem;
    }
    
    .btn-toolbar .btn-group {
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    .table-responsive {
        font-size: 0.8rem;
    }
    
    .h2 {
        font-size: 1.4rem !important;
    }
    
    .h4 {
        font-size: 1.1rem !important;
    }
    
    /* Simplificar métricas em telas muito pequenas */
    .row.mb-4 .col-xl-2 {
        margin-bottom: 0.75rem !important;
    }
    
    .text-xs {
        font-size: 0.65rem !important;
    }
    
    .h5 {
        font-size: 1rem !important;
    }
}

/* Landscape Mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .chart-container {
        height: 200px !important;
    }
    
    .sidebar {
        width: 250px;
    }
}

/* Touch Improvements */
@media (hover: none) and (pointer: coarse) {
    .btn,
    .btn-sm,
    .btn-lg {
        min-height: 44px;
        min-width: 44px;
    }
    
    .form-control,
    .form-select {
        min-height: 44px;
    }
    
    .pagination .page-link {
        min-height: 44px;
        min-width: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .table td,
    .table th {
        min-height: 44px;
        padding: 0.75rem 0.5rem !important;
    }
}

/* Dark Mode Mobile Adjustments */
@media (prefers-color-scheme: dark) {
    .card {
        background-color: #2d3748;
        border-color: #4a5568;
    }
    
    .sidebar {
        background-color: #2d3748;
        border-right-color: #4a5568;
    }
    
    .table {
        color: #e2e8f0;
    }
    
    .table th,
    .table td {
        border-color: #4a5568;
    }
}

/* Print Styles for Mobile */
@media print {
    .btn-toolbar,
    .sidebar,
    .menu-toggle {
        display: none !important;
    }
    
    .card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #dee2e6;
    }
    
    .table {
        font-size: 0.8rem;
    }
}
