:root {
    --brand-green: #16a34a;
    --sidebar-width: 260px;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #f8fafc;
    margin: 0;
    font-size: 14px;
}

/* Header */
.header {
    background: white;
    border-bottom: 1px solid #e2e8f0;
    padding: 1rem 1.5rem;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: #1e293b;
    font-weight: 600;
}

.header-brand img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.header-user {
    position: relative;
}

.user-menu {
    background: none;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s;
}

.user-menu:hover {
    border-color: var(--brand-green);
    color: var(--brand-green);
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: 70px;
    left: 0;
    width: var(--sidebar-width);
    height: calc(100vh - 70px);
    background: white;
    border-right: 1px solid #e2e8f0;
    overflow-y: auto;
    z-index: 999;
}

.sidebar-nav {
    padding: 1rem 0;
}

.nav-item {
    margin: 0 1rem 0.25rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: #64748b;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s;
    font-weight: 500;
}

.nav-link:hover {
    background-color: #f1f5f9;
    color: var(--brand-green);
}

.nav-link.active {
    background-color: var(--brand-green);
    color: white;
}

.nav-separator {
    height: 1px;
    background-color: #e2e8f0;
    margin: 0.5rem 1rem;
}

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    margin-top: 100px;
    padding: 0;
    min-height: calc(100vh - 100px);
}

