@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Plus+Jakarta+Sans:wght@300;400;500;600;700&display=swap');

:root {
    --bg-main: #080a10;
    --bg-card: rgba(17, 22, 39, 0.8);
    --bg-card-hover: rgba(24, 31, 54, 0.9);
    --bg-sidebar: #0b0e17;
    --border-color: rgba(255, 255, 255, 0.06);
    --border-hover: rgba(99, 102, 241, 0.3);
    
    --primary: #6366f1;
    --primary-glow: rgba(99, 102, 241, 0.15);
    --primary-hover: #4f46e5;
    
    --secondary: #0ea5e9;
    --secondary-hover: #0284c7;
    
    --success: #10b981;
    --success-glow: rgba(16, 185, 129, 0.1);
    --success-hover: #059669;
    
    --warning: #f59e0b;
    --warning-glow: rgba(245, 158, 11, 0.1);
    
    --danger: #f43f5e;
    --danger-glow: rgba(244, 63, 94, 0.1);
    --danger-hover: #e11d48;
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Plus Jakarta Sans', sans-serif;
    
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-body);
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* Sidebar Navigation */
.sidebar {
    width: 260px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 100;
}

.logo-container {
    padding: 30px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
}

.logo-icon {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 15px var(--primary-glow);
}

.logo-icon svg {
    width: 20px;
    height: 20px;
    fill: white;
}

.logo-text {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.25rem;
    letter-spacing: 0.5px;
    background: linear-gradient(to right, #ffffff, #a5b4fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-links {
    list-style: none;
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 10px;
    font-family: var(--font-heading);
    font-weight: 500;
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition);
}

.nav-item svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

.nav-item:hover, .nav-item.active {
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.03);
}

.nav-item.active {
    background: linear-gradient(90deg, var(--primary-glow) 0%, rgba(99, 102, 241, 0) 100%);
    border-left: 3px solid var(--primary);
    color: #a5b4fc;
}

.sidebar-footer {
    margin-top: auto;
    padding: 24px;
    border-top: 1px solid var(--border-color);
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
}

/* Main Content Area */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 40px;
    min-height: 100vh;
}

.tab-pane {
    display: none;
    animation: fadeIn 0.4s ease-out;
}

.tab-pane.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.header {
    margin-bottom: 32px;
}

.header h1 {
    font-family: var(--font-heading);
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-bottom: 8px;
    background: linear-gradient(to right, #ffffff, #cbd5e1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header p {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* Grid & Cards System */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
    margin-bottom: 36px;
}

.stat-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background-color: transparent;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-2px);
    border-color: var(--border-hover);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.stat-card.primary::before { background-color: var(--primary); }
.stat-card.success::before { background-color: var(--success); }
.stat-card.warning::before { background-color: var(--warning); }
.stat-card.danger::before { background-color: var(--danger); }

.stat-value {
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 8px;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 6px;
}

/* Layout Split: Form & Logs */
.dashboard-layout {
    display: grid;
    grid-template-columns: 450px 1fr;
    gap: 30px;
    align-items: start;
}

@media (max-width: 1100px) {
    .dashboard-layout {
        grid-template-columns: 1fr;
    }
}

/* Forms Styling */
.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 30px;
    backdrop-filter: blur(12px);
}

.card-title {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #e2e8f0;
}

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

.form-group.row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

label {
    display: block;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
textarea {
    width: 100%;
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 12px 16px;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.95rem;
    transition: var(--transition);
}

select {
    width: 100%;
    background-color: #111627;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 12px 16px;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.95rem;
    transition: var(--transition);
}

select option {
    background-color: #111627;
    color: var(--text-primary);
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
    background-color: rgba(255, 255, 255, 0.05);
}

textarea {
    resize: vertical;
    min-height: 100px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 10px;
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    border: 1px solid transparent;
    transition: var(--transition);
    text-decoration: none;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
    box-shadow: 0 4px 14px var(--primary-glow);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.3);
}

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

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

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

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

.btn-secondary {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border-color: var(--border-color);
}

.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.08);
}

.btn-sm {
    padding: 8px 14px;
    font-size: 0.85rem;
    border-radius: 8px;
}

.btn-block {
    width: 100%;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* Logs Console Terminal */
.console {
    background-color: #05060b;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    height: 480px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.8);
}

.console-header {
    background-color: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid var(--border-color);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.console-title {
    font-family: var(--font-heading);
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.console-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--text-muted);
}

.console-dot.active {
    background-color: var(--success);
    box-shadow: 0 0 8px var(--success);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

.console-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    font-family: monospace;
    font-size: 0.85rem;
    line-height: 1.6;
    color: #38bdf8;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.log-item {
    display: flex;
    gap: 12px;
}

.log-time {
    color: var(--text-muted);
    flex-shrink: 0;
}

.log-msg {
    color: #cbd5e1;
    word-break: break-all;
}

/* Leads Section Filters */
.filters-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.filter-tags {
    display: flex;
    gap: 8px;
}

.filter-tag {
    padding: 6px 14px;
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.filter-tag:hover, .filter-tag.active {
    color: var(--text-primary);
    background-color: rgba(99, 102, 241, 0.1);
    border-color: var(--primary);
}

/* Leads Card Grid */
.leads-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
    gap: 24px;
}

@media (max-width: 600px) {
    .leads-grid {
        grid-template-columns: 1fr;
    }
}

.lead-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: var(--transition);
}

