/* ================================
   Lead Scrapper - Premium Dark UI
   ================================ */

:root {
    /* Color Palette */
    --primary: #6366f1;
    --primary-light: #818cf8;
    --primary-dark: #4f46e5;
    --secondary: #10b981;
    --accent: #f59e0b;
    --danger: #ef4444;

    /* Dark Theme Colors */
    --bg-dark: #0a0a0f;
    --bg-card: rgba(17, 17, 27, 0.8);
    --bg-elevated: rgba(30, 30, 45, 0.9);
    --border-color: rgba(99, 102, 241, 0.2);
    --border-hover: rgba(99, 102, 241, 0.4);

    /* Text Colors */
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);
    --gradient-secondary: linear-gradient(135deg, #10b981 0%, #14b8a6 100%);
    --gradient-bg: linear-gradient(180deg, #0a0a0f 0%, #0f0f1a 50%, #1a1a2e 100%);

    /* Shadows */
    --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 40px rgba(99, 102, 241, 0.3);

    /* Sizing */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* Reset & Base */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
}

/* Animated Background */
.bg-gradient {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--gradient-bg);
    z-index: -2;
}

.bg-grid {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        linear-gradient(rgba(99, 102, 241, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(99, 102, 241, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    z-index: -1;
    animation: gridMove 20s linear infinite;
}

@keyframes gridMove {
    0% {
        transform: translate(0, 0);
    }

    100% {
        transform: translate(50px, 50px);
    }
}

/* Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
    position: relative;
}

/* Glass Effect */
.glass {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
}

/* ================================
   Header
   ================================ */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    margin-bottom: 32px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 48px;
    height: 48px;
    background: var(--gradient-primary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-glow);
}

.logo-icon svg {
    width: 28px;
    height: 28px;
    color: white;
}

.logo h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.logo h1 span {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-stats {
    display: flex;
    gap: 24px;
}

.stat {
    text-align: right;
}

.stat-value {
    display: block;
    font-size: 24px;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ================================
   Search Section
   ================================ */
.search-section {
    margin-bottom: 32px;
}

.search-card {
    padding: 32px;
}

.search-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
}

.search-subtitle {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.search-form {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-group label svg {
    width: 16px;
    height: 16px;
    color: var(--primary-light);
}

.form-group input {
    padding: 14px 18px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 16px;
    font-family: inherit;
    transition: all var(--transition-fast);
}

.form-group input::placeholder {
    color: var(--text-muted);
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.form-actions {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

/* ================================
   Buttons
   ================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
}

.btn svg {
    width: 18px;
    height: 18px;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: var(--shadow-md), 0 0 20px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), 0 0 30px rgba(99, 102, 241, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    border-color: var(--border-hover);
    background: rgba(99, 102, 241, 0.1);
}

.btn-export {
    background: var(--gradient-secondary);
    color: white;
}

.btn-export:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.4);
}

.btn-clear {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-clear:hover {
    color: var(--danger);
    border-color: var(--danger);
}

.btn-email {
    background: linear-gradient(135deg, #f59e0b 0%, #f97316 100%);
    color: white;
}

.btn-email:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.4);
}

.btn-email.extracted {
    background: var(--gradient-secondary);
}

.btn-page {
    background: var(--bg-elevated);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    padding: 10px 16px;
    font-size: 14px;
}

.btn-page:hover:not(:disabled) {
    color: var(--text-primary);
    border-color: var(--border-hover);
}

.btn-page:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* ================================
   Loading State
   ================================ */
.loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 10, 15, 0.9);
    backdrop-filter: blur(8px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.loading-overlay.active {
    display: flex;
}

.loading-content {
    text-align: center;
    padding: 48px 64px;
}

.spinner {
    width: 56px;
    height: 56px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    margin: 0 auto 24px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-content h3 {
    font-size: 20px;
    margin-bottom: 8px;
}

.loading-content p {
    color: var(--text-secondary);
}

/* ================================
   Results Section
   ================================ */
.results-section {
    margin-bottom: 32px;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 16px;
}

.results-info h2 {
    font-size: 22px;
    font-weight: 700;
}

.results-info h2 span {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.results-info p {
    color: var(--text-muted);
    font-size: 14px;
}

.results-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* ================================
   Filter Panel
   ================================ */
.btn-filter {
    background: linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%);
    color: white;
}

.btn-filter:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.4);
}

.btn-filter.active {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.5);
}

.filter-panel {
    padding: 24px;
    margin-bottom: 20px;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.filter-header h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 600;
}

.filter-header h3 svg {
    width: 20px;
    height: 20px;
    color: var(--primary-light);
}

.btn-reset {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-reset:hover {
    border-color: var(--danger);
    color: var(--danger);
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.filter-group label svg {
    width: 16px;
    height: 16px;
    color: var(--primary-light);
}

.filter-group select {
    padding: 10px 14px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-fast);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px;
    padding-right: 36px;
}

.filter-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.filter-group select option {
    background: var(--bg-dark);
    color: var(--text-primary);
}

.rating-slider {
    display: flex;
    align-items: center;
    gap: 12px;
}

.rating-slider input[type="range"] {
    flex: 1;
    height: 6px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 3px;
    appearance: none;
    cursor: pointer;
}

.rating-slider input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 18px;
    height: 18px;
    background: var(--gradient-primary);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(99, 102, 241, 0.4);
    transition: transform 0.15s ease;
}

.rating-slider input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.rating-slider span {
    min-width: 40px;
    padding: 4px 8px;
    background: rgba(99, 102, 241, 0.2);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    color: var(--primary-light);
    text-align: center;
}

.filter-summary {
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.filter-count {
    font-size: 14px;
    color: var(--text-secondary);
}

.filter-count strong {
    color: var(--primary-light);
}

.filtered-count {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-left: 8px;
}

.filtered-count::before {
    content: "(";
}

.filtered-count::after {
    content: ")";
}

.filtered-count:empty {
    display: none;
}

.filtered-count:empty::before,
.filtered-count:empty::after {
    content: none;
}

/* ================================
   Table
   ================================ */
.table-container {
    overflow-x: auto;
    padding: 4px;
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.results-table th,
.results-table td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.results-table th {
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.5px;
    background: rgba(0, 0, 0, 0.2);
    position: sticky;
    top: 0;
}

.results-table tbody tr {
    transition: background var(--transition-fast);
}

.results-table tbody tr:hover {
    background: rgba(99, 102, 241, 0.05);
}

.results-table td {
    color: var(--text-primary);
}

.th-checkbox {
    width: 48px;
}

.results-table input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary);
}

.business-name {
    font-weight: 600;
    color: var(--text-primary);
}

.business-address {
    color: var(--text-secondary);
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.business-email {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.business-email .email-link {
    color: #f59e0b;
    text-decoration: none;
    font-weight: 500;
}

.business-email .email-link:hover {
    text-decoration: underline;
    color: #fbbf24;
}

.business-email .no-email {
    color: var(--text-muted);
}

.business-phone {
    font-family: monospace;
    color: var(--primary-light);
}

.business-website {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.business-website a {
    color: var(--secondary);
    text-decoration: none;
}

.business-website a:hover {
    text-decoration: underline;
}

.rating {
    display: flex;
    align-items: center;
    gap: 6px;
}

.rating-stars {
    color: var(--accent);
    font-size: 12px;
}

.rating-value {
    font-weight: 600;
}

.rating-count {
    color: var(--text-muted);
    font-size: 12px;
}

.actions-cell {
    display: flex;
    gap: 8px;
}

.btn-action {
    padding: 8px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-action:hover {
    color: var(--primary);
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
}

.btn-action svg {
    width: 16px;
    height: 16px;
}

/* ================================
   Pagination
   ================================ */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin-top: 24px;
}

.page-info {
    color: var(--text-secondary);
    font-size: 14px;
}

.page-info span {
    color: var(--text-primary);
    font-weight: 600;
}

/* ================================
   Empty State
   ================================ */
.empty-state {
    text-align: center;
    padding: 80px 24px;
}

.empty-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 24px;
    background: var(--bg-elevated);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.empty-icon svg {
    width: 40px;
    height: 40px;
    color: var(--text-muted);
}

.empty-content h3 {
    font-size: 24px;
    margin-bottom: 8px;
}

.empty-content>p {
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.quick-searches {
    display: inline-block;
}

.quick-searches>p {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 12px;
}

.quick-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.quick-tag {
    padding: 10px 16px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: 50px;
    color: var(--text-secondary);
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.quick-tag:hover {
    color: var(--text-primary);
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
    transform: translateY(-2px);
}

/* ================================
   Modals & Auth
   ================================ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--bg-card);
    padding: 32px;
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 480px;
    border: 1px solid var(--border-color);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    transform: translateY(20px);
    transition: all 0.3s ease;
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.modal-header h2 {
    margin: 0;
    font-size: 24px;
}

.btn-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.btn-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 24px;
}

.btn-settings {
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-settings:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
}

.btn-settings svg {
    width: 16px;
    height: 16px;
}

/* Form Styles */
.form-group small {
    display: block;
    margin-top: 6px;
    color: var(--text-muted);
    font-size: 12px;
}

.full-width {
    width: 100%;
    justify-content: center;
    margin-top: 16px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .header-right {
        gap: 16px;
    }

    .btn-settings span {
        display: none;
    }

    .btn-settings {
        padding: 8px;
    }
}

.footer {
    text-align: center;
    padding: 32px 0;
    color: var(--text-muted);
    font-size: 13px;
    border-top: 1px solid var(--border-color);
    margin-top: 48px;
}

.footer p {
    margin-bottom: 4px;
}

.disclaimer {
    font-size: 12px;
    opacity: 0.7;
}

/* ================================
   Toast Notifications
   ================================ */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease;
    max-width: 400px;
}

.toast.success {
    border-color: var(--secondary);
}

.toast.error {
    border-color: var(--danger);
}

.toast svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.toast.success svg {
    color: var(--secondary);
}

.toast.error svg {
    color: var(--danger);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }

    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* ================================
   Responsive
   ================================ */
@media (max-width: 1024px) {
    .container {
        padding: 16px;
    }

    .header {
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }

    .header-stats {
        justify-content: center;
    }

    .search-card {
        padding: 24px;
    }

    .results-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 768px) {
    .logo h1 {
        font-size: 22px;
    }

    .search-title {
        font-size: 20px;
    }

    .form-actions {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .results-actions {
        width: 100%;
    }

    .results-actions .btn {
        flex: 1;
    }

    .results-table {
        font-size: 13px;
    }

    .results-table th,
    .results-table td {
        padding: 10px 12px;
    }
}

/* ================================
   Scrollbar
   ================================ */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-hover);
}

/* ================================
   Selection
   ================================ */
::selection {
    background: rgba(99, 102, 241, 0.3);
    color: white;
}