/* Zerar gutter e margens das linhas no main-content */
.main-content .row {
    --bs-gutter-x: 1rem;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/* Zerar padding das colunas no main-content */
.main-content [class*="col-"] {
    padding-left: 0.5rem !important;
    padding-right: 0.5rem !important;
}

/* Cards */
.card {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

.card-header {
    background-color: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    padding: 1.5rem;
    border-radius: 12px 12px 0 0;
}

.card-body {
    padding: 1.5rem;
}

.stats-card {
    background: linear-gradient(135deg, var(--brand-green), #22c55e);
    color: white;
    border: none;
}

.stats-card .card-body {
    padding: 1.5rem;
}

.stats-number {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.stats-label {
    opacity: 0.9;
    font-size: 0.875rem;
}

/* Tables */
.table {
    margin-bottom: 0;
}

.table th {
    border-top: none;
    border-bottom: 2px solid #e2e8f0;
    font-weight: 600;
    color: #374151;
    padding: 1rem 0.75rem;
}

.table td {
    padding: 1rem 0.75rem;
    border-top: 1px solid #f1f5f9;
    vertical-align: middle;
}

.table-hover tbody tr:hover {
    background-color: #f8fafc;
}

/* Buttons */
.btn {
    border-radius: 8px;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

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

.btn-primary:hover {
    background: #15803d;
    color: white;
}

.btn-outline-primary {
    border: 1px solid var(--brand-green);
    color: var(--brand-green);
    background: transparent;
}

.btn-outline-primary:hover {
    background: var(--brand-green);
    color: white;
}

.btn-outline-danger {
    border: 1px solid #dc2626;
    color: #dc2626;
    background: transparent;
}

.btn-outline-danger:hover {
    background: #dc2626;
    color: white;
}

.btn-secondary {
    background: #6b7280;
    color: white;
}

.btn-secondary:hover {
    background: #4b5563;
    color: white;
}

/* Bootstrap Button Groups */
.btn-group .btn {
    border-radius: 0;
}

.btn-group .btn:first-child {
    border-top-left-radius: 0.375rem;
    border-bottom-left-radius: 0.375rem;
}

.btn-group .btn:last-child {
    border-top-right-radius: 0.375rem;
    border-bottom-right-radius: 0.375rem;
}

/* Badges */
.badge {
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
}

.bg-success {
    background-color: var(--brand-green) !important;
}

.bg-info {
    background-color: #0ea5e9 !important;
}

.bg-warning {
    background-color: #f59e0b !important;
}

.bg-primary {
    background-color: var(--brand-green) !important;
}

/* Forms */
.form-label {
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.5rem;
}

.form-control, .form-select {
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 0.75rem;
    font-size: 0.875rem;
    transition: border-color 0.2s;
}

.form-control:focus, .form-select:focus {
    border-color: var(--brand-green);
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.1);
    outline: none;
}

/* Tabs */
.nav-tabs {
    border-bottom: 1px solid #e2e8f0;
}

.nav-tabs .nav-link {
    border: none;
    border-bottom: 2px solid transparent;
    color: #64748b;
    padding: 1rem 1.5rem;
    margin-bottom: -1px;
    background: none;
    border-radius: 0;
}

.nav-tabs .nav-link:hover {
    border-bottom-color: var(--brand-green);
    color: var(--brand-green);
    background: none;
}

.nav-tabs .nav-link.active {
    border-bottom-color: var(--brand-green);
    color: var(--brand-green);
    background: none;
}

/* Modals */
.modal-content {
    border-radius: 12px;
    border: none;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.modal-header {
    border-bottom: 1px solid #e2e8f0;
    padding: 1.5rem;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    border-top: 1px solid #e2e8f0;
    padding: 1.5rem;
}

/* Alerts */
.alert {
    border-radius: 8px;
    border: none;
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
}

.alert-success {
    background-color: #dcfce7;
    color: #166534;
}

.alert-danger {
    background-color: #fef2f2;
    color: #991b1b;
}

/* Login Page Specific */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 0;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    padding: 2rem;
    text-align: center;
}

.brand-logo {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto 1rem auto;
    display: block;
}

.brand-title {
    color: #1e293b;
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.brand-subtitle {
    color: #64748b;
    font-size: 0.875rem;
    margin-bottom: 2rem;
}

.input-group {
    position: relative;
    margin-bottom: 1.5rem;
    text-align: left;
}

.input-group .form-control {
    padding-left: 3rem;
    padding-right: 3rem;
}

.input-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    z-index: 2;
}

.toggle-password {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    z-index: 2;
    padding: 0;
}

.btn-login {
    width: 100%;
    background: var(--brand-green);
    color: white;
    border: none;
    padding: 0.875rem;
    border-radius: 8px;
    font-weight: 500;
    margin-bottom: 1rem;
    font-size: 1rem;
    transition: background-color 0.2s;
}

.btn-login:hover {
    background: #15803d;
}

.security-note {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: #64748b;
    font-size: 0.875rem;
    margin-top: 1rem;
}

.security-note .icon {
    color: var(--brand-green);
}

/* Ícones FontAwesome */
.fas, .far, .fab, .fal, .fad, .fa {
    font-family: "Font Awesome 6 Free", "Font Awesome 6 Pro", "Font Awesome 6 Brands" !important;
    font-weight: 900 !important;
    display: inline-block !important;
    font-style: normal !important;
    font-variant: normal !important;
    text-rendering: auto !important;
    line-height: 1 !important;
}

/* Garantir que os ícones nos botões sejam visíveis */
.btn i {
    display: inline-block !important;
    font-size: 14px !important;
    line-height: 1 !important;
    vertical-align: middle !important;
}

.btn-sm i {
    font-size: 12px !important;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s;
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
        margin-top: 100px;
        padding: 0.5rem; /* leve respiro no mobile apenas */
    }

    /* No mobile, recoloca um pequeno gutter para não ficar apertado */
    .main-content .row {
        --bs-gutter-x: 0.5rem;
    }
    
    .header {
        padding: 1rem;
    }
    
    .header-brand span {
        display: none;
    }
}

/* Sidebar Submenu */
.nav-item.has-submenu .nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    position: relative;
}

.submenu-arrow {
    font-size: 0.75rem;
    transition: transform 0.2s;
    position: absolute;
    right: 1rem;
}

.submenu {
    display: none;
    background: rgba(0, 0, 0, 0.1);
    margin-left: 1rem;
    border-radius: 6px;
    overflow: hidden;
}

.submenu-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: #374151;
    text-decoration: none;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.submenu-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #1f2937;
    text-decoration: none;
}

.submenu-link.active {
    background: rgba(255, 255, 255, 0.2);
    color: #111827;
}

.submenu-link .icon {
    width: 14px;
    height: 14px;
}