/* ===== CSS Variables & Reset ===== */
:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary: #64748b;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;

    --bg-dark: #0f172a;
    --bg-card: rgba(30, 41, 59, 0.8);
    --bg-glass: rgba(255, 255, 255, 0.05);

    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --accent-primary: #6366f1;
    --accent-secondary: #818cf8;

    --border-color: rgba(255, 255, 255, 0.1);
    --shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);

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

    /* DISABLED - was causing GPU crash */
    --transition: none;
}

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

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

/* ===== Background Gradient ===== */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    /* Simplified gradient - removed heavy radial gradients for debugging */
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, transparent 100%);
    pointer-events: none;
    z-index: -1;
}

/* ===== App Container ===== */
.app-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ===== Header ===== */
.header {
    text-align: center;
    margin-bottom: 2rem;
    padding: 2rem 0;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.logo-icon {
    font-size: 2.5rem;
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

.logo h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-light), var(--success));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tagline {
    color: var(--text-secondary);
    font-size: 1.1rem;
    font-weight: 300;
}

/* ===== Cards ===== */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 2rem;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
}

.glass {
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.card h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ===== Input Groups ===== */
.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.input-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.input-group input,
.input-group select {
    padding: 0.875rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 1rem;
    font-family: inherit;
    transition: var(--transition);
}

.input-group input:focus,
.input-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

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

.input-group select option {
    background: var(--bg-dark);
    color: var(--text-primary);
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
}

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

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    /* Removed transform - was causing crash */
    opacity: 0.9;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

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

.btn-success {
    background: linear-gradient(135deg, var(--success), #059669);
    color: white;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
    /* Removed transform - was causing crash */
    opacity: 0.9;
}

.btn-large {
    padding: 1rem 2rem;
    font-size: 1.1rem;
}

/* ===== API Key Section ===== */
.api-key-section {
    max-width: 600px;
    margin: 0 auto;
}

.api-key-section .input-group {
    flex-direction: row;
    gap: 1rem;
}

.api-key-section input {
    flex: 1;
}

.hint {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 1rem;
}

/* ===== Search Section ===== */
.search-section {
    margin-bottom: 2rem;
}

.search-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

/* Filters Section */
.filters-section {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--border-radius);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.filters-row {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}

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

.filter-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Rating Slider */
input[type="range"] {
    width: 100%;
    height: 8px;
    -webkit-appearance: none;
    appearance: none;
    background: linear-gradient(90deg, var(--accent-secondary), var(--accent-primary));
    border-radius: 4px;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--accent-primary);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: var(--accent-primary);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

/* Rating Range — due slider affiancati */
.rating-range {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.rating-range input[type="range"] {
    flex: 1;
}

/* Checkbox Groups */
.checkbox-group {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.checkbox-item {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.checkbox-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.checkbox-item:has(input:checked) {
    background: rgba(99, 102, 241, 0.2);
    border-color: var(--accent-primary);
    color: var(--text-primary);
}

.checkbox-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent-primary);
    cursor: pointer;
}

/* Categories Section */
.categories-section {
    margin-bottom: 1.5rem;
}

.categories-section>label {
    display: block;
    margin-bottom: 0.75rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.category-presets {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.preset-btn {
    padding: 0.4rem 0.75rem !important;
    font-size: 0.8rem !important;
}

.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.5rem;
    max-height: 200px;
    overflow-y: auto;
    padding: 0.75rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--border-radius);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.categories-grid::-webkit-scrollbar {
    width: 6px;
}

.categories-grid::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.categories-grid::-webkit-scrollbar-thumb {
    background: var(--accent-secondary);
    border-radius: 3px;
}

/* Small button variant */
.btn-small {
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
}

.search-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

/* ===== Usage Section ===== */
.usage-section {
    margin-bottom: 1.5rem;
}

.usage-card {
    padding: 1.5rem;
}

.usage-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.usage-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.usage-bars {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.usage-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.usage-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.875rem;
}

.usage-label span:first-child {
    color: var(--text-secondary);
}

.usage-bar {
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.usage-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}

.usage-fill.usage-good {
    background: linear-gradient(90deg, var(--success), #34d399);
}

.usage-fill.usage-warning {
    background: linear-gradient(90deg, var(--warning), #fbbf24);
}

.usage-fill.usage-critical {
    background: linear-gradient(90deg, var(--danger), #f87171);
}

.usage-good {
    color: var(--success);
}

.usage-warning {
    color: var(--warning);
}

.usage-critical {
    color: var(--danger);
}

/* ===== Stats Section ===== */
.stats-section {
    margin-bottom: 2rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-2px);
    border-color: var(--primary);
}

.stat-icon {
    font-size: 2rem;
}

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

.stat-number {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* ===== Results Section ===== */
.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.results-header h2 {
    margin-bottom: 0;
}

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

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

.results-table th,
.results-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.results-table th {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: rgba(255, 255, 255, 0.02);
}

.results-table tbody tr {
    transition: var(--transition);
}

.results-table tbody tr:hover {
    background: rgba(99, 102, 241, 0.1);
}

.results-table td {
    font-size: 0.95rem;
}

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

.rating-star {
    color: var(--warning);
}

.btn-map {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    background: rgba(99, 102, 241, 0.2);
    color: var(--primary-light);
    border: 1px solid var(--primary);
}

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

/* ===== Row Expander (Fase 5) ===== */
.result-row {
    cursor: pointer;
}

.expander-toggle {
    display: inline-block;
    width: 28px;
    height: 28px;
    line-height: 28px;
    text-align: center;
    border-radius: 4px;
    font-size: 0.8rem;
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary-light);
    cursor: pointer;
    user-select: none;
}

.expander-toggle:hover {
    background: rgba(99, 102, 241, 0.3);
}

.expander-row {
    background: rgba(15, 23, 42, 0.5);
}

.expander-row:hover {
    background: rgba(15, 23, 42, 0.5) !important;
}

.expander-content {
    padding: 1rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.gbp-data {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.gbp-info-row,
.gbp-attr-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.gbp-tag {
    padding: 0.25rem 0.6rem;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 6px;
    color: var(--text-secondary);
}

.gbp-summary {
    font-style: italic;
    max-width: 400px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gbp-attr-no {
    opacity: 0.5;
}

.gbp-sep {
    color: var(--text-secondary);
    opacity: 0.4;
}

.gbp-hours-detail {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.gbp-hours-detail summary {
    cursor: pointer;
    color: var(--primary-light);
    font-size: 0.8rem;
}

.gbp-hour-line {
    padding: 0.15rem 0;
}

.gbp-empty {
    font-size: 0.8rem;
    color: var(--text-secondary);
    opacity: 0.6;
    font-style: italic;
}

.expander-actions {
    display: flex;
    gap: 0.5rem;
    padding-top: 0.25rem;
}

.btn-link {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.btn-link:hover {
    background: rgba(16, 185, 129, 0.4);
}

.btn-analyze {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    background: rgba(251, 191, 36, 0.2);
    color: var(--warning);
    border: 1px solid rgba(251, 191, 36, 0.3);
    cursor: pointer;
}

.btn-analyze:hover {
    background: rgba(251, 191, 36, 0.4);
}

/* ===== Card GBP nel report Analyzer (Fase 5B) ===== */
.gbp-card-content {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.gbp-card-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
    padding: 0.4rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.gbp-card-row:last-child {
    border-bottom: none;
}

.gbp-card-label {
    min-width: 100px;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    flex-shrink: 0;
}

.gbp-card-muted {
    opacity: 0.5;
}

.gbp-nap-section {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.gbp-nap-title {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.gbp-nap-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.85rem;
    padding: 0.35rem 0;
}

.gbp-nap-field {
    min-width: 80px;
    font-weight: 600;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.gbp-nap-values {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    flex: 1;
}

.gbp-nap-src {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ===== Score Badge (Fase 5A) ===== */
.score-badge {
    font-weight: 700;
    font-size: 1rem;
}

.score-badge.score-empty {
    color: var(--text-muted);
    opacity: 0.4;
    font-weight: 400;
}

.score-max {
    font-size: 0.7rem;
    font-weight: 400;
    opacity: 0.6;
}

/* ===== Analysis Recap nell'expander (Fase 5A) ===== */
.analysis-recap {
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.recap-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
}

.recap-areas {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.recap-area {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    font-size: 0.8rem;
    padding: 0.25rem 0.5rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.recap-area-label {
    color: var(--text-secondary);
    font-size: 0.7rem;
    margin-right: 0.15rem;
}

.recap-issues-count {
    display: flex;
    gap: 1rem;
    font-size: 0.8rem;
}

.recap-top-issues {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.recap-issue-line {
    font-size: 0.8rem;
    color: var(--text-secondary);
    padding: 0.2rem 0;
}

/* ===== Lead Score Badge (Fase 7B) ===== */
.lead-badge {
    display: block;
    font-size: 0.6rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--primary-light);
    margin-top: 2px;
    text-align: center;
}

/* ===== Lead Score Recap nell'expander (Fase 7B) ===== */
.lead-recap {
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.lead-breakdown-grid {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.lead-signal-row {
    display: grid;
    grid-template-columns: 80px 1fr 2fr 50px;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
}

.lead-signal-name {
    color: var(--text-secondary);
    font-weight: 500;
}

.lead-signal-detail {
    color: var(--text-muted);
    font-size: 0.75rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lead-signal-bar-bg {
    height: 6px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
    overflow: hidden;
}

.lead-signal-bar {
    height: 100%;
    border-radius: 3px;
    min-width: 2px;
}

.lead-signal-pts {
    text-align: right;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

.lead-action {
    font-size: 0.8rem;
    padding: 0.4rem 0.6rem;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 6px;
    border-left: 3px solid var(--primary);
    color: var(--text-secondary);
}

/* ===== Filtro risultati dropdown (Fase 7B) ===== */
.results-filter-wrapper {
    position: relative;
    margin-bottom: 0.75rem;
}

.filter-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.85rem;
    font-size: 0.8rem;
    color: #94a3b8;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
}

.filter-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #f8fafc;
}

.filter-count {
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0.1rem 0.4rem;
    border-radius: 10px;
    background: #6366f1;
    color: white;
    display: none;
    margin-left: 0.15rem;
}

.filter-count.active {
    display: inline;
}

.filter-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 50;
    display: none;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0.5rem;
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    min-width: 230px;
}

.filter-dropdown.open {
    display: flex;
}

.filter-separator {
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    margin: 0.25rem 0;
}

.filter-chip {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    padding: 0.4rem 0.5rem;
    border-radius: 6px;
    color: #94a3b8;
    cursor: pointer;
    user-select: none;
}

.filter-chip:hover {
    background: rgba(255, 255, 255, 0.06);
}

.filter-chip:has(input:checked) {
    color: #f8fafc;
}

.filter-chip:has(input:not(:checked)) {
    opacity: 0.45;
}

.filter-chip input[type="checkbox"] {
    width: 14px;
    height: 14px;
    accent-color: #6366f1;
    cursor: pointer;
    margin: 0;
}

.filter-chip-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ===== No Results ===== */
.no-results {
    text-align: center;
    padding: 3rem;
}

.no-results-icon {
    font-size: 4rem;
    display: block;
    margin-bottom: 1rem;
}

.no-results p {
    font-size: 1.25rem;
    color: var(--text-secondary);
}

/* ===== Loading Overlay ===== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.95);
    /* DISABLED for debugging - backdrop-filter can cause GPU issues */
    /* backdrop-filter: blur(10px); */
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-content {
    text-align: center;
}

.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: 0 auto 1.5rem;
}

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

.loading-content p {
    font-size: 1.25rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.progress-bar {
    width: 300px;
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    margin: 0 auto 0.5rem;
}

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

.progress-text {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* ===== Footer ===== */
.footer {
    margin-top: auto;
    padding: 2rem 0;
    text-align: center;
}

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

.footer-note {
    font-size: 0.875rem !important;
    color: var(--text-muted) !important;
    margin-top: 0.5rem;
}

/* ===== Tab Navigation ===== */
.tab-nav {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    justify-content: center;
}

.tab-btn {
    padding: 0.875rem 2rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.tab-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.tab-btn.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border-color: var(--primary);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.tab-content {
    display: none;
}

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

/* ===== Analyzer Section ===== */
.analyzer-section {
    margin-bottom: 2rem;
}

.analyzer-description {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

.analyzer-input-row {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
}

.analyzer-loading {
    margin-bottom: 2rem;
}

.analyzer-loading-content {
    text-align: center;
    padding: 2rem;
}

.analyzer-loading-content p {
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.analyzer-results {
    margin-bottom: 2rem;
}

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

    .logo h1 {
        font-size: 1.75rem;
    }

    .card {
        padding: 1.5rem;
    }

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

    .api-key-section .input-group {
        flex-direction: column;
    }

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

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .analyzer-input-row {
        flex-direction: column;
    }

    .analyzer-input-row .btn {
        width: 100%;
    }

    .tab-nav {
        gap: 0.25rem;
    }

    .tab-btn {
        padding: 0.75rem 1.25rem;
        font-size: 0.9rem;
    }
}

/* ===== Animations ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    animation: fadeIn 0.5s ease-out;
}

.stat-card {
    animation: fadeIn 0.5s ease-out backwards;
}

.stat-card:nth-child(1) {
    animation-delay: 0.1s;
}

.stat-card:nth-child(2) {
    animation-delay: 0.2s;
}

.stat-card:nth-child(3) {
    animation-delay: 0.3s;
}

.stat-card:nth-child(4) {
    animation-delay: 0.4s;
}

/* Header visibile solo in stampa */
.print-header {
    display: none;
}

/* ===== Manual Checklist (Fase 7D) ===== */

.analyzer-checklist {
    margin-bottom: 1rem;
}

.manual-checklist-counter {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-left: 0.75rem;
    font-weight: 400;
}

.manual-check-group {
    margin-bottom: 1.25rem;
}

.manual-check-group h4 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.manual-check-subtitle {
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--text-muted);
}

.manual-check-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.6rem 0.75rem;
    border-radius: var(--radius-sm);
    transition: background 0.15s;
}

.manual-check-row:hover {
    background: rgba(255, 255, 255, 0.03);
}

.manual-check-info {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    flex: 1;
    min-width: 0;
}

.manual-check-id {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--primary-light);
    min-width: 2rem;
    padding-top: 0.15rem;
}

.manual-check-label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
}

.manual-check-desc {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
    line-height: 1.3;
}

.manual-check-select {
    min-width: 200px;
    padding: 0.5rem 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.85rem;
    cursor: pointer;
    flex-shrink: 0;
}

.manual-check-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.manual-check-select option {
    background: var(--bg-dark);
    color: var(--text-primary);
}

.manual-facts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.manual-fact {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.6rem 0.75rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.manual-fact-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

.manual-fact-value {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

.manual-fact-input {
    padding: 0.4rem 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.9rem;
    width: 100%;
    font-weight: 600;
}

.manual-fact-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.manual-fact-input option {
    background: var(--bg-dark);
    color: var(--text-primary);
}

/* Responsive: su mobile i check vanno a capo */
@media (max-width: 640px) {
    .manual-check-row {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }

    .manual-check-select {
        min-width: unset;
        width: 100%;
    }
}

/* ===== Lead Manual Section — Finder expander (Fase 7D) ===== */

.lead-manual-section {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
}

.lead-manual-header {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.lead-manual-field {
    margin-bottom: 0.5rem;
}

.lead-manual-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    display: block;
    margin-bottom: 0.25rem;
}

.lead-manual-email {
    width: 100%;
    max-width: 280px;
    padding: 0.4rem 0.6rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.85rem;
}

.lead-manual-email:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.lead-check-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.3rem 0;
}

.lead-check-info {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.lead-check-label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-primary);
}

.lead-check-desc {
    font-size: 0.7rem;
    color: var(--text-muted);
    line-height: 1.2;
}

.lead-check-select {
    width: 55px;
    padding: 0.3rem 0.4rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.8rem;
    flex-shrink: 0;
    cursor: pointer;
}

.lead-check-select:focus {
    outline: none;
    border-color: var(--primary);
}

.lead-check-select option {
    background: var(--bg-dark);
    color: var(--text-primary);
}

.lead-manual-actions {
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
}

.lead-save-status {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* ===== Print Styles (PDF Export) ===== */
@media print {
    /* Reset background e colori per stampa */
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    body {
        background: white !important;
        color: #1a1a1a !important;
        font-size: 11pt;
        line-height: 1.5;
    }

    body::before {
        display: none !important;
    }

    /* Nascondi tutto tranne il report analyzer */
    .header,
    .tab-nav,
    .api-key-section,
    #tabFinder,
    .analyzer-section,
    .analyzer-loading,
    .analyzer-export,
    .analyzer-checklist,
    .footer,
    .loading-overlay {
        display: none !important;
    }

    /* Mostra solo i risultati */
    .app-container {
        max-width: 100%;
        padding: 0;
    }

    .main-content {
        display: block !important;
    }

    #tabAnalyzer {
        display: block !important;
    }

    #analyzerResults {
        display: block !important;
    }

    /* Stile cards per stampa */
    .card,
    .card.glass {
        background: white !important;
        border: 1px solid #ddd !important;
        box-shadow: none !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        animation: none !important;
        margin-bottom: 12pt !important;
        padding: 12pt !important;
        break-inside: avoid;
    }

    /* Titoli */
    h3 {
        color: #1a1a1a !important;
        font-size: 13pt !important;
        margin-bottom: 8pt !important;
    }

    /* Tabelle */
    .results-table th,
    .results-table td {
        border-bottom: 1px solid #ddd !important;
        padding: 6pt 8pt !important;
        font-size: 10pt;
    }

    .results-table th {
        background: #f5f5f5 !important;
        color: #333 !important;
    }

    /* Score cards */
    .analyzer-score-card {
        background: #f9f9f9 !important;
        border: 1px solid #ddd !important;
    }

    .analyzer-score-label {
        color: #666 !important;
    }

    /* Colori severity per stampa */
    [style*="var(--danger)"] {
        color: #dc2626 !important;
    }

    [style*="var(--warning)"] {
        color: #d97706 !important;
    }

    [style*="var(--success)"] {
        color: #059669 !important;
    }

    [style*="var(--text-secondary)"] {
        color: #666 !important;
    }

    [style*="var(--text-muted)"] {
        color: #999 !important;
    }

    [style*="var(--text-primary)"] {
        color: #1a1a1a !important;
    }

    /* Details: forza tutto aperto per stampa */
    details.analyzer-details {
        break-inside: avoid;
    }

    details.analyzer-details > summary h3::before {
        content: '' !important;
    }

    /* Screenshot: nascondi in stampa PDF */
    .analyzer-screenshot {
        display: none !important;
    }

    /* Bordi inline rgba trasparenti → visibili su carta bianca */
    [style*="rgba(255,255,255"] {
        border-color: #ddd !important;
    }

    /* Nascondi debug JSON (ultimo details diretto del container risultati) */
    #analyzerResults > details:last-child {
        display: none !important;
    }

    /* Header stampato - nascosto a schermo, visibile in stampa */
    .print-header {
        display: block !important;
        margin-bottom: 16pt;
        padding-bottom: 12pt;
        border-bottom: 2px solid #6366f1;
    }

    .print-header h1 {
        font-size: 20pt;
        font-weight: 700;
        color: #1a1a1a;
        margin: 0 0 4pt;
        background: none !important;
        -webkit-text-fill-color: #1a1a1a !important;
    }

    .print-header .print-url {
        font-size: 12pt;
        color: #4f46e5;
        margin: 0 0 2pt;
    }

    .print-header .print-meta {
        font-size: 9pt;
        color: #666;
        margin: 0;
    }

    .print-header .print-score {
        font-size: 14pt;
        font-weight: 700;
        margin-top: 8pt;
    }

    /* Page settings */
    @page {
        margin: 1.5cm;
        size: A4;
    }
}