/* ================================
   SALESQUEST - CSS MODERNO V2.0
   Design Profissional e Vendável
   ================================ */

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

:root {
    /* Cores Modernas */
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #10b981;
    --accent: #f59e0b;
    --danger: #ef4444;

    /* Backgrounds */
    --bg-main: #0f172a;
    --bg-card: #1e293b;
    --bg-card-hover: #334155;
    --bg-overlay: rgba(15, 23, 42, 0.95);

    /* Text */
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;

    /* Borders */
    --border-color: #334155;
    --border-hover: #475569;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
    --glow-primary: 0 0 20px rgba(99, 102, 241, 0.4);
    --glow-secondary: 0 0 20px rgba(16, 185, 129, 0.4);

    /* Font */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

    /* Transitions */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: var(--font-family);
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ================================
   LOADING SCREEN
   ================================ */

.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-overlay);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 1;
    transition: opacity 0.5s ease;
}

.loading-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-screen p {
    color: var(--text-secondary);
    font-size: 16px;
}

/* ================================
   HEADER
   ================================ */

.header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    padding: 16px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-md);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 20px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}

.logo:hover {
    transform: scale(1.05);
}

.logo-icon {
    font-size: 28px;
    animation: float 3s ease-in-out infinite;
}

.logo-text {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav {
    display: flex;
    gap: 8px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 12px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    transition: var(--transition);
    border: 1px solid transparent;
}

.nav-link:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    border-color: var(--border-hover);
}

.nav-link.active {
    background: var(--primary);
    color: white;
    box-shadow: var(--glow-primary);
}

.nav-icon {
    font-size: 18px;
}

/* ================================
   MAIN
   ================================ */

.main {
    padding: 40px 0 80px;
}

/* ================================
   STATS CARDS
   ================================ */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.stat-icon {
    font-size: 32px;
    opacity: 0.9;
}

.stat-trend {
    font-size: 13px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
}

.stat-trend.positive {
    background: rgba(16, 185, 129, 0.2);
    color: var(--secondary);
}

.stat-value {
    font-size: 36px;
    font-weight: 800;
    margin-bottom: 8px;
    background: linear-gradient(135deg, var(--text-primary), var(--text-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
}

/* ================================
   PAGES
   ================================ */

.page {
    display: none;
    animation: fadeInUp 0.5s ease;
}

.page.active {
    display: block;
}

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

/* ================================
   SECTION
   ================================ */

.section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 32px;
    margin-bottom: 32px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    flex-wrap: wrap;
    gap: 20px;
}

.section-title {
    font-size: 24px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
}

.title-icon {
    font-size: 28px;
}

/* ================================
   PERÍODO TABS
   ================================ */

.periodo-tabs {
    display: flex;
    gap: 8px;
    background: var(--bg-main);
    padding: 6px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.periodo-tab {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;
}

.periodo-tab:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.periodo-tab.active {
    background: var(--primary);
    color: white;
    box-shadow: var(--glow-primary);
}

/* ================================
   PÓDIO (TOP 3)
   ================================ */

.podio {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 20px;
    margin-bottom: 48px;
    padding: 40px 20px;
    position: relative;
}

.podio-item {
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-card-hover) 100%);
    border: 2px solid var(--border-color);
    border-radius: 20px;
    padding: 24px;
    text-align: center;
    transition: var(--transition);
    position: relative;
    cursor: pointer;
    min-width: 200px;
}

.podio-item:hover {
    transform: translateY(-8px) scale(1.05);
    border-color: var(--primary);
    box-shadow: var(--shadow-lg);
}

.podio-primeiro {
    order: 2;
    padding: 32px 24px;
    border-width: 3px;
    border-color: #fbbf24;
    box-shadow: 0 0 40px rgba(251, 191, 36, 0.3);
}

.podio-segundo {
    order: 1;
}

.podio-terceiro {
    order: 3;
}

.crown-animated {
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 40px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateX(-50%) translateY(0px); }
    50% { transform: translateX(-50%) translateY(-10px); }
}

