/*
Theme Name: LeadTracker Theme
Theme URI: https://leadtracker.local
Description: Tema base para o sistema LeadTracker Pro. Design de command center escuro e sofisticado.
Version: 1.0.0
Author: LeadTracker Pro
Text Domain: leadtracker-theme
*/

/* === RESET & BASE === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

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

:root {
    --bg:        #0a0e1a;
    --bg2:       #0f1524;
    --bg3:       #151d30;
    --surface:   #1a2338;
    --border:    rgba(255,255,255,0.07);
    --primary:   #3b82f6;
    --primary-g: linear-gradient(135deg, #3b82f6, #6366f1);
    --accent:    #06d6a0;
    --warn:      #f59e0b;
    --danger:    #ef4444;
    --text:      #e2e8f0;
    --text-muted:#64748b;
    --text-dim:  #94a3b8;
    --radius:    16px;
    --radius-sm: 10px;
    --glow:      0 0 40px rgba(59,130,246,0.15);
    --shadow:    0 8px 32px rgba(0,0,0,0.4);
}

html { scroll-behavior: smooth; }

body {
    font-family: 'DM Sans', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* Subtle animated background grid */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(59,130,246,0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(59,130,246,0.03) 1px, transparent 1px);
    background-size: 40px 40px;
    pointer-events: none;
    z-index: 0;
}

/* === LAYOUT === */
#ltp-wrapper {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* === NAVBAR === */
#ltp-nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(10, 14, 26, 0.85);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    padding: 0 32px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ltp-nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}
.ltp-nav-brand-icon {
    width: 34px; height: 34px;
    background: var(--primary-g);
    border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px;
    box-shadow: 0 0 20px rgba(59,130,246,0.4);
}
.ltp-nav-brand-text {
    font-family: 'Syne', sans-serif;
    font-weight: 800;
    font-size: 17px;
    color: var(--text);
    letter-spacing: -0.02em;
}
.ltp-nav-brand-text span { color: var(--primary); }

.ltp-nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
    list-style: none;
}
.ltp-nav-links a {
    padding: 7px 14px;
    border-radius: 8px;
    color: var(--text-dim);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
}
.ltp-nav-links a:hover,
.ltp-nav-links a.active {
    background: rgba(59,130,246,0.12);
    color: var(--primary);
}

.ltp-nav-user {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--text-dim);
}
.ltp-nav-avatar {
    width: 32px; height: 32px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 700; color: var(--primary);
}
.ltp-nav-logout {
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 7px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 12px;
    transition: all 0.2s;
}
.ltp-nav-logout:hover { border-color: var(--danger); color: var(--danger); }

/* === MAIN CONTENT === */
#ltp-main {
    flex: 1;
    padding: 32px;
    max-width: 1300px;
    width: 100%;
    margin: 0 auto;
}

/* === PAGE TITLE === */
.ltp-page-header {
    margin-bottom: 32px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 16px;
}
.ltp-page-title {
    font-family: 'Syne', sans-serif;
    font-size: 32px;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.03em;
    line-height: 1.1;
}
.ltp-page-title span { color: var(--primary); }
.ltp-page-subtitle {
    font-size: 14px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* === CARDS === */
.ltp-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}
.ltp-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(59,130,246,0.4), transparent);
}

/* === STAT CARDS === */
.ltp-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 28px;
}
.ltp-stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: default;
}
.ltp-stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--glow), var(--shadow);
}
.ltp-stat-card::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 3px;
    background: var(--primary-g);
    opacity: 0;
    transition: opacity 0.2s;
}
.ltp-stat-card:hover::after { opacity: 1; }

