:root {
    --primary: #1a237e;
    --primary-dark: #0d1259;
    --primary-light: #3949ab;
    --accent: #ff6f00;
    --danger: #d32f2f;
    --success: #2e7d32;
    --warning: #f57c00;
    --info: #0288d1;
    --dark: #1a1a2e;
    --gray: #6c757d;
    --light: #f8f9fa;
    --white: #ffffff;
    --border: #dee2e6;
    --shadow: rgba(0,0,0,0.15);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--light);
    color: var(--dark);
    min-height: 100vh;
    overflow-x: hidden;
}

/* === HEADER === */
.header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 12px 16px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 10px var(--shadow);
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 1.2rem;
}

.header-logo img {
    height: 32px;
}

.header-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.header-btn {
    background: rgba(255,255,255,0.15);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
}

.header-btn:hover {
    background: rgba(255,255,255,0.25);
}

.header-btn .badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--danger);
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
}

/* === MAIN CONTENT === */
.main-content {
    margin-top: 60px;
    margin-bottom: 70px;
    min-height: calc(100vh - 130px);
}

/* === MAPA === */
.map-container {
    height: calc(100vh - 130px);
    width: 100%;
    position: relative;
}

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

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

.map-btn {
    background: white;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 8px;
    box-shadow: 0 2px 8px var(--shadow);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 20px;
    color: var(--primary);
    transition: transform 0.2s, box-shadow 0.2s;
}

.map-btn:active {
    transform: scale(0.95);
}

.map-btn.active {
    background: var(--primary);
    color: white;
}

/* Legenda do mapa */
.map-legend {
    position: absolute;
    bottom: 20px;
    left: 10px;
    background: white;
    padding: 12px;
    border-radius: 8px;
    box-shadow: 0 2px 10px var(--shadow);
    z-index: 500;
    font-size: 12px;
    max-width: 200px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.legend-icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

/* === BOTTOM NAVIGATION === */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    display: flex;
    justify-content: space-around;
    padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
    box-shadow: 0 -2px 10px var(--shadow);
    z-index: 1000;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 16px;
    color: var(--gray);
    text-decoration: none;
    font-size: 11px;
    transition: color 0.2s;
    cursor: pointer;
    border: none;
    background: none;
}

.nav-item i {
    font-size: 22px;
    margin-bottom: 4px;
}

.nav-item.active {
    color: var(--primary);
}

.nav-item.active i {
    color: var(--primary);
}

/* === CARDS === */
.card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px var(--shadow);
    margin: 12px;
    overflow: hidden;
}

.card-header {
    padding: 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-title {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--dark);
}

.card-body {
    padding: 16px;
}

/* === LISTA DE ALVOS === */
.alvo-item {
    display: flex;
    padding: 12px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.2s;
}

.alvo-item:active {
    background: var(--light);
}

.alvo-foto {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 12px;
    border: 3px solid var(--border);
}

.alvo-foto.com-mandado {
    border-color: var(--danger);
}

.alvo-foto.sem-mandado {
    border-color: var(--warning);
}

.alvo-foto.preso {
    border-color: var(--success);
}

.alvo-info {
    flex: 1;
}

.alvo-nome {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 2px;
}

.alvo-vulgo {
    color: var(--gray);
    font-size: 0.85rem;
}

.alvo-status {
    font-size: 0.75rem;
    padding: 4px 8px;
    border-radius: 12px;
    font-weight: 500;
}

.status-com-mandado {
    background: #ffebee;
    color: var(--danger);
}

.status-sem-mandado {
    background: #fff3e0;
    color: var(--warning);
}

.status-preso {
    background: #e8f5e9;
    color: var(--success);
}

/* === SEARCH BAR === */
.search-container {
    padding: 12px;
    background: white;
    position: sticky;
    top: 60px;
    z-index: 100;
    border-bottom: 1px solid var(--border);
}

.search-box {
    display: flex;
    align-items: center;
    background: var(--light);
    border-radius: 24px;
    padding: 10px 16px;
}

.search-box input {
    border: none;
    background: none;
    flex: 1;
    font-size: 16px;
    outline: none;
    margin-left: 10px;
}

.search-box i {
    color: var(--gray);
}