.podio-rank {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.podio-avatar {
    font-size: 48px;
    margin: 12px 0;
}

.podio-primeiro .podio-avatar {
    font-size: 64px;
}

.podio-nome {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 4px;
}

.podio-nivel {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.podio-pontos {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.pontos-valor {
    font-size: 28px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--secondary), var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.podio-primeiro .pontos-valor {
    font-size: 36px;
}

.pontos-label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
}

.podio-medal {
    font-size: 32px;
    margin-top: 12px;
}

/* ================================
   RANKING LIST
   ================================ */

.ranking-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ranking-item {
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 20px;
    transition: var(--transition);
    cursor: pointer;
}

.ranking-item:hover {
    background: var(--bg-card);
    border-color: var(--primary);
    transform: translateX(8px);
}

.ranking-posicao {
    font-size: 20px;
    font-weight: 700;
    width: 40px;
    text-align: center;
    color: var(--text-muted);
}

.ranking-avatar {
    font-size: 36px;
}

.ranking-info {
    flex: 1;
}

.ranking-nome {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

.ranking-nivel {
    font-size: 13px;
    color: var(--text-secondary);
}

.ranking-pontos {
    font-size: 18px;
    font-weight: 700;
    color: var(--secondary);
    min-width: 100px;
    text-align: right;
}

/* ================================
   VENDEDORES GRID
   ================================ */

.vendedores-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.vendedor-card {
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    text-align: center;
    transition: var(--transition);
    cursor: pointer;
}

.vendedor-card:hover {
    border-color: var(--primary);
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.vendedor-avatar {
    font-size: 64px;
    margin-bottom: 16px;
}

.vendedor-nome {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 8px;
}

.vendedor-nivel {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.vendedor-xp-bar {
    background: var(--bg-card);
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.vendedor-xp-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: 4px;
    transition: width 1s ease;
}

.vendedor-xp-text {
    font-size: 12px;
    color: var(--text-muted);
}

/* ================================
   MISSÕES
   ================================ */

.missoes-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.missao-card {
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 20px;
    transition: var(--transition);
}

.missao-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
}

.missao-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.missao-tipo {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 4px 10px;
    border-radius: 20px;
    background: rgba(99, 102, 241, 0.2);
    color: var(--primary);
}

.missao-xp {
    font-size: 13px;
    font-weight: 700;
    color: var(--secondary);
}

.missao-titulo {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
}

.missao-descricao {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.missao-progress {
    background: var(--bg-card);
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.missao-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--secondary));
    border-radius: 4px;
    transition: width 1s ease;
}

.missao-progress-text {
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
}

/* ================================
   COACH IA
   ================================ */

.coach-selector {
    margin-bottom: 24px;
}

.coach-selector label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.coach-select {
    width: 100%;
    max-width: 400px;
    padding: 12px 16px;
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 15px;
    font-family: var(--font-family);
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 20px;
}

.coach-select:hover,
.coach-select:focus {
    border-color: var(--primary);
    outline: none;
}

.coach-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: var(--glow-primary);
}

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

.btn-secondary:hover {
    background: #059669;
    box-shadow: var(--glow-secondary);
}

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

.btn-accent:hover {
    background: #d97706;
}

.btn-info {
    background: #3b82f6;
    color: white;
}

.btn-info:hover {
    background: #2563eb;
}

.coach-result {
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    min-height: 200px;
}

.coach-message {
    font-size: 16px;
    line-height: 1.8;
    color: var(--text-primary);
    white-space: pre-wrap;
}

.empty-state {
    color: var(--text-muted);
    text-align: center;
    padding: 60px 20px;
    font-size: 15px;
}

/* ================================
   FOOTER
   ================================ */

.footer {
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    padding: 24px 0;
    margin-top: auto;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-secondary);
    font-size: 14px;
}

.footer-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ================================
   ANÁLISE DE CONVERSAS
   ================================ */

.analise-selector {
    margin-bottom: 32px;
}

.analise-selector label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.analise-select {
    width: 100%;
    max-width: 400px;
    padding: 12px 16px;
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 15px;
    font-family: var(--font-family);
    cursor: pointer;
    transition: var(--transition);
}

.analise-select:hover,
.analise-select:focus {
    border-color: var(--primary);
    outline: none;
}

.analise-container {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Nota Geral Card */
.nota-card {
    background: linear-gradient(135deg, var(--bg-main) 0%, var(--bg-card-hover) 100%);
    border: 2px solid var(--border-color);
    border-radius: 20px;
    padding: 32px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.nota-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--secondary), var(--primary));
}

