/**
 * INTRANET BRASILAB - CSS Completo
 * Baseado no layout do admin, com identidade própria
 */

/* ============================================
   VARIÁVEIS
   ============================================ */
:root {
    --primary: #1a5f7a;
    --primary-dark: #134b61;
    --primary-light: #2d8faf;
    --secondary: #e67e22;
    --success: #27ae60;
    --danger: #e74c3c;
    --warning: #f39c12;
    --info: #3498db;
    --dark: #2c3e50;
    --light: #ecf0f1;
    --white: #ffffff;
    --sidebar-bg: #1a252f;
    --sidebar-width: 260px;
    --topbar-height: 60px;
    --font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* ============================================
   RESET E BASE
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background: #f4f6f9;
    color: var(--dark);
    font-size: 14px;
    line-height: 1.5;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    color: var(--primary-dark);
}

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

.login-box {
    background: var(--white);
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

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

.login-box .logo h2 {
    color: var(--primary);
    font-size: 24px;
    font-weight: 700;
    margin-top: 15px;
}

.login-box .logo h2 span {
    color: var(--secondary);
}

.login-box .logo p {
    color: #7f8c8d;
    font-size: 13px;
    margin-top: 5px;
}

.login-box .form-group {
    margin-bottom: 20px;
}

.login-box .form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 8px;
}

.login-box .form-control {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s;
}

.login-box .form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26, 95, 122, 0.1);
}

.login-box .btn {
    width: 100%;
    justify-content: center;
    padding: 14px;
    font-size: 15px;
    margin-top: 10px;
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    z-index: 1000;
    transition: all 0.3s ease;
    overflow-y: auto;
}

.sidebar-header {
    height: var(--topbar-height);
    background: var(--primary);
    display: flex;
    align-items: center;
    padding: 0 20px;
    border-bottom: 3px solid var(--secondary);
    position: sticky;
    top: 0;
    z-index: 10;
}

.sidebar-logo {
    color: var(--white);
    font-size: 18px;
    font-weight: 700;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-logo i {
    color: var(--secondary);
    font-size: 24px;
}

.sidebar-logo span {
    color: var(--secondary);
}

.sidebar-menu {
    padding: 15px 0;
}

.sidebar-menu ul {
    list-style: none;
}

.sidebar-menu li {
    position: relative;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: #a4b0be;
    text-decoration: none;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
    font-size: 14px;
}

.sidebar-menu a:hover,
.sidebar-menu a.active {
    background: rgba(255,255,255,0.05);
    color: var(--white);
    border-left-color: var(--secondary);
}

.sidebar-menu i {
    width: 24px;
    margin-right: 10px;
    font-size: 16px;
    text-align: center;
}

.sidebar-menu .menu-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #6c7a89;
    padding: 20px 20px 10px;
    font-weight: 600;
}

/* ============================================
   TOPBAR
   ============================================ */
.topbar {
    position: fixed;
    left: var(--sidebar-width);
    top: 0;
    right: 0;
    height: var(--topbar-height);
    background: var(--white);
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 25px;
    z-index: 999;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.menu-toggle {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--dark);
    cursor: pointer;
    padding: 5px;
    display: none;
}

.breadcrumb {
    font-size: 13px;
    color: #7f8c8d;
}

.breadcrumb a {
    color: var(--primary);
    text-decoration: none;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.topbar-icon {
    position: relative;
    color: #7f8c8d;
    font-size: 18px;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.3s;
}

.topbar-icon:hover {
    background: #f0f2f5;
    color: var(--primary);
}

.badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: var(--danger);
    color: var(--white);
    font-size: 10px;
    padding: 2px 5px;
    border-radius: 10px;
    min-width: 16px;
    text-align: center;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.user-profile img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary);
}

.user-profile span {
    font-size: 13px;
    font-weight: 600;
    color: var(--dark);
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-content {
    margin-left: var(--sidebar-width);
    margin-top: var(--topbar-height);
    padding: 25px;
    min-height: calc(100vh - var(--topbar-height));
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
}

.page-header h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--dark);
    margin: 0;
}

.page-header h1 i {
    color: var(--primary);
    margin-right: 10px;
}

/* ============================================
   CARDS
   ============================================ */
.card {
    background: var(--white);
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    border: none;
    margin-bottom: 20px;
}

.card-header {
    padding: 20px 25px;
    border-bottom: 1px solid #eef2f7;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.card-header h5 {
    font-size: 16px;
    font-weight: 700;
    margin: 0;
    color: var(--dark);
}

.card-header h5 i {
    color: var(--primary);
    margin-right: 8px;
}

.card-body {
    padding: 25px;
}

/* ============================================
   STATS CARDS
   ============================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.stat-card {
    background: var(--white);
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    display: flex;
    align-items: center;
    gap: 15px;
    transition: transform 0.3s, box-shadow 0.3s;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: var(--white);
    flex-shrink: 0;
}

.stat-icon.blue { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.stat-icon.green { background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%); }
.stat-icon.orange { background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%); }
.stat-icon.purple { background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%); }
.stat-icon.teal { background: linear-gradient(135deg, #00b894 0%, #00cec9 100%); }
.stat-icon.red { background: linear-gradient(135deg, #ff7675 0%, #d63031 100%); }

.stat-info h3 {
    font-size: 28px;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 4px;
    line-height: 1;
}

.stat-info p {
    font-size: 13px;
    color: #7f8c8d;
    margin: 0;
}

/* ============================================
   FINANCE CARDS
   ============================================ */