.ltp-stat-card.accent-green::after { background: linear-gradient(90deg, var(--accent), #059669); }
.ltp-stat-card.accent-warn::after  { background: linear-gradient(90deg, var(--warn), #d97706); }
.ltp-stat-card.accent-danger::after { background: linear-gradient(90deg, var(--danger), #dc2626); }

.ltp-stat-icon {
    width: 42px; height: 42px;
    border-radius: 11px;
    background: rgba(59,130,246,0.12);
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
    margin-bottom: 14px;
    border: 1px solid rgba(59,130,246,0.2);
}
.ltp-stat-card.accent-green .ltp-stat-icon { background: rgba(6,214,160,0.12); border-color: rgba(6,214,160,0.2); }
.ltp-stat-card.accent-warn  .ltp-stat-icon { background: rgba(245,158,11,0.12); border-color: rgba(245,158,11,0.2); }
.ltp-stat-card.accent-danger .ltp-stat-icon { background: rgba(239,68,68,0.12); border-color: rgba(239,68,68,0.2); }

.ltp-stat-value {
    font-family: 'Syne', sans-serif;
    font-size: 30px;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.03em;
    line-height: 1;
    margin-bottom: 4px;
}
.ltp-stat-label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.ltp-stat-trend {
    position: absolute;
    top: 20px; right: 18px;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 20px;
}
.ltp-stat-trend.up   { background: rgba(6,214,160,0.12); color: var(--accent); }
.ltp-stat-trend.down { background: rgba(239,68,68,0.12); color: var(--danger); }

/* === FILTERS BAR === */
.ltp-filters-bar {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.ltp-filter-pill {
    display: flex;
    align-items: center;
    gap: 6px;
}
.ltp-filter-pill label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    white-space: nowrap;
}
.ltp-filter-pill input[type="date"],
.ltp-filter-pill select {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    padding: 8px 12px;
    font-size: 13px;
    font-family: 'DM Sans', sans-serif;
    outline: none;
    transition: border-color 0.2s;
}
.ltp-filter-pill input:focus,
.ltp-filter-pill select:focus { border-color: var(--primary); }

.ltp-filter-divider { width: 1px; height: 24px; background: var(--border); }

/* === BUTTONS === */
.ltp-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 18px;
    border-radius: 9px;
    font-size: 13px;
    font-weight: 600;
    font-family: 'DM Sans', sans-serif;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    text-decoration: none;
    white-space: nowrap;
}
.ltp-btn-primary {
    background: var(--primary-g);
    color: white;
    box-shadow: 0 4px 14px rgba(59,130,246,0.35);
}
.ltp-btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(59,130,246,0.5); }
.ltp-btn-ghost {
    background: rgba(255,255,255,0.05);
    color: var(--text-dim);
    border: 1px solid var(--border);
}
.ltp-btn-ghost:hover { background: rgba(59,130,246,0.1); color: var(--primary); border-color: rgba(59,130,246,0.3); }
.ltp-btn-accent {
    background: linear-gradient(135deg, var(--accent), #059669);
    color: white;
    box-shadow: 0 4px 14px rgba(6,214,160,0.3);
}
.ltp-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* === FORM === */
.ltp-form-group { margin-bottom: 20px; }
.ltp-form-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.07em;
    margin-bottom: 8px;
}
.ltp-form-label .req { color: var(--primary); }
.ltp-input, .ltp-select, .ltp-textarea {
    width: 100%;
    background: var(--bg2);
    border: 1.5px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    padding: 13px 15px;
    font-size: 15px;
    font-family: 'DM Sans', sans-serif;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    -webkit-appearance: none;
}
.ltp-input:focus, .ltp-select:focus, .ltp-textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}
.ltp-input::placeholder { color: var(--text-muted); }
.ltp-textarea { resize: vertical; min-height: 80px; }
.ltp-select-wrap { position: relative; }
.ltp-select-wrap::after {
    content: '▾';
    position: absolute; right: 14px; top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted); pointer-events: none; font-size: 12px;
}

/* Status buttons */
.ltp-status-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.ltp-status-opt {
    padding: 12px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    background: var(--bg2);
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    transition: all 0.15s;
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'DM Sans', sans-serif;
}
.ltp-status-opt:hover { border-color: var(--primary); color: var(--text); }
.ltp-status-opt.sel   { border-color: var(--primary); background: rgba(59,130,246,0.1); color: var(--primary); }
.ltp-status-opt[data-status="fechou"].sel   { border-color: var(--accent); background: rgba(6,214,160,0.1); color: var(--accent); }
.ltp-status-opt[data-status="perdeu"].sel   { border-color: var(--danger); background: rgba(239,68,68,0.1); color: var(--danger); }
.ltp-status-opt[data-status="em_atendimento"].sel { border-color: var(--warn); background: rgba(245,158,11,0.1); color: var(--warn); }

/* === ALERTS === */
.ltp-alert {
    padding: 14px 18px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: ltp-slide-in 0.3s ease;
}
@keyframes ltp-slide-in { from { opacity:0; transform: translateY(-8px); } to { opacity:1; transform: translateY(0); } }
.ltp-alert-ok   { background: rgba(6,214,160,0.1);  border: 1px solid rgba(6,214,160,0.25);  color: var(--accent); }
.ltp-alert-err  { background: rgba(239,68,68,0.1);  border: 1px solid rgba(239,68,68,0.25);  color: var(--danger); }
.ltp-alert-warn { background: rgba(245,158,11,0.1); border: 1px solid rgba(245,158,11,0.25); color: var(--warn); }

/* === TABLE === */
.ltp-table-wrap { overflow-x: auto; }
.ltp-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.ltp-table th {
    text-align: left;
    padding: 10px 14px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.ltp-table td {
    padding: 13px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    color: var(--text-dim);
    vertical-align: middle;
}
.ltp-table tr:hover td { background: rgba(255,255,255,0.02); }
.ltp-table tr:last-child td { border-bottom: none; }

/* Badges */
.ltp-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
}
.ltp-badge-blue   { background: rgba(59,130,246,0.15); color: #60a5fa; }
.ltp-badge-green  { background: rgba(6,214,160,0.15);  color: var(--accent); }
.ltp-badge-yellow { background: rgba(245,158,11,0.15); color: var(--warn); }
.ltp-badge-red    { background: rgba(239,68,68,0.15);  color: #f87171; }

/* Select status inline */
.ltp-status-sel {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 7px;
    color: var(--text-dim);
    padding: 5px 10px;
    font-size: 12px;
    font-family: 'DM Sans', sans-serif;
    outline: none;
    cursor: pointer;
}

/* === LOADING === */
.ltp-loading-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    gap: 16px;
}
.ltp-spinner {
    width: 44px; height: 44px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: ltp-spin 0.7s linear infinite;
}
@keyframes ltp-spin { to { transform: rotate(360deg); } }
.ltp-loading-text { color: var(--text-muted); font-size: 14px; }

/* === CHARTS AREA === */
.ltp-charts-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}
.ltp-chart-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    position: relative;
    overflow: hidden;
}
.ltp-chart-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(59,130,246,0.4), transparent);
}
.ltp-chart-title {
    font-family: 'Syne', sans-serif;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 16px;
}
.ltp-chart-container { position: relative; height: 200px; }