/* === FILTERS === */
.filters {
    display: flex;
    gap: 8px;
    padding: 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.filter-chip {
    flex-shrink: 0;
    padding: 8px 16px;
    background: var(--light);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-chip.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* === BUTTONS === */
.btn {
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-warning {
    background: var(--warning);
    color: white;
}

.btn-block {
    width: 100%;
}

.btn-fab {
    position: fixed;
    bottom: 85px;
    right: 16px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--accent);
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(255, 111, 0, 0.4);
    font-size: 24px;
    cursor: pointer;
    z-index: 100;
    transition: transform 0.2s;
}

.btn-fab:active {
    transform: scale(0.95);
}

/* === FORMS === */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-weight: 500;
    margin-bottom: 6px;
    font-size: 14px;
    color: var(--dark);
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 16px;
    outline: none;
    transition: border-color 0.2s;
}

.form-control:focus {
    border-color: var(--primary);
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236c757d' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

/* === MODAL === */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    display: none;
    align-items: flex-end;
    justify-content: center;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: white;
    border-radius: 20px 20px 0 0;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    background: white;
}

.modal-title {
    font-size: 1.2rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--gray);
}

.modal-body {
    padding: 20px;
}

/* === TABS === */
.tabs {
    display: flex;
    border-bottom: 2px solid var(--border);
    position: sticky;
    top: 60px;
    background: white;
    z-index: 99;
}

.tab {
    flex: 1;
    padding: 14px;
    text-align: center;
    font-weight: 500;
    color: var(--gray);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* === STATS === */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 12px;
}

.stat-card {
    background: white;
    padding: 16px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 2px 8px var(--shadow);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--gray);
    margin-top: 4px;
}

/* === ALVO DETAIL === */
.alvo-detail-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 20px;
    text-align: center;
}

.alvo-detail-foto {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid white;
    margin-bottom: 12px;
}

.alvo-detail-nome {
    font-size: 1.5rem;
    font-weight: 700;
}

.alvo-detail-vulgo {
    opacity: 0.8;
    margin-top: 4px;
}

.info-row {
    display: flex;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.info-label {
    width: 100px;
    color: var(--gray);
    font-size: 0.9rem;
}

.info-value {
    flex: 1;
    font-weight: 500;
}

/* === GALLERY === */
.gallery {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    padding: 4px;
}

.gallery-item {
    aspect-ratio: 1;
    overflow: hidden;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: pointer;
}

/* === DILIGENCIA === */
.diligencia-form {
    padding: 16px;
}

.photo-capture {
    background: var(--light);
    border: 2px dashed var(--border);
    border-radius: 12px;
    padding: 30px;
    text-align: center;
    cursor: pointer;
}

.photo-capture i {
    font-size: 48px;
    color: var(--gray);
}

.photo-capture p {
    color: var(--gray);
    margin-top: 8px;
}

.photo-preview {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.photo-preview-item {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
}

.photo-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-preview-item .remove {
    position: absolute;
    top: 4px;
    right: 4px;
    background: var(--danger);
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    cursor: pointer;
}

/* === LOGIN === */
.login-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
}

.login-logo {
    text-align: center;
    margin-bottom: 40px;
}

.login-logo h1 {
    color: white;
    font-size: 2.5rem;
    margin-top: 12px;
}

.login-logo p {
    color: rgba(255,255,255,0.7);
}

.login-card {
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.login-card .form-control {
    background: var(--light);
    border: none;
}

/* === GPS TRACKING === */
.gps-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--success);
    color: white;
    border-radius: 20px;
    font-size: 12px;
}

.gps-status.off {
    background: var(--gray);
}

.gps-dot {
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
    100% {
        opacity: 1;
    }
}

/* === LOADING === */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* === TOAST === */
.toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--dark);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    z-index: 3000;
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* === RESPONSIVE === */
@media (min-width: 768px) {
    .main-content {
        max-width: 500px;
        margin-left: auto;
        margin-right: auto;
    }
    
    .modal {
        max-width: 500px;
        border-radius: 16px;
        margin-bottom: 20px;
    }
}

/* === MARKER ICONS === */
.marker-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

.marker-icon i {
    transform: rotate(45deg);
    color: white;
    font-size: 16px;
}

.marker-com-mandado {
    background: var(--danger);
}

.marker-sem-mandado {
    background: var(--warning);
}

.marker-preso {
    background: var(--success);
}

.marker-denuncia {
    background: var(--info);
}

.marker-equipe {
    background: var(--primary);
}
