/* Geral */
body {
    background-color: #f8f9fa;
}

/* Sidebar */
.sidebar {
    min-height: 100vh;
    background-color: #343a40;
    padding-top: 20px;
}

.sidebar-header {
    padding: 15px;
    border-bottom: 1px solid #4b545c;
    margin-bottom: 15px;
}

.sidebar-menu a {
    color: #fff;
    text-decoration: none;
    padding: 12px 20px;
    display: block;
    transition: all 0.3s;
}

.sidebar-menu a:hover,
.sidebar-menu a.active {
    background-color: #495057;
    border-left: 4px solid #007bff;
}

.sidebar-menu i {
    margin-right: 10px;
}

/* Content Area */
.main-content {
    padding: 20px;
}

/* Dashboard row spacing */
.main-content .row.g-4 {
    --bs-gutter-y: 1.5rem;
    margin-bottom: 1.5rem;
}

/* Cards */
.card-dashboard {
    transition: all 0.3s ease;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    border-radius: 12px;
    border: none;
    overflow: hidden;
    height: 100%;
    margin-bottom: 1.5rem;
}

.card-dashboard:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.12);
}

/* Dashboard Cards Styles */
.dashboard-card-primary, .dashboard-card-success, .dashboard-card-secondary,
.dashboard-card-danger, .dashboard-card-info, .dashboard-card-warning,
.dashboard-card-dark {
    position: relative;
}

.dashboard-card-primary::before,
.dashboard-card-success::before,
.dashboard-card-secondary::before,
.dashboard-card-danger::before,
.dashboard-card-info::before,
.dashboard-card-warning::before,
.dashboard-card-dark::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    height: 100%;
    width: 7px;
    border-radius: 0 12px 12px 0;
}

