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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, #173366 0%, #1a365d 100%);
    height: 100vh;
    overflow: hidden;
}

.dashboard-container {
    position: relative;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.header {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding: 1rem 2rem;
    z-index: 1000;
    animation: slideDown 0.6s ease-out;
}

.header h1 {
    color: white;
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.header p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 1rem;
}

.main-content {
    flex: 1;
    display: flex;
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.sidebar {
    width: 350px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-right: 1px solid rgba(255, 255, 255, 0.2);
    padding: 1.5rem;
    overflow-y: auto;
    animation: slideInLeft 0.8s ease-out 0.2s forwards;
    box-shadow: 2px 0 20px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    height: 100%;
    transition: transform 0.3s ease;
}

.filters-section {
    flex-shrink: 0;
}

.filter-group {
    margin-bottom: 1.5rem;
}

.filter-label {
    display: block;
    font-weight: 600;
    color: #173366;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-select {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 1rem;
    background: white;
    transition: all 0.3s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.75rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
}

.filter-select:focus {
    outline: none;
    border-color: #173366;
    box-shadow: 0 0 0 3px rgba(23, 51, 102, 0.1);
}

.status-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.status-chip {
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    user-select: none;
}

.status-chip.pendente {
    background: #fef3c7;
    color: #d97706;
}

.status-chip.processando {
    background: #dbeafe;
    color: #2563eb;
}

.status-chip.encaminhado {
    background: #f3e8ff;
    color: #7c3aed;
}

.status-chip.reprovado {
    background: #fee2e2;
    color: #dc2626;
}

.status-chip.resolvido {
    background: #d1fae5;
    color: #059669;
}

.status-chip.em_andamento {
    background: #cffafe;
    color: #0891b2;
}

.status-chip.cancelado {
    background: #f3f4f6;
    color: #6b7280;
}

.status-chip.active {
    transform: scale(1.05);
    border-color: currentColor;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.stats-section {
    background: white;
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    flex: 1;
    overflow-y: auto;
    margin-top: 1rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.stat-item {
    text-align: center;
    padding: 1rem;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border-radius: 12px;
    transition: transform 0.3s ease;
}

.stat-item:hover {
    transform: translateY(-2px);
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #173366;
}

.stat-label {
    font-size: 0.7rem;
    color: #64748b;
    margin-top: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.map-container {
    flex: 1;
    position: relative;
    overflow: hidden;
}

#map {
    width: 100%;
    height: 100%;
    opacity: 0;
    animation: fadeIn 1s ease-out 0.5s forwards;
}

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #e2e8f0;
    border-top: 4px solid #173366;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.map-controls {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.map-control-btn {
    background: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.map-control-btn:hover {
    background: #f8fafc;
    transform: scale(1.1);
}

.map-control-btn .material-icons {
    color: #173366;
    font-size: 20px;
}

/* Botão toggle para mobile */
.mobile-toggle-btn {
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 1002;
    background: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    cursor: pointer;
}

.mobile-toggle-btn .material-icons {
    color: #173366;
    font-size: 20px;
}

.legend {
    position: absolute;
    bottom: 130px;
    right: 20px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 1rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    backdrop-filter: blur(20px);
    min-width: 200px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
}

.legend h4 {
    margin-bottom: 0.75rem;
    color: #173366;
    font-size: 0.9rem;
    font-weight: 600;
}

.legend-item {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    margin-right: 0.75rem;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.legend-color.pendente { background: #f59e0b; }
.legend-color.processando { background: #3b82f6; }
.legend-color.encaminhado { background: #7c3aed; }
.legend-color.reprovado { background: #ef4444; }
.legend-color.resolvido { background: #10b981; }
.legend-color.em_andamento { background: #06b6d4; }
.legend-color.cancelado { background: #6b7280; }

.legend-label {
    font-size: 0.875rem;
    color: #4b5563;
    text-transform: capitalize;
}

/* Animations */
@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.15);
        opacity: 0.8;
    }
}

.marker-pulse {
    animation: pulse 3s infinite ease-in-out;
}

.custom-marker {
    border: none !important;
    background: transparent !important;
}

.custom-marker div {
    transition: all 0.3s ease;
}

.custom-marker:hover div {
    transform: scale(1.2);
}

/* Scrollbar customization */
.sidebar::-webkit-scrollbar,
.legend::-webkit-scrollbar,
.stats-section::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track,
.legend::-webkit-scrollbar-track,
.stats-section::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.sidebar::-webkit-scrollbar-thumb,
.legend::-webkit-scrollbar-thumb,
.stats-section::-webkit-scrollbar-thumb {
    background: #173366;
    border-radius: 10px;
}

.sidebar::-webkit-scrollbar-thumb:hover,
.legend::-webkit-scrollbar-thumb:hover,
.stats-section::-webkit-scrollbar-thumb:hover {
    background: #1a365d;
}

/* RESPONSIVE DESIGN - MOBILE */
@media (max-width: 768px) {
    body {
        overflow-x: hidden;
    }

    .dashboard-container {
        flex-direction: column;
    }

    .header {
        padding: 0.75rem 1rem;
        position: relative;
        z-index: 1001;
    }

    .header h1 {
        font-size: 1.25rem;
    }

    .header p {
        font-size: 0.875rem;
    }

    .main-content {
        flex-direction: column;
        height: calc(100vh - 80px);
    }

    .sidebar {
        width: 100%;
        height: 50vh;
        position: relative;
        transform: none;
        order: 1;
        padding: 1rem;
        overflow-y: auto;
        animation: none;
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.2);
        max-height: 50vh;
    }

    .map-container {
        flex: 1;
        order: 2;
        height: 50vh;
        min-height: 300px;
    }

    #map {
        height: 100%;
        width: 100%;
    }

    .filters-section {
        margin-bottom: 1rem;
    }

    .filter-group {
        margin-bottom: 1rem;
    }

    .filter-label {
        font-size: 0.8rem;
    }

    .filter-select {
        padding: 0.5rem;
        font-size: 0.875rem;
    }

    .status-filters {
        flex-wrap: wrap;
        gap: 0.25rem;
    }

    .status-chip {
        padding: 0.375rem 0.75rem;
        font-size: 0.75rem;
    }

    .stats-section {
        margin-top: 1rem;
        padding: 1rem;
        max-height: 200px;
        overflow-y: auto;
    }

    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 0.5rem;
    }

    .stat-item {
        padding: 0.5rem;
    }

    .stat-value {
        font-size: 1.1rem;
    }

    .stat-label {
        font-size: 0.6rem;
    }

    .legend {
        bottom: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
        min-width: auto;
        max-height: 150px;
        font-size: 0.875rem;
        padding: 0.75rem;
    }

    .legend h4 {
        font-size: 0.875rem;
        margin-bottom: 0.5rem;
    }

    .legend-item {
        margin-bottom: 0.375rem;
    }

    .legend-color {
        width: 12px;
        height: 12px;
        margin-right: 0.5rem;
    }

    .legend-label {
        font-size: 0.75rem;
    }

    .map-controls {
        top: 10px;
        right: 10px;
        flex-direction: row;
        gap: 5px;
    }

    .map-control-btn {
        width: 36px;
        height: 36px;
    }

    .map-control-btn .material-icons {
        font-size: 18px;
    }

    .loading-overlay {
        position: fixed;
    }

    .loading-spinner {
        width: 40px;
        height: 40px;
    }

    .mobile-toggle-btn {
        display: flex;
    }

    /* Sidebar escondida inicialmente no mobile */
    .sidebar.hidden {
        transform: translateX(-100%);
        position: fixed;
        top: 0;
        left: 0;
        z-index: 2000;
        height: 100vh;
        max-height: 100vh;
    }

    /* Quando sidebar está visível no mobile */
    .sidebar.visible {
        transform: translateX(0);
        position: fixed;
        top: 0;
        left: 0;
        z-index: 2000;
        height: 100vh;
        max-height: 100vh;
    }

    /* Overlay para fechar sidebar */
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1999;
        display: none;
    }

    .sidebar-overlay.active {
        display: block;
    }
}

/* Extra small devices */
@media (max-width: 480px) {
    .header h1 {
        font-size: 1.1rem;
    }

    .header p {
        font-size: 0.8rem;
    }

    .sidebar {
        padding: 0.75rem;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .stat-value {
        font-size: 1rem;
    }

    .stat-label {
        font-size: 0.65rem;
    }

    .legend {
        bottom: 10px;
        right: 5px;
        left: 5px;
        padding: 0.5rem;
        max-height: 120px;
    }

    .map-controls {
        top: 5px;
        right: 5px;
    }

    .map-control-btn {
        width: 32px;
        height: 32px;
    }

    .map-control-btn .material-icons {
        font-size: 16px;
    }

    .status-chip {
        padding: 0.25rem 0.5rem;
        font-size: 0.7rem;
    }

    .mobile-toggle-btn {
        width: 36px;
        height: 36px;
    }

    .mobile-toggle-btn .material-icons {
        font-size: 18px;
    }
}

/* Força o mapa a ocupar todo o espaço disponível */
.leaflet-container {
    width: 100% !important;
    height: 100% !important;
}

/* Garantir que o popup funcione bem no mobile */
.leaflet-popup-content-wrapper {
    max-width: 90vw !important;
}

.leaflet-popup-content {
    max-width: none !important;
}

@media (max-width: 768px) {
    .leaflet-popup-content {
        white-space: normal;
        word-wrap: break-word;
        max-width: 250px !important;
    }

    .leaflet-control-zoom {
        margin-left: 5px !important;
        margin-top: 5px !important;
    }

    .leaflet-bar a {
        width: 32px !important;
        height: 32px !important;
        line-height: 32px !important;
    }
}