/* ==========================================
   LeadGenerator — Design System
   Tema: Dark Premium com Glassmorphism
   ========================================== */

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

/* === CSS Variables === */
:root {
    --bg-primary: #0a0a12;
    --bg-secondary: #12121e;
    --bg-card: rgba(20, 20, 35, 0.7);
    --bg-glass: rgba(255, 255, 255, 0.03);
    --bg-glass-hover: rgba(255, 255, 255, 0.06);
    --bg-input: rgba(255, 255, 255, 0.05);
    --bg-input-focus: rgba(255, 255, 255, 0.08);

    --text-primary: #f0f0f5;
    --text-secondary: #9090a8;
    --text-muted: #5a5a72;
    --text-accent: #a78bfa;

    --accent-primary: #7c3aed;
    --accent-secondary: #06b6d4;
    --accent-gradient: linear-gradient(135deg, #7c3aed 0%, #06b6d4 100%);
    --accent-gradient-hover: linear-gradient(135deg, #8b5cf6 0%, #22d3ee 100%);
    --accent-glow: rgba(124, 58, 237, 0.3);
    --accent-cyan-glow: rgba(6, 182, 212, 0.2);

    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.1);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.1);
    --error: #ef4444;
    --error-bg: rgba(239, 68, 68, 0.1);

    --border-color: rgba(255, 255, 255, 0.06);
    --border-focus: rgba(124, 58, 237, 0.5);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 30px var(--accent-glow);

    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
}

/* === Background Effects === */
body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 20% 20%, rgba(124, 58, 237, 0.06) 0%, transparent 50%),
                radial-gradient(circle at 80% 80%, rgba(6, 182, 212, 0.04) 0%, transparent 50%),
                radial-gradient(circle at 50% 50%, rgba(124, 58, 237, 0.02) 0%, transparent 70%);
    z-index: -1;
    animation: bgPulse 20s ease-in-out infinite alternate;
}

@keyframes bgPulse {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(-2%, -2%) scale(1.05); }
}

/* === Layout === */
.app-container {
    max-width: 1300px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

/* === Header === */
.header {
    text-align: center;
    margin-bottom: 3rem;
    position: relative;
}

.header__logo {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.header__icon {
    width: 48px;
    height: 48px;
    background: var(--accent-gradient);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: var(--shadow-glow);
    animation: iconFloat 3s ease-in-out infinite;
}

@keyframes iconFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

.header__title {
    font-size: 2.5rem;
    font-weight: 800;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.02em;
}

.header__subtitle {
    font-size: 1.05rem;
    color: var(--text-secondary);
    font-weight: 400;
    max-width: 600px;
    margin: 0 auto;
}

/* === Search Card === */
.search-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-md);
    transition: border-color var(--transition-base);
}

.search-card:hover {
    border-color: rgba(124, 58, 237, 0.15);
}

.search-form {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
    flex-wrap: wrap;
}

.form-group {
    flex: 1;
    min-width: 200px;
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.5rem;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.85rem 1.15rem;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    transition: all var(--transition-base);
    outline: none;
}

.form-group select {
    cursor: pointer;
    background: #1a1a2e;
}

.form-group select option {
    background: #121224;
    color: var(--text-primary);
    padding: 0.5rem;
}

.form-group input::placeholder {
    color: var(--text-muted);
}

