/* Responsive CSS - Sistema Imobiliário */

/* Mobile First - Base styles */
* {
    box-sizing: border-box;
}

/* Container responsivo */
.container-fluid {
    padding-left: 15px;
    padding-right: 15px;
}

/* Sidebar responsiva */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 1050;
        position: fixed !important;
        top: 0;
        left: 0;
        height: 100vh;
        width: 250px;
        background: var(--sidebar-bg, var(--primary-dark));
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
    }

    .navbar-toggler {
        display: block !important;
        border: none;
        background: none;
        font-size: 1.5rem;
        color: white;
    }

    .navbar-toggler:focus {
        box-shadow: none;
    }
}

/* Tabelas responsivas */
@media (max-width: 992px) {
    .table-responsive {
        border-radius: 0.375rem;
        box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    }

    .table td,
    .table th {
        padding: 0.5rem 0.25rem;
        font-size: 0.875rem;
    }

    .btn-group .btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }

    .btn-group .btn i {
        font-size: 0.875rem;
    }
}

/* Cards responsivos */
@media (max-width: 768px) {
    .card {
        margin-bottom: 1rem;
    }

    .card-body {
        padding: 1rem;
    }

    .row.g-3>* {
        margin-bottom: 1rem;
    }
}

/* Formulários responsivos */
@media (max-width: 576px) {

    .form-control,
    .form-select {
        font-size: 16px;
        /* Evita zoom no iOS */
    }

    .card-body {
        padding: 1rem;
        display: contents !important;
    }

    .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }

    .btn-group {
        display: flex;
        flex-direction: column;
        width: 100%;
    }

    .btn-group .btn {
        width: 100%;
        border-radius: 0.375rem !important;
        margin-bottom: 2px;
    }
}

/* Paginação responsiva */
@media (max-width: 576px) {
    .pagination {
        font-size: 0.875rem;
    }

    .pagination .page-link {
        padding: 0.375rem 0.5rem;
    }
}

/* Alertas responsivos */
@media (max-width: 768px) {
    .alert-container {
        left: 10px;
        right: 10px;
        top: 10px;
        max-width: none;
    }

    .alert-custom {
        font-size: 0.875rem;
        margin-bottom: 0.5rem;
    }
}

/* Modais responsivos */
@media (max-width: 576px) {
    .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }

    .modal-content {
        border-radius: 0.5rem;
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 1rem;
    }
}

/* Breadcrumb responsivo */
@media (max-width: 768px) {
    .breadcrumb {
        font-size: 0.875rem;
        padding: 0.5rem 0;
    }

    .breadcrumb-item+.breadcrumb-item::before {
        content: "›";
    }
}

/* Navbar responsiva */
@media (max-width: 768px) {
    .navbar {
        padding: 0.5rem 1rem;
    }

    .navbar-brand {
        font-size: 1.1rem;
    }

    .navbar-nav {
        background: white;
        border-radius: 0.375rem;

        box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    }
}

/* Profile photo responsivo */
@media (max-width: 576px) {
    .profile-photo {
        width: 32px !important;
        height: 32px !important;
    }

    .profile-dropdown .dropdown-menu {
        min-width: 200px;
        right: 0;
        left: auto;
    }
}

/* Dashboards responsivos */
@media (max-width: 992px) {
    .dashboard-card {
        margin-bottom: 1rem;
    }

    .dashboard-stats {
        text-align: center;
    }

    .stats-row .col-md-3 {
        margin-bottom: 1rem;
    }
}

/* Filtros responsivos */
@media (max-width: 768px) {
    .filter-form .row {
        margin-bottom: 1rem;
    }

    .filter-form .col-md-4,
    .filter-form .col-md-2 {
        margin-bottom: 0.5rem;
    }

    .filter-badges {
        text-align: center;
        margin-top: 1rem;
    }

    .filter-badges .badge {
        display: block;
        margin-bottom: 0.25rem;
    }
}

/* Loading spinner responsivo */
.loading-spinner {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9999;
}

@media (max-width: 768px) {
    .loading-spinner {
        top: 60%;
    }
}

/* Print styles */
@media print {

    .sidebar,
    .navbar,
    .btn,
    .alert,
    .pagination {
        display: none !important;
    }

    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
    }

    .table {
        font-size: 12px;
    }

    .card {
        border: 1px solid var(--gray-300);
        box-shadow: none;
    }
}

/* Acessibilidade */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Dark mode (se implementado futuramente) */

/* Utility classes responsivas */
@media (max-width: 576px) {
    .d-sm-none {
        display: none !important;
    }

    .text-sm-center {
        text-align: center !important;
    }

    .mb-sm-3 {
        margin-bottom: 1rem !important;
    }
}

@media (max-width: 768px) {
    .d-md-none {
        display: none !important;
    }

    .text-md-center {
        text-align: center !important;
    }

    .mb-md-3 {
        margin-bottom: 1rem !important;
    }
}

@media (max-width: 992px) {
    .d-lg-none {
        display: none !important;
    }

    .text-lg-center {
        text-align: center !important;
    }

    .mb-lg-3 {
        margin-bottom: 1rem !important;
    }
}

/* ===========================================
   MAP STYLES
   =========================================== */