/* === AD CARDS === */
.ltp-ads-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.ltp-ad-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}
.ltp-ad-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(59,130,246,0.3), transparent);
}
.ltp-ad-card:hover {
    border-color: rgba(59,130,246,0.3);
    transform: translateY(-2px);
    box-shadow: var(--glow);
}
.ltp-ad-card-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 18px;
    gap: 8px;
}
.ltp-ad-name {
    font-family: 'Syne', sans-serif;
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 3px;
}
.ltp-ad-product {
    font-size: 11px;
    color: var(--text-muted);
    background: var(--bg2);
    padding: 2px 8px;
    border-radius: 20px;
    display: inline-block;
}
.ltp-meta-tag {
    font-size: 10px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 20px;
    white-space: nowrap;
}
.ltp-meta-tag.on  { background: rgba(6,214,160,0.12);  color: var(--accent); border: 1px solid rgba(6,214,160,0.2); }
.ltp-meta-tag.off { background: rgba(245,158,11,0.12); color: var(--warn);   border: 1px solid rgba(245,158,11,0.2); }

.ltp-ad-metrics {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}
.ltp-metric {
    text-align: center;
    padding: 10px 6px;
    background: var(--bg2);
    border-radius: 10px;
    border: 1px solid var(--border);
}
.ltp-metric-ico { font-size: 15px; margin-bottom: 4px; display: block; }
.ltp-metric-val {
    font-family: 'Syne', sans-serif;
    font-size: 16px;
    font-weight: 800;
    color: var(--text);
    display: block;
}
.ltp-metric-lbl {
    font-size: 9px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: block;
    margin-top: 1px;
}
.ltp-metric.hi { background: rgba(59,130,246,0.08); border-color: rgba(59,130,246,0.15); }
.ltp-metric.hi .ltp-metric-val { color: var(--primary); }