.dashboard-card-primary::before { background-color: #007bff; }
.dashboard-card-success::before { background-color: #28a745; }
.dashboard-card-secondary::before { background-color: #6c757d; }
.dashboard-card-danger::before { background-color: #dc3545; }
.dashboard-card-info::before { background-color: #17a2b8; }
.dashboard-card-warning::before { background-color: #ffc107; }
.dashboard-card-dark::before { background-color: #343a40; }

/* Dashboard Icon Container */
.dashboard-icon-container {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
}

.dashboard-icon {
    font-size: 1.8rem;
}

/* Light Background Colors for Icons */
.bg-primary-light { background-color: rgba(0, 123, 255, 0.15); }
.bg-success-light { background-color: rgba(40, 167, 69, 0.15); }
.bg-secondary-light { background-color: rgba(108, 117, 125, 0.15); }
.bg-danger-light { background-color: rgba(220, 53, 69, 0.15); }
.bg-info-light { background-color: rgba(23, 162, 184, 0.15); }
.bg-warning-light { background-color: rgba(255, 193, 7, 0.15); }
.bg-dark-light { background-color: rgba(52, 58, 64, 0.15); }

/* Dashboard Card Content */
.dashboard-card-content {
    flex: 1;
}

.dashboard-card-value {
    font-size: 1.8rem;
    font-weight: 700;
    margin-top: 5px;
    margin-bottom: 0;
}

/* Animation for cards */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card-dashboard {
    animation: fadeInUp 0.5s ease-out forwards;
}

.row .col-md-3:nth-child(1) .card-dashboard { animation-delay: 0.1s; }
.row .col-md-3:nth-child(2) .card-dashboard { animation-delay: 0.2s; }
.row .col-md-3:nth-child(3) .card-dashboard { animation-delay: 0.3s; }
.row .col-md-3:nth-child(4) .card-dashboard { animation-delay: 0.4s; }
.row .col-md-3:nth-child(5) .card-dashboard { animation-delay: 0.5s; }
.row .col-md-3:nth-child(6) .card-dashboard { animation-delay: 0.6s; }
.row .col-md-3:nth-child(7) .card-dashboard { animation-delay: 0.7s; }
.row .col-md-3:nth-child(8) .card-dashboard { animation-delay: 0.8s; }

/* Forms */
.form-control:focus,
.form-select:focus {
    border-color: #80bdff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* Tables */
.table thead th {
    background-color: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    padding: 12px 16px;
}

.table tbody td {
    padding: 12px 16px;
    vertical-align: middle;
}

.table-striped > tbody > tr:nth-of-type(odd) > * {
    background-color: rgba(0, 123, 255, 0.03);
}

.table tr {
    transition: all 0.2s ease;
}

.table-hover tbody tr:hover {
    background-color: rgba(0, 123, 255, 0.07);
}

/* Buttons */
.btn {
    border-radius: 4px;
    padding: 8px 16px;
}

.btn-primary {
    background-color: #007bff;
    border-color: #007bff;
}

.btn-primary:hover {
    background-color: #0056b3;
    border-color: #0056b3;
}

/* Modal */
.modal-header {
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

/* Login Page */
.login-container {
    max-width: 400px;
    margin: 100px auto;
    padding: 20px;
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        position: relative;
        min-height: auto;
    }

    .main-content {
        margin-left: 0;
    }
}

/* Tornar sidebar fixa apenas em telas médias e maiores */
@media (min-width: 768px) {
    .sidebar {
        position: fixed;
        left: 0;
        width: 250px;
        top: 0;
        bottom: 0;
        overflow-y: auto;
    }
    .main-content {
        margin-left: 250px;
    }
}

/* Offcanvas (mobile menu) styling to match the desktop sidebar */
.offcanvas {
    background-color: #343a40; /* mesma cor da sidebar */
    color: #fff;
}
.offcanvas .offcanvas-header,
.offcanvas .offcanvas-body {
    background-color: #343a40; /* garantir fundo escuro dentro do offcanvas */
}
.offcanvas .offcanvas-title {
    color: #fff;
}
.offcanvas .sidebar-menu a {
    color: #fff;
}
.offcanvas .sidebar-menu a:hover,
.offcanvas .sidebar-menu a.active {
    background-color: #495057;
    border-left: 4px solid #007bff;
}
.offcanvas .btn-close {
    filter: invert(1);
}

/* Melhorias de responsividade para tabelas e cards em telas pequenas */
@media (max-width: 767.98px) {
    /* Estilos para tabelas */
    .table-responsive table thead th {
        font-size: 0.9rem;
    }
    .table-responsive table td, .table-responsive table th {
        white-space: normal !important;
        word-break: break-word;
        vertical-align: middle;
    }
    .table-responsive .btn {
        padding: .25rem .5rem;
        font-size: .78rem;
    }
    /* Diminuir padding das células para caber melhor */
    .table td, .table th {
        padding: .45rem .5rem;
    }

    /* Forçar rolagem horizontal quando a tabela não couber na tela */
    .table-responsive {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }
    /* Define uma largura mínima para forçar o scroll lateral em tabelas grandes */
    .table-responsive table {
        min-width: 760px; /* ajuste esse valor conforme necessário */
    }
    
    /* Estilos responsivos para os cards do dashboard */
    .dashboard-icon-container {
        width: 50px;
        height: 50px;
    }
    
    .dashboard-icon {
        font-size: 1.5rem;
    }
    
    .dashboard-card-value {
        font-size: 1.5rem;
    }
    
    .card-title {
        font-size: 0.9rem;
    }
    
    .card-dashboard {
        margin-bottom: 15px !important;
    }
}

/* Ajustes específicos para tablets */
@media (min-width: 768px) and (max-width: 991.98px) {
    .dashboard-icon-container {
        width: 55px;
        height: 55px;
    }
    
    .dashboard-icon {
        font-size: 1.6rem;
    }
    
    .dashboard-card-value {
        font-size: 1.6rem;
    }
    
    .card-title {
        font-size: 0.95rem;
    }
}