/* Map Container */
.map-container {
    position: relative;
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.map-wrapper {
    position: relative;
    border-radius: 0.5rem;
    overflow: hidden;
}

.map-iframe {
    border: 0;
    border-radius: 0.5rem;
    width: 100%;
    height: 400px;
}

/* Map Info Panel */
.map-info {
    position: absolute;
    bottom: 20px;
    left: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 0.5rem;
    padding: 1rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.map-address {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.map-address i {
    color: var(--primary-color);
    font-size: 1.25rem;
    margin-top: 0.125rem;
}

.map-address strong {
    color: var(--text-color);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.map-address p {
    margin: 0.25rem 0 0 0;
    color: var(--gray-600);
    font-size: 0.875rem;
    line-height: 1.4;
}

.map-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.map-actions .btn {
    font-size: 0.75rem;
    padding: 0.375rem 0.75rem;
    border-radius: 0.375rem;
    text-decoration: none;
    transition: all 0.3s ease;
}

.map-actions .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Responsive Map Styles */
@media (max-width: 768px) {
    .map-info {
        bottom: 15px;
        left: 15px;
        right: 15px;
        padding: 0.75rem;
    }

    .map-address {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }

    .map-actions {
        justify-content: center;
    }

    .map-actions .btn {
        flex: 1;
        min-width: 120px;
        text-align: center;
    }
}

@media (max-width: 576px) {
    .map-iframe {
        height: 300px;
    }

    .map-info {
        position: static;
        margin-top: 1rem;
        border-radius: 0.375rem;
    }

    .map-container {
        border-radius: 0.375rem;
    }
}

/* ===========================================
   ESTILOS ESPECÍFICOS PARA PÁGINA DE RELATÓRIOS
   =========================================== */

/* Filtros responsivos */
@media (max-width: 768px) {
    .card .row.g-3 {
        --bs-gutter-x: 0.5rem;
        --bs-gutter-y: 1rem;
    }

    .card .row.g-3 .col-md-3 {
        flex: 0 0 auto;
        width: 50%;
        margin-bottom: 1rem;
    }

    .card .row.g-3 .col-md-3 .form-select,
    .card .row.g-3 .col-md-3 .form-control {
        font-size: 0.875rem;
        padding: 0.5rem 0.75rem;
    }

    .card .row.g-3 .col-12 .d-flex {
        flex-direction: column;
        gap: 0.5rem;
    }

    .card .row.g-3 .col-12 .btn {
        width: 100%;
        margin-bottom: 0.25rem;
    }
}

/* Cards de estatísticas responsivos */
@media (max-width: 576px) {
    .row.g-3 .col-md-3 {
        flex: 0 0 auto;
        width: 100%;
        margin-bottom: 1rem;
    }

    .card .card-body .d-flex {
        flex-direction: column;
        text-align: center;
    }

    .card .card-body .d-flex .me-3 {
        margin-right: 0 !important;
        margin-bottom: 0.5rem;
    }

    .card .card-body .d-flex h3 {
        font-size: 1.5rem;
    }
}

/* Gráficos responsivos aprimorados */
@media (max-width: 768px) {
    .chart-container {
        height: 300px !important;
        margin-bottom: 2rem;
    }

    .chart-container canvas {
        max-height: 280px;
        width: 100% !important;
    }

/* Controle específico para weekChart */
#weekChart {
    height: 250px !important;
    max-height: 250px !important;
    width: 100% !important;
}

/* Controle específico para hourChart */
#hourChart {
    height: 250px !important;
    max-height: 250px !important;
    width: 100% !important;
}

/* Container específico para weekChart */
.chart-container:has(#weekChart) {
    height: 250px !important;
    position: relative;
}

/* Container específico para hourChart */
.chart-container:has(#hourChart) {
    height: 250px !important;
    position: relative;
}
}

/* Controle de altura para gráficos específicos */
.chart-container canvas {
    max-height: 400px;
}

#weekChart {
    height: 250px !important;
    max-height: 250px !important;
    width: 100% !important;
}

/* Tabelas responsivas aprimoradas */
@media (max-width: 768px) {
    .table-responsive {
        border: none;
    }

    .table-responsive .table {
        font-size: 0.875rem;
    }

    .table-responsive .table th,
    .table-responsive .table td {
        padding: 0.5rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 120px;
    }

    .table-responsive .table th:nth-child(1),
    .table-responsive .table td:nth-child(1) {
        max-width: 80px;
    }

    .table-responsive .table th:last-child,
    .table-responsive .table td:last-child {
        position: sticky;
        right: 0;
        background: white;
        border-left: 2px solid #dee2e6;
        max-width: 100px;
    }
}

/* Botões de ação responsivos */
@media (max-width: 576px) {
    .btn-group {
        display: flex;
        flex-direction: column;
        width: 100%;
    }

    .btn-group .btn {
        border-radius: 0.375rem !important;
        margin-bottom: 0.25rem;
    }

    .btn-group .btn:not(:last-child) {
        border-bottom-left-radius: 0 !important;
        border-bottom-right-radius: 0 !important;
    }

    .btn-group .btn:not(:first-child) {
        border-top-left-radius: 0 !important;
        border-top-right-radius: 0 !important;
    }
}

/* Header responsivo da página */
@media (max-width: 768px) {
    .container-fluid .row.align-items-center .col-md-8 h2 {
        font-size: 1.25rem;
        margin-bottom: 0.5rem;
    }

    .container-fluid .row.align-items-center .col-md-4 {
        text-align: center !important;
        margin-top: 1rem;
    }

    .breadcrumb {
        justify-content: center;
    }

    .breadcrumb li {
        font-size: 0.75rem;
    }
}

/* Alertas responsivos */
@media (max-width: 576px) {
    .alert {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
        text-align: center;
    }

    .alert .row {
        text-align: left;
    }

    .alert .row .col-md-3 {
        margin-bottom: 0.5rem;
    }
}

/* Modal responsivo para detalhes */
@media (max-width: 576px) {
    .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100vw - 1rem);
    }

    .modal-content {
        border-radius: 0.5rem;
    }

    .modal-header {
        padding: 1rem;
    }

    .modal-body {
        padding: 1rem;
        max-height: calc(100vh - 200px);
        overflow-y: auto;
    }
}