.ltp-ad-footer {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 10px;
}
.ltp-ad-footer strong { color: var(--text-dim); }

/* Stackbar */
.ltp-stackbar {
    height: 5px;
    border-radius: 99px;
    background: var(--bg2);
    display: flex;
    overflow: hidden;
    gap: 2px;
}
.ltp-bar-seg { height: 100%; border-radius: 99px; transition: width 0.8s ease; }
.ltp-bar-seg.b { background: var(--primary); }
.ltp-bar-seg.y { background: var(--warn); }
.ltp-bar-seg.g { background: var(--accent); }
.ltp-bar-seg.r { background: var(--danger); }

/* WA link */
.ltp-wa { color: #4ade80; text-decoration: none; font-weight: 500; font-size: 12px; }
.ltp-wa:hover { text-decoration: underline; }

/* Recent leads list */
.ltp-recent-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    animation: ltp-slide-in 0.3s ease;
}
.ltp-recent-item:last-child { border-bottom: none; }
.ltp-recent-name { font-weight: 600; font-size: 14px; color: var(--text); }
.ltp-recent-phone { font-size: 12px; color: var(--text-muted); }
.ltp-recent-tag { font-size: 10px; color: var(--primary); background: rgba(59,130,246,0.1); padding: 2px 8px; border-radius: 20px; }
.ltp-recent-time { font-size: 11px; color: var(--text-muted); }

/* Login page */
.ltp-login-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}
.ltp-login-box {
    width: 100%;
    max-width: 380px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 40px 36px;
    box-shadow: var(--shadow), 0 0 80px rgba(59,130,246,0.08);
}
.ltp-login-logo {
    text-align: center;
    margin-bottom: 32px;
}
.ltp-login-logo-icon {
    width: 56px; height: 56px;
    background: var(--primary-g);
    border-radius: 16px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 26px;
    margin-bottom: 12px;
    box-shadow: 0 0 30px rgba(59,130,246,0.4);
}
.ltp-login-logo h1 {
    font-family: 'Syne', sans-serif;
    font-size: 22px;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.02em;
}
.ltp-login-logo p { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

/* === WP login override === */
body.login { background: var(--bg) !important; }
body.login #login { padding: 0; }
body.login #loginform, body.login #lostpasswordform {
    background: var(--surface) !important;
    border: 1px solid var(--border) !important;
    border-radius: 16px !important;
    box-shadow: var(--shadow) !important;
}
body.login input[type="text"],
body.login input[type="password"] {
    background: var(--bg2) !important;
    border: 1.5px solid var(--border) !important;
    color: var(--text) !important;
    border-radius: 8px !important;
}
body.login .button-primary {
    background: #3b82f6 !important;
    border-color: #3b82f6 !important;
    border-radius: 8px !important;
    box-shadow: 0 4px 14px rgba(59,130,246,0.35) !important;
}
body.login #nav a, body.login #backtoblog a { color: var(--text-muted) !important; }
body.login h1 a { background-size: contain !important; }

/* === EMPTY STATE === */
.ltp-empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}
.ltp-empty-state .ico { font-size: 48px; margin-bottom: 12px; opacity: 0.5; }
.ltp-empty-state p { font-size: 14px; margin-top: 6px; }

/* === RESPONSIVE === */
@media (max-width: 900px) {
    .ltp-stats-grid { grid-template-columns: 1fr 1fr; }
    .ltp-charts-row { grid-template-columns: 1fr; }
    #ltp-main { padding: 16px; }
    #ltp-nav { padding: 0 16px; }
    .ltp-nav-links { display: none; }
}
@media (max-width: 600px) {
    .ltp-stats-grid { grid-template-columns: 1fr 1fr; }
    .ltp-ads-row { grid-template-columns: 1fr; }
    .ltp-ad-metrics { grid-template-columns: repeat(2, 1fr); }
}
