/* ================================================================
   SISTEMA DE LEADS - CSS COMPLETO E FUNCIONAL
   ================================================================ */

/* IMPORTS */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* RESET BÁSICO */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* BODY */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 15px;
    line-height: 1.6;
    color: #1e293b;
    background: #f1f5f9;
}

/* LAYOUT PRINCIPAL */
.wrapper {
    display: flex;
    min-height: 100vh;
}

/* SIDEBAR */
.sidebar {
    width: 260px;
    background: #ffffff;
    border-right: 1px solid #e2e8f0;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.05);
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 1.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.sidebar-brand {
    color: #ffffff;
    font-size: 1.5rem;
    font-weight: 700;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-menu {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
}

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

.sidebar-menu li {
    margin-bottom: 0.25rem;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: #64748b;
    text-decoration: none;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
    font-weight: 500;
}

.sidebar-menu a i {
    font-size: 1.25rem;
    width: 24px;
}

.sidebar-menu a:hover {
    background: #f1f5f9;
    color: #6366f1;
    transform: translateX(4px);
}

.sidebar-menu a.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

/* MAIN CONTENT */
.main-content {
    flex: 1;
    margin-left: 260px;
}

/* NAVBAR */
.navbar {
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    padding: 1rem 2rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 999;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar-brand {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1e293b;
}

.navbar-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.navbar-user {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 999px;
    background: #f1f5f9;
}

/* CONTENT WRAPPER */
.content-wrapper {
    padding: 2rem;
    min-height: calc(100vh - 70px);
}

/* WELCOME BANNER */
.welcome-banner {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 2rem;
    border-radius: 1rem;
    color: white;
    margin-bottom: 2rem;
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.3);
}

/* CARDS */
.card {
    background: #ffffff;
    border-radius: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    transition: all 0.3s ease;
}

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

.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 2px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-body {
    padding: 1.5rem;
}

/* STAT CARDS */
.stat-card {
    background: #ffffff;
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.stat-card.success::before {
    background: linear-gradient(135deg, #0ba360 0%, #3cba92 100%);
}

.stat-card.info::before {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.stat-card.warning::before {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.stat-card.success .stat-icon {
    background: linear-gradient(135deg, #0ba360 0%, #3cba92 100%);
}

.stat-card.info .stat-icon {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.stat-card.warning .stat-icon {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: #1e293b;
    line-height: 1;
    margin-bottom: 0.5rem;
}

.stat-label {
    color: #64748b;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

/* BUTTONS */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

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

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
}

.btn-success {
    background: linear-gradient(135deg, #0ba360 0%, #3cba92 100%);
    color: #ffffff;
}

.btn-info {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: #ffffff;
}

.btn-light {
    background: #f1f5f9;
    color: #1e293b;
}

.btn-sm {
    padding: 0.375rem 0.875rem;
    font-size: 0.8125rem;
}

.w-100 {
    width: 100%;
}

/* BADGES */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.375rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.badge-warning {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

.badge-info {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

/* TABLE */
.table-container {
    border-radius: 0.75rem;
    overflow: hidden;
}

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

.table thead {
    background: #f8f9fa;
}

.table th {
    padding: 1rem 1.5rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: #64748b;
    border-bottom: 2px solid #e5e7eb;
}

.table td {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #f1f5f9;
}

.table tbody tr {
    transition: background 0.2s ease;
}

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

/* UTILITIES */
.text-center {
    text-align: center;
}

.fw-bold {
    font-weight: 700;
}

.mb-3 {
    margin-bottom: 1rem;
}

/* RESPONSIVE - MOBILE FIRST */

/* Hamburger Menu Toggle */
.menu-toggle {
    display: none;
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 10001;
    width: 48px;
    height: 48px;
    background: white;
    border: none;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.menu-toggle span {
    width: 24px;
    height: 2px;
    background: #1e293b;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
}

.menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}

/* Sidebar Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    backdrop-filter: blur(4px);
}

/* Mobile Styles (max-width: 768px) */
@media (max-width: 768px) {
    /* Show hamburger menu */
    .menu-toggle {
        display: flex;
    }
    
    /* Hide sidebar by default */
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .sidebar-overlay.active {
        display: block;
    }
    
    /* Remove sidebar margin */
    .main-content {
        margin-left: 0;
    }
    
    /* Adjust navbar for mobile */
    .navbar {
        padding: 1rem;
        padding-left: 70px; /* Space for hamburger */
    }
    
    .navbar-brand {
        font-size: 1rem;
    }
    
    .navbar-user {
        padding: 0.5rem;
    }
    
    .navbar-user-name {
        display: none; /* Hide username on small screens */
    }
    
    /* Content padding */
    .content-wrapper {
        padding: 1rem;
    }
    
    /* Stats cards stack */
    .row {
        gap: 1rem;
    }
    
    .stat-value {
        font-size: 2rem;
    }
    
    .stat-icon {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }
    
    /* Cards */
    .card-body {
        padding: 1rem;
    }
    
    .card-header {
        padding: 1rem;
    }
    
    /* Buttons - Touch friendly */
    .btn {
        min-height: 44px;
        padding: 0.75rem 1rem;
        font-size: 0.9375rem;
    }
    
    .btn-sm {
        min-height: 40px;
        padding: 0.5rem 0.875rem;
    }
    
    /* Tables responsive */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .table {
        min-width: 600px;
    }
    
    .table th,
    .table td {
        padding: 0.75rem;
        font-size: 0.875rem;
    }
    
    /* Grid layouts */
    .stats-grid,
    .instances-grid {
        grid-template-columns: 1fr !important;
    }
    
    /* Typography */
    body {
        font-size: 14px;
    }
    
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }
    
    /* Forms */
    .form-control,
    input,
    textarea,
    select {
        font-size: 16px; /* Prevent iOS zoom */
        min-height: 44px;
    }
    
    /* Modals */
    .modal-dialog {
        width: 95vw;
        max-width: 95vw;
        margin: 1rem auto;
    }
    
    /* Chat layout */
    .chat-container {
        height: calc(100vh - 140px);
    }
    
    /* Sidebar menu links - larger touch targets */
    .sidebar-menu a {
        padding: 1rem;
        font-size: 0.9375rem;
    }
}

/* Small phones (max-width: 375px) */
@media (max-width: 375px) {
    .navbar {
        padding: 0.75rem;
        padding-left: 65px;
    }
    
    .navbar-brand {
        font-size: 0.9375rem;
    }
    
    .content-wrapper {
        padding: 0.75rem;
    }
    
    .stat-value {
        font-size: 1.75rem;
    }
    
    .btn {
        font-size: 0.875rem;
    }
}

/* Tablets and larger (min-width: 768px) */
@media (min-width: 768px) {
    .menu-toggle {
        display: none !important;
    }
    
    .sidebar {
        transform: translateX(0) !important;
    }
    
    .sidebar-overlay {
        display: none !important;
    }
}