.form-group input:focus,
.form-group select:focus {
    background: var(--bg-input-focus);
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

.warning-message {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(6, 182, 212, 0.1);
    border: 1px solid rgba(6, 182, 212, 0.3);
    color: #38bdf8;
    padding: 0.85rem 1.25rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

/* === Buttons === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.85rem 1.75rem;
    border: none;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}

.btn--primary {
    background: var(--accent-gradient);
    color: white;
    box-shadow: var(--shadow-glow);
}

.btn--primary:hover {
    background: var(--accent-gradient-hover);
    box-shadow: 0 0 40px var(--accent-glow);
    transform: translateY(-1px);
}

.btn--primary:active {
    transform: translateY(0);
}

.btn--secondary {
    background: var(--bg-glass);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn--secondary:hover {
    background: var(--bg-glass-hover);
    border-color: rgba(124, 58, 237, 0.3);
}

.btn--success {
    background: linear-gradient(135deg, #059669, #10b981);
    color: white;
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.2);
}

.btn--success:hover {
    box-shadow: 0 0 30px rgba(16, 185, 129, 0.3);
    transform: translateY(-1px);
}

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

.btn .btn-icon {
    font-size: 1.1rem;
}

/* === Stats Bar === */
.stats-bar {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    opacity: 0;
    transform: translateY(10px);
    transition: all var(--transition-slow);
}

.stats-bar.visible {
    opacity: 1;
    transform: translateY(0);
}

.stat-card {
    flex: 1;
    min-width: 160px;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all var(--transition-base);
}

.stat-card:hover {
    border-color: rgba(124, 58, 237, 0.2);
    transform: translateY(-2px);
}

.stat-card__icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.stat-card__icon--purple {
    background: rgba(124, 58, 237, 0.15);
}

.stat-card__icon--cyan {
    background: rgba(6, 182, 212, 0.15);
}

.stat-card__icon--green {
    background: rgba(16, 185, 129, 0.15);
}

.stat-card__info {
    display: flex;
    flex-direction: column;
}

.stat-card__value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.stat-card__label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* === Actions Bar === */
.actions-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 0.75rem;
    opacity: 0;
    transform: translateY(10px);
    transition: all var(--transition-slow);
}

.actions-bar.visible {
    opacity: 1;
    transform: translateY(0);
}

.actions-bar__left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.actions-bar__right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.selection-info {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.selection-info strong {
    color: var(--text-accent);
}

/* === Table === */
.table-container {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    opacity: 0;
    transform: translateY(10px);
    transition: all var(--transition-slow);
}

.table-container.visible {
    opacity: 1;
    transform: translateY(0);
}

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

.leads-table thead {
    background: rgba(124, 58, 237, 0.08);
    border-bottom: 1px solid var(--border-color);
}

.leads-table th {
    padding: 1rem 1.25rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    white-space: nowrap;
}

.leads-table th:first-child {
    padding-left: 1.5rem;
    width: 48px;
}

.leads-table td {
    padding: 1rem 1.25rem;
    font-size: 0.9rem;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.leads-table td:first-child {
    padding-left: 1.5rem;
}

.leads-table tbody tr {
    transition: background var(--transition-fast);
}

.leads-table tbody tr:hover {
    background: var(--bg-glass-hover);
}

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

.leads-table tbody tr.selected {
    background: rgba(124, 58, 237, 0.06);
}

/* === Table Cell Styles === */
.lead-name {
    font-weight: 600;
    color: var(--text-primary);
}

.lead-address {
    color: var(--text-secondary);
    font-size: 0.85rem;
    max-width: 280px;
}

.lead-phone {
    font-family: 'Inter', monospace;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
}

.lead-phone--empty {
    color: var(--text-muted);
    font-style: italic;
}

.lead-rating {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.lead-rating__stars {
    color: #fbbf24;
    font-size: 0.85rem;
}

.lead-rating__value {
    font-weight: 600;
    font-size: 0.85rem;
}

.lead-rating__count {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.lead-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.category-tag {
    background: rgba(124, 58, 237, 0.1);
    color: var(--text-accent);
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-full);
    font-size: 0.7rem;
    font-weight: 500;
    white-space: nowrap;
}

.badge-no-site {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: var(--warning-bg);
    color: var(--warning);
    padding: 0.25rem 0.65rem;
    border-radius: var(--radius-full);
    font-size: 0.7rem;
    font-weight: 600;
    white-space: nowrap;
}

.maps-link {
    color: var(--accent-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    transition: color var(--transition-fast);
}

.maps-link:hover {
    color: #22d3ee;
}

/* === Checkbox Custom === */
.custom-checkbox {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.custom-checkbox input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.custom-checkbox .checkmark {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    background: var(--bg-glass);
}

.custom-checkbox input:checked + .checkmark {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    box-shadow: 0 0 10px rgba(124, 58, 237, 0.3);
}

.custom-checkbox .checkmark::after {
    content: '';
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) scale(0);
    transition: transform var(--transition-fast);
}

.custom-checkbox input:checked + .checkmark::after {
    transform: rotate(45deg) scale(1);
}

.custom-checkbox:hover .checkmark {
    border-color: var(--accent-primary);
}

/* === Loading State === */
.loading-overlay {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    gap: 1.5rem;
}

.loading-overlay.active {
    display: flex;
}

.spinner {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-primary);
    animation: spin 0.8s linear infinite;
}

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

.loading-text {
    color: var(--text-secondary);
    font-size: 0.95rem;
    animation: pulse 1.5s ease-in-out infinite;
}

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

/* === Empty State === */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    text-align: center;
}

.empty-state__icon {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    opacity: 0.6;
}

.empty-state__title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.empty-state__desc {
    color: var(--text-secondary);
    font-size: 0.9rem;
    max-width: 400px;
}

/* === Error State === */
.error-message {
    display: none;
    background: var(--error-bg);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: var(--radius-md);
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--error);
    font-size: 0.9rem;
    align-items: center;
    gap: 0.75rem;
    animation: slideDown 0.3s ease-out;
}

.error-message.visible {
    display: flex;
}

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

/* === Toast Notification === */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    transform: translateY(100px);
    opacity: 0;
    transition: all var(--transition-slow);
}

.toast.visible {
    transform: translateY(0);
    opacity: 1;
}

.toast--success {
    border-color: rgba(16, 185, 129, 0.3);
}

.toast__text {
    font-size: 0.9rem;
    color: var(--text-primary);
}

/* === Load More Button === */
.load-more-container {
    display: none;
    justify-content: center;
    padding: 1.5rem;
}

.load-more-container.visible {
    display: flex;
}

/* === Footer === */
.footer {
    text-align: center;
    padding: 2rem 0;
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* === Responsive === */
@media (max-width: 768px) {
    .app-container {
        padding: 1rem;
    }

    .header__title {
        font-size: 1.75rem;
    }

    .header__subtitle {
        font-size: 0.9rem;
    }

    .search-form {
        flex-direction: column;
    }

    .form-group {
        min-width: 100%;
    }

    .btn {
        width: 100%;
    }

    .stat-card {
        min-width: 100%;
    }

    .leads-table {
        font-size: 0.8rem;
    }

    .leads-table th,
    .leads-table td {
        padding: 0.75rem;
    }

    .table-container {
        overflow-x: auto;
    }

    .lead-address {
        max-width: 160px;
    }
}

@media (max-width: 480px) {
    .header__title {
        font-size: 1.4rem;
    }

    .actions-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .actions-bar__left,
    .actions-bar__right {
        justify-content: center;
    }
}