.finance-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 15px;
}

.finance-item {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    border-left: 4px solid var(--primary);
    transition: all 0.3s;
}

.finance-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.finance-item.custo { border-left-color: var(--danger); }
.finance-item.lucro { border-left-color: var(--success); }
.finance-item.imposto { border-left-color: var(--warning); }
.finance-item.venda { border-left-color: var(--primary); }

.finance-item small {
    display: block;
    color: #7f8c8d;
    font-size: 11px;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.finance-item strong {
    font-size: 18px;
    color: var(--dark);
    font-weight: 700;
}

/* ============================================
   TABLES
   ============================================ */
.table-container {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table thead th {
    background: #f8f9fa;
    color: #6c7a89;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 14px 16px;
    border-bottom: 2px solid #e9ecef;
    white-space: nowrap;
}

.table tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid #f0f2f5;
    vertical-align: middle;
    font-size: 13px;
}

.table tbody tr:hover {
    background: #f8f9fa;
}

.table tbody tr:last-child td {
    border-bottom: none;
}

/* ============================================
   BADGES
   ============================================ */
.badge-status {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-block;
}

.badge-ativo { background: #d4edda; color: #155724; }
.badge-inativo { background: #f8d7da; color: #721c24; }
.badge-rascunho { background: #fff3cd; color: #856404; }
.badge-aprovado { background: #d1ecf1; color: #0c5460; }
.badge-aguardando_aprovacao { background: #fff3cd; color: #856404; }
.badge-reprovado { background: #f8d7da; color: #721c24; }
.badge-cancelado { background: #e2e3e5; color: #383d41; }

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(26, 95, 122, 0.3);
}

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

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

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

.btn-secondary {
    background: #6c7a89;
    color: var(--white);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 12px;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    justify-content: center;
    border-radius: 8px;
}

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

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 8px;
}

.form-label .required {
    color: var(--danger);
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s;
    background: var(--white);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26, 95, 122, 0.1);
}

.form-control::placeholder {
    color: #bdc3c7;
}

select.form-control {
    cursor: pointer;
}

textarea.form-control {
    min-height: 120px;
    resize: vertical;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

/* ============================================
   ALERTS
   ============================================ */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 15px;
}

.alert-danger {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* ============================================
   PROGRESS BAR
   ============================================ */
.progress {
    height: 8px;
    border-radius: 4px;
    background: #e9ecef;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.6s ease;
    background: var(--primary);
}

/* ============================================
   PAGINATION
   ============================================ */
.pagination-nav {
    margin-top: 20px;
    display: flex;
    justify-content: center;
}

.pagination {
    display: flex;
    list-style: none;
    gap: 5px;
}

.pagination li a {
    display: block;
    padding: 8px 14px;
    border-radius: 6px;
    background: var(--white);
    color: var(--dark);
    font-size: 13px;
    font-weight: 600;
    transition: all 0.3s;
}

.pagination li a:hover {
    background: var(--primary);
    color: var(--white);
}

.pagination li.active a {
    background: var(--primary);
    color: var(--white);
}

/* ============================================
   UTILITIES
   ============================================ */
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }
.text-primary { color: var(--primary) !important; }
.text-muted { color: #7f8c8d !important; }

.bg-success { background: var(--success) !important; }
.bg-danger { background: var(--danger) !important; }

.mt-1 { margin-top: 5px; }
.mt-2 { margin-top: 10px; }
.mt-3 { margin-top: 15px; }
.mt-4 { margin-top: 20px; }
.mb-1 { margin-bottom: 5px; }
.mb-2 { margin-bottom: 10px; }
.mb-3 { margin-bottom: 15px; }
.mb-4 { margin-bottom: 20px; }

.d-flex { display: flex; }
.justify-between { justify-content: space-between; }
.align-center { align-items: center; }
.gap-2 { gap: 10px; }
.gap-3 { gap: 15px; }

/* ============================================
   BOOTSTRAP GRID SIMPLIFICADO
   ============================================ */
.row {
    display: flex;
    flex-wrap: wrap;
    margin-right: -10px;
    margin-left: -10px;
}

.col-lg-4, .col-md-6, .col-12 {
    position: relative;
    width: 100%;
    padding-right: 10px;
    padding-left: 10px;
}

@media (min-width: 768px) {
    .col-md-6 {
        flex: 0 0 50%;
        max-width: 50%;
    }
}

@media (min-width: 992px) {
    .col-lg-4 {
        flex: 0 0 33.333333%;
        max-width: 33.333333%;
    }
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .main-content,
    .topbar {
        margin-left: 0;
        left: 0;
    }
    
    .menu-toggle {
        display: block;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .finance-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ============================================
   SCROLLBAR
   ============================================ */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}