:root {
    --primary: #198754;
    --primary-dark: #146c43;
    --secondary: #6c757d;
    --accent: #ffc107;
    --light: #f8f9fa;
    --dark: #212529;
    --danger: #dc3545;
    --info: #0dcaf0;
    --white: #ffffff;
    --success: #198754;
    --warning: #ffc107;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    line-height: 1.6;
}

.main-content {
    flex: 1;
    padding-bottom: 2rem;
}

/* Header Styling */
.main-header {
    background-color: var(--primary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    padding: 1rem 0;
}

.header-title {
    color: var(--white);
    margin: 0;
    font-weight: 600;
}

.header-subtitle {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
    margin: 0;
}

.user-info {
    color: var(--white);
    font-size: 0.9rem;
}

/* Sidebar Styling */
.sidebar {
    background-color: var(--white);
    border-right: 1px solid rgba(0, 0, 0, 0.1);
    min-height: calc(100vh - 70px);
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 70px;
}

.sidebar .nav-link {
    padding: 1rem 1.25rem;
    color: var(--dark);
    border-radius: 0;
    border-left: 3px solid transparent;
    transition: all 0.3s ease;
    font-size: 1rem;
    font-weight: 500;
}

.sidebar .nav-link:hover, 
.sidebar .nav-link.active {
    background-color: rgba(25, 135, 84, 0.1);
    border-left: 3px solid var(--primary);
    color: var(--primary);
}

.sidebar .nav-link i {
    width: 24px;
    text-align: center;
    margin-right: 8px;
    font-size: 1.1rem;
}

/* Card Styling */
.card-dashboard {
    border-radius: 12px;
    border: none;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card-dashboard:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
}

.card-dashboard .card-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.card-dashboard .card-value {
    font-size: 2rem;
    font-weight: 700;
}

.card {
    border-radius: 12px;
    border: none;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.card-header {
    padding: 1.25rem;
    font-weight: 600;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.card-section .card-header {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: var(--white);
    border-bottom: none;
}

.section-title {
    display: flex;
    align-items: center;
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.section-title i {
    margin-right: 0.5rem;
    font-size: 1.2rem;
}

/* Form Styling - Otimizado para Mobile */
.form-label {
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.form-control,
.form-select {
    border-radius: 8px;
    padding: 0.75rem;
    border: 2px solid #e9ecef;
    transition: all 0.3s ease;
    font-size: 1rem;
    line-height: 1.5;
    min-height: 48px; /* Mínimo para touch */
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.25rem rgba(25, 135, 84, 0.15);
    outline: none;
}

.form-control.is-valid,
.form-select.is-valid {
    border-color: var(--success);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%23198754' d='m2.3 6.73.4-.4L4.1 4.9l1.4-1.4.4.4L4.5 5.3 2.3 6.73z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem;
}

.form-control.is-invalid,
.form-select.is-invalid {
    border-color: var(--danger);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath d='m5.8 4.6 2.4 2.4M8.2 4.6l-2.4 2.4'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem;
}

/* Select específico para mobile */
.form-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 12px;
    cursor: pointer;
}

.form-select:focus {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23198754' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
}

/* Texto de ajuda */
.form-text {
    font-size: 0.875rem;
    color: #6c757d;
    margin-top: 0.25rem;
}

.form-text i {
    margin-right: 0.25rem;
}

/* Button Styling - Otimizado para Mobile */
.btn {
    border-radius: 8px;
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    transition: all 0.3s ease;
    border: none;
    min-height: 48px; /* Mínimo para touch */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.1rem;
    min-height: 56px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: var(--white);
    box-shadow: 0 2px 4px rgba(25, 135, 84, 0.2);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark), #0f5132);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(25, 135, 84, 0.3);
    color: var(--white);
}

.btn-secondary {
    background-color: var(--secondary);
    color: var(--white);
}

.btn-secondary:hover {
    background-color: #5a6268;
    color: var(--white);
}

.btn-warning {
    background-color: var(--warning);
    color: var(--dark);
}

.btn-warning:hover {
    background-color: #e0a800;
    color: var(--dark);
}

.btn-danger {
    background-color: var(--danger);
    color: var(--white);
}

.btn-danger:hover {
    background-color: #bb2d3b;
    color: var(--white);
}

.btn-info {
    background-color: var(--info);
    color: var(--dark);
}

.btn-info:hover {
    background-color: #3dd5f3;
    color: var(--dark);
}

.btn-success {
    background-color: var(--success);
    color: var(--white);
}

.btn-success:hover {
    background-color: var(--primary-dark);
    color: var(--white);
}

/* Grid responsivo para botões */
.d-grid .btn {
    width: 100%;
}

/* Badge Styling */
.badge {
    font-weight: 600;
    padding: 0.5em 0.8em;
    border-radius: 6px;
}

/* Footer Styling */
footer {
    background-color: var(--dark);
    color: var(--white);
    padding: 1.5rem 0;
    margin-top: auto;
}

.footer-logo {
    max-height: 40px;
    margin-right: 1rem;
}

/* Table Styling - Mobile First */
.table-responsive {
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.data-table {
    border-radius: 8px;
    overflow: hidden;
}

.data-table thead th {
    background-color: var(--primary);
    color: var(--white);
    font-weight: 600;
    border: none;
    padding: 1rem 0.75rem;
    font-size: 0.9rem;
}

.data-table tbody tr:hover {
    background-color: rgba(25, 135, 84, 0.05);
}

.data-table tbody td {
    padding: 0.75rem;
    vertical-align: middle;
    border-bottom: 1px solid #dee2e6;
}

/* Alert Styling */
.alert {
    border-radius: 8px;
    border: none;
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.alert-success {
    background-color: rgba(25, 135, 84, 0.1);
    color: var(--success);
    border-left: 4px solid var(--success);
}

.alert-danger {
    background-color: rgba(220, 53, 69, 0.1);
    color: var(--danger);
    border-left: 4px solid var(--danger);
}

.alert-warning {
    background-color: rgba(255, 193, 7, 0.1);
    color: #856404;
    border-left: 4px solid var(--warning);
}

.alert-info {
    background-color: rgba(13, 202, 240, 0.1);
    color: #055160;
    border-left: 4px solid var(--info);
}

/* Geolocation Section */
.geo-section {
    background: linear-gradient(135deg, rgba(13, 202, 240, 0.1), rgba(13, 202, 240, 0.05));
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    border: 1px solid rgba(13, 202, 240, 0.2);
}

/* Chart container */
.chart-container {
    height: 300px;
    position: relative;
    margin: 1rem 0;
}

/* Stats Card */
.stats-card {
    border-radius: 12px;
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stats-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.stats-value {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 1rem 0;
}

/* Login Page */
.login-page {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.login-card {
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    background-color: white;
    padding: 2rem;
    width: 100%;
    max-width: 400px;
    margin: 1rem;
}

.login-title {
    text-align: center;
    color: var(--primary);
    font-weight: 700;
    margin-bottom: 2rem;
    font-size: 1.5rem;
}

/* Responsive Design - Mobile First */
@media (max-width: 768px) {
    .container-fluid {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    
    .main-content {
        padding: 1rem 0;
    }
    
    /* Header mobile */
    .main-header {
        padding: 0.75rem 0;
    }
    
    .header-title {
        font-size: 1.25rem;
    }
    
    .header-subtitle {
        font-size: 0.8rem;
    }
    
    .user-info {
        font-size: 0.8rem;
        margin-top: 0.5rem;
    }
    
    /* Sidebar mobile */
    .sidebar {
        position: static;
        min-height: auto;
        border-right: none;
        border-bottom: 1px solid rgba(0, 0, 0, 0.1);
        margin-bottom: 1rem;
        border-radius: 8px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }
    
    .sidebar .nav {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: space-around;
    }
    
    .sidebar .nav-link {
        padding: 0.75rem 0.5rem;
        text-align: center;
        border-left: none;
        border-bottom: 3px solid transparent;
        flex: 1;
        min-width: 80px;
        font-size: 0.8rem;
    }
    
    .sidebar .nav-link:hover, 
    .sidebar .nav-link.active {
        border-left: none;
        border-bottom: 3px solid var(--primary);
    }
    
    .sidebar .nav-link i {
        display: block;
        margin: 0 0 0.25rem 0;
        font-size: 1.2rem;
    }
    
    /* Cards mobile */
    .card {
        margin-bottom: 1rem;
        border-radius: 8px;
    }
    
    .card-header {
        padding: 1rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    /* Forms mobile */
    .form-label {
        font-size: 0.9rem;
        font-weight: 600;
    }
    
    .form-control,
    .form-select {
        padding: 0.75rem;
        font-size: 1rem;
        min-height: 48px;
    }
    
    /* Melhor espaçamento para mobile */
    .mb-3 {
        margin-bottom: 1rem;
    }
    
    .row {
        margin-left: -0.5rem;
        margin-right: -0.5rem;
    }
    
    .row > * {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
    
    /* Botões mobile */
    .btn {
        padding: 0.75rem 1rem;
        font-size: 0.95rem;
        min-height: 48px;
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    .btn-lg {
        padding: 1rem 1.5rem;
        font-size: 1.1rem;
        min-height: 56px;
    }
    
    .d-md-flex .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    /* Geolocalização mobile */
    .geo-section {
        padding: 1rem;
    }
    
    #btn-geo {
        font-size: 1.1rem;
        padding: 1rem;
        min-height: 56px;
    }
    
    /* Table mobile */
    .table-responsive {
        font-size: 0.875rem;
    }
    
    .data-table thead th {
        padding: 0.5rem 0.25rem;
        font-size: 0.8rem;
    }
    
    .data-table tbody td {
        padding: 0.5rem 0.25rem;
        font-size: 0.85rem;
    }
    
    /* Chart mobile */
    .chart-container {
        height: 250px;
    }
    
    /* Stats cards mobile */
    .card-dashboard .card-value {
        font-size: 1.5rem;
    }
    
    .card-dashboard .card-icon {
        font-size: 2rem;
    }
    
    /* Login mobile */
    .login-card {
        padding: 1.5rem;
        margin: 0.5rem;
    }
    
    .login-title {
        font-size: 1.25rem;
    }
}

@media (max-width: 576px) {
    /* Extra small devices */
    .container-fluid {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
    
    .card-header {
        padding: 0.75rem;
    }
    
    .card-body {
        padding: 0.75rem;
    }
    
    .section-title {
        font-size: 1rem;
    }
    
    .form-control,
    .form-select {
        padding: 0.625rem;
    }
    
    .btn {
        padding: 0.625rem 0.875rem;
    }
    
    /* Sidebar extra mobile */
    .sidebar .nav-link {
        font-size: 0.75rem;
        padding: 0.5rem 0.25rem;
    }
    
    .sidebar .nav-link i {
        font-size: 1rem;
    }
    
    /* Table extra mobile */
    .data-table {
        font-size: 0.8rem;
    }
    
    .data-table thead th,
    .data-table tbody td {
        padding: 0.375rem 0.125rem;
    }
}

/* Landscape mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .main-header {
        padding: 0.5rem 0;
    }
    
    .sidebar {
        margin-bottom: 0.5rem;
    }
    
    .card {
        margin-bottom: 0.75rem;
    }
    
    .geo-section {
        padding: 0.75rem;
    }
}

/* Utilities para mobile */
.mobile-hidden {
    display: block;
}

.mobile-only {
    display: none;
}

@media (max-width: 768px) {
    .mobile-hidden {
        display: none;
    }
    
    .mobile-only {
        display: block;
    }
}

/* Melhor contraste para acessibilidade */
.text-muted {
    color: #6c757d !important;
}

.bg-light-primary {
    background-color: rgba(25, 135, 84, 0.1);
}

/* Scrollbar personalizada para webkit */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

/* Focus visível para acessibilidade */
.form-control:focus,
.form-select:focus,
.btn:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Loading states */
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn .fa-spinner {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Notifications */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    max-width: 300px;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Print styles */
@media print {
    .sidebar,
    .btn,
    .mobile-only,
    .geo-section,
    .alert {
        display: none !important;
    }
    
    .card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    .main-content {
        padding: 0;
    }
}