.lead-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.3);
}

.lead-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
}

.lead-company {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.lead-website {
    font-size: 0.85rem;
    color: var(--secondary);
    text-decoration: none;
    word-break: break-all;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.lead-website:hover {
    text-decoration: underline;
}

.badge {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-pending { background-color: rgba(245, 158, 11, 0.12); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.2); }
.badge-approved { background-color: rgba(99, 102, 241, 0.12); color: #a5b4fc; border: 1px solid rgba(99, 102, 241, 0.2); }
.badge-sent { background-color: rgba(16, 185, 129, 0.12); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.2); }
.badge-failed { background-color: rgba(244, 63, 94, 0.12); color: #fb7185; border: 1px solid rgba(244, 63, 94, 0.2); }
.badge-rejected { background-color: rgba(100, 116, 139, 0.12); color: #cbd5e1; border: 1px solid rgba(100, 116, 139, 0.2); }

.lead-body {
    padding: 24px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.issues-container {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.issue-tag {
    padding: 4px 8px;
    background-color: var(--danger-glow);
    color: #fca5a5;
    border: 1px solid rgba(244, 63, 94, 0.2);
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
}

.lead-meta-row {
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.lead-meta-row strong {
    color: #e2e8f0;
}

.lead-notes {
    font-size: 0.8rem;
    color: var(--text-muted);
    background-color: rgba(255, 255, 255, 0.01);
    padding: 10px 14px;
    border-radius: 8px;
    border-left: 2px solid var(--border-color);
    line-height: 1.4;
    white-space: pre-line;
}

.lead-actions {
    padding: 16px 24px;
    background-color: rgba(0, 0, 0, 0.15);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Modal Popup Dialog */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal.active {
    opacity: 1;
    pointer-events: all;
}

.modal-content {
    background-color: var(--bg-sidebar);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    transform: translateY(-20px);
    transition: transform 0.3s ease;
}

.modal.active .modal-content {
    transform: translateY(0);
}

.modal-header {
    padding: 24px 30px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.8rem;
    cursor: pointer;
    line-height: 1;
}

.close-btn:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 30px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 20px 30px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 40px;
    color: var(--text-muted);
}

.empty-state svg {
    width: 60px;
    height: 60px;
    stroke: currentColor;
    stroke-width: 1.5;
    fill: none;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h3 {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

/* Queue progress styles */
.progress-bar-container {
    width: 100%;
    height: 8px;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    margin: 16px 0;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    width: 0%;
    transition: width 0.4s ease;
}

/* Notification Popups */
.toast-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 1100;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background-color: #0f172a;
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--primary);
    color: var(--text-primary);
    padding: 16px 20px;
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
    min-width: 300px;
    font-size: 0.9rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    animation: slideIn 0.3s ease;
}

.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* History Table Styling */
.history-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.history-table th, 
.history-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

.history-table th {
    color: var(--text-secondary);
    font-family: var(--font-heading);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.history-table td {
    color: var(--text-primary);
    font-size: 0.85rem;
}

.history-table tr:hover td {
    background-color: rgba(255, 255, 255, 0.01);
}

.lead-screenshot {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-bottom: 1px solid var(--border-color);
}

/* Switch Toggle Buttons */
.switch {
  position: relative;
  display: inline-block;
  width: 52px;
  height: 28px;
}

.switch input { 
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.1);
  transition: .4s;
  border: 1px solid var(--border-color);
}

.slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: #94a3b8;
  transition: .4s;
}

input:checked + .slider {
  background-color: var(--secondary);
}

input:checked + .slider:before {
  transform: translateX(24px);
  background-color: #ffffff;
}

/* Rounded sliders */
.slider.round {
  border-radius: 34px;
}

.slider.round:before {
  border-radius: 50%;
}

/* Autopilot pulsing status dots */
.status-dot-active {
    background-color: var(--success) !important;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    animation: pulse-green 1.5s infinite;
}

.status-dot-inactive {
    background-color: #64748b !important;
    box-shadow: none;
}

@keyframes pulse-green {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }
    70% {
        transform: scale(1);
        box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
    }
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

.badge-chip {
    cursor: pointer;
    background: rgba(56, 189, 248, 0.08);
    border: 1px solid rgba(56, 189, 248, 0.25);
    color: #38bdf8;
    font-size: 0.72rem;
    padding: 3px 8px;
    border-radius: 20px;
    transition: all 0.2s ease;
    user-select: none;
    display: inline-flex;
    align-items: center;
}

.badge-chip:hover {
    background: rgba(56, 189, 248, 0.22);
    border-color: #38bdf8;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(56, 189, 248, 0.2);
}


/* Navegacao em 6 telas */
.subnav { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.subnav-btn { background: rgba(255,255,255,0.04); color: var(--text-secondary); border: 1px solid var(--border-color); border-radius: 999px; padding: 7px 16px; font-size: 0.85rem; cursor: pointer; font-family: var(--font-heading); transition: var(--transition); }
.subnav-btn:hover { color: var(--text-primary); }
.subnav-btn.active { color: #a5b4fc; border-color: var(--primary); background: var(--primary-glow); }
.tab-help { background: rgba(99,102,241,0.08); border: 1px solid var(--border-color); border-left: 3px solid var(--primary); border-radius: 10px; padding: 12px 16px; margin-bottom: 18px; font-size: 0.88rem; color: var(--text-secondary); }
.tab-help-how { margin: 6px 0 10px; }