.nota-card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.nota-valor {
    font-size: 72px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--secondary) 0%, var(--primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 8px;
    line-height: 1;
}

.nota-label {
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 500;
}

.nota-detalhes {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

.nota-item {
    text-align: center;
}

.nota-item-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 6px;
    text-transform: uppercase;
    font-weight: 600;
}

.nota-item-valor {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}

/* Performance Grid */
.performance-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.performance-card {
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 20px;
    transition: var(--transition);
}

.performance-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
}

.performance-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.performance-titulo {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
}

.performance-percentual {
    font-size: 16px;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 20px;
}

.performance-percentual.green {
    background: rgba(16, 185, 129, 0.2);
    color: var(--secondary);
}

.performance-percentual.yellow {
    background: rgba(245, 158, 11, 0.2);
    color: var(--accent);
}

.performance-percentual.red {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

.performance-valores {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
}

.performance-atual {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}

.performance-meta {
    font-size: 14px;
    color: var(--text-muted);
    align-self: flex-end;
}

.performance-bar {
    background: var(--bg-card);
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
}

.performance-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--secondary), var(--primary));
    border-radius: 4px;
    transition: width 1s ease;
}

/* Conversas Recentes */
.conversas-section {
    margin-top: 32px;
}

.conversas-titulo {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.conversas-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.conversa-item {
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    transition: var(--transition);
    cursor: pointer;
}

.conversa-item:hover {
    border-color: var(--primary);
    background: var(--bg-card);
    transform: translateX(4px);
}

.conversa-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.conversa-cliente {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.conversa-score {
    font-size: 14px;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 20px;
}

.conversa-score.excellent {
    background: rgba(16, 185, 129, 0.2);
    color: var(--secondary);
}

.conversa-score.good {
    background: rgba(99, 102, 241, 0.2);
    color: var(--primary);
}

.conversa-score.average {
    background: rgba(245, 158, 11, 0.2);
    color: var(--accent);
}

.conversa-score.poor {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

.conversa-info {
    display: flex;
    gap: 16px;
    font-size: 13px;
    color: var(--text-secondary);
    flex-wrap: wrap;
}

.conversa-tipo {
    display: flex;
    align-items: center;
    gap: 4px;
}

.conversa-data {
    display: flex;
    align-items: center;
    gap: 4px;
}

.conversa-resultado {
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 600;
}

.conversa-resultado.venda_fechada {
    color: var(--secondary);
}

.conversa-resultado.agendamento {
    color: var(--primary);
}

.conversa-resultado.interesse {
    color: var(--accent);
}

.conversa-resultado.perdido {
    color: var(--danger);
}

/* ================================
   RESPONSIVE
   ================================ */

@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 16px;
    }

    .nav {
        width: 100%;
        justify-content: space-around;
    }

    .nav-link span:not(.nav-icon) {
        display: none;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .podio {
        flex-direction: column;
        align-items: center;
    }

    .podio-item {
        order: initial !important;
        width: 100%;
        max-width: 300px;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .periodo-tabs {
        width: 100%;
    }

    .coach-actions {
        flex-direction: column;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }

    .footer-content {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 16px;
    }

    .section {
        padding: 20px;
    }

    .vendedores-grid,
    .missoes-container {
        grid-template-columns: 1fr;
    }
}
