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

:root {
    /* Colors - HSL for better control */
    --primary-h: 224;
    --primary-s: 71%;
    --primary-l: 50%;
    --primary: hsl(var(--primary-h), var(--primary-s), var(--primary-l));
    --primary-light: hsl(var(--primary-h), var(--primary-s), 95%);
    --primary-dark: hsl(var(--primary-h), var(--primary-s), 40%);
    
    --accent-h: 262;
    --accent-s: 83%;
    --accent-l: 58%;
    --accent: hsl(var(--accent-h), var(--accent-s), var(--accent-l));
    
    --success: hsl(142, 70%, 45%);
    --warning: hsl(38, 92%, 50%);
    --danger: hsl(0, 84%, 60%);
    
    --bg-main: hsl(210, 40%, 98%);
    --bg-card: hsl(0, 0%, 100%);
    
    --text-main: hsl(222, 47%, 11%);
    --text-muted: hsl(215, 16%, 47%);
    
    --border: hsl(214, 32%, 91%);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-full: 9999px;
    
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
}

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

h1, h2, h3, h4 {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    line-height: 1.2;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* Header & Navigation */
header {
    text-align: center;
    padding: 4rem 1rem;
    background: radial-gradient(circle at top left, var(--primary-light), transparent),
                radial-gradient(circle at bottom right, hsl(var(--accent-h), 80%, 95%), transparent);
    position: relative;
    overflow: hidden;
}

header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border), transparent);
}

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

.logo-icon {
    font-size: 2.5rem;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.1));
}

header h1 {
    font-size: 3rem;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -1px;
}

header p {
    color: var(--text-muted);
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0.5rem auto 0;
}

/* Cards & Sections */
.section-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    margin-bottom: 2rem;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    transition: var(--transition);
}

.section-card:hover {
    box-shadow: var(--shadow-xl);
    border-color: hsl(var(--primary-h), var(--primary-s), 85%);
}

/* Forms & Inputs */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-main);
}

.input-wrapper {
    position: relative;
}

input[type="text"], 
input[type="email"], 
select {
    width: 100%;
    padding: 0.875rem 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    font-family: inherit;
    font-size: 1rem;
    transition: var(--transition);
    background: hsl(0, 0%, 99%);
}

input:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-light);
    background: white;
}

.input-loading {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: none;
}

@keyframes spin {
    to { transform: translateY(-50%) rotate(360deg); }
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    padding: 1rem 2rem;
    border-radius: var(--radius-md);
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 14px 0 hsla(var(--primary-h), var(--primary-s), var(--primary-l), 0.39);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px 0 hsla(var(--primary-h), var(--primary-s), var(--primary-l), 0.23);
}

.btn-secondary {
    background: white;
    color: var(--text-main);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg-main);
    border-color: var(--text-muted);
}

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

/* Quiz UI */
.quiz-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.progress-container {
    flex: 1;
    margin-right: 2rem;
}

.progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
}

.progress-bar {
    height: 10px;
    background: var(--border);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    width: 0%;
    transition: width 0.6s cubic-bezier(0.65, 0, 0.35, 1);
}

.question-card {
    background: hsl(210, 40%, 99%);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    margin-bottom: 1.25rem;
    transition: var(--transition);
}

.question-card.active {
    border-color: var(--primary);
    background: white;
    box-shadow: var(--shadow-lg);
}

.question-text {
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 1.5rem;
    display: flex;
    gap: 1rem;
}

.question-number {
    flex-shrink: 0;
    width: 2.5rem;
    height: 2.5rem;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.9rem;
}

.scale-options {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0.75rem;
}

.scale-btn {
    aspect-ratio: 1;
    border: 2px solid var(--border);
    background: white;
    border-radius: var(--radius-md);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
}

.scale-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
    transform: scale(1.05);
}

.scale-btn.selected {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    box-shadow: 0 4px 12px hsla(var(--primary-h), var(--primary-s), var(--primary-l), 0.3);
}

.scale-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 0.75rem;
    padding: 0 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Top Items Section */
.top-items-grid {
    display: grid;
    gap: 1rem;
    margin-top: 2rem;
}

.top-item-select {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    background: var(--primary-light);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    border: 1px dashed var(--primary);
}

.top-item-badge {
    background: var(--primary);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-full);
    font-weight: 800;
    font-size: 0.75rem;
    white-space: nowrap;
}

/* Results Section */
.results-header {
    text-align: center;
    margin-bottom: 3rem;
}

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

.stat-card {
    background: white;
    padding: 2rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    text-align: center;
    box-shadow: var(--shadow-sm);
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--primary);
    font-family: 'Outfit', sans-serif;
    line-height: 1;
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
}

.chart-box {
    background: white;
    border-radius: var(--radius-lg);
    padding: 2rem;
    border: 1px solid var(--border);
    margin-bottom: 3rem;
    box-shadow: var(--shadow-md);
    display: flex;
    justify-content: center;
}

.results-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.anchor-result-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 2rem;
    border: 2px solid var(--border);
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}

.anchor-result-card.is-primary {
    border-color: var(--primary);
    box-shadow: var(--shadow-xl);
}

.anchor-result-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 6px;
    height: 100%;
    background: var(--anchor-color, var(--primary));
}

.anchor-name {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.anchor-score-pill {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: var(--anchor-light, var(--primary-light));
    color: var(--anchor-color, var(--primary));
    border-radius: var(--radius-full);
    font-weight: 800;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

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

/* Utilities */
.hidden { display: none !important; }

.fade-in {
    animation: fadeIn 0.6s ease-out;
}

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

/* Responsive */
@media (max-width: 768px) {
    header h1 { font-size: 2rem; }
    .section-card { padding: 1.5rem; }
    .scale-options { gap: 0.4rem; }
    .scale-btn { font-size: 1rem; }
    .quiz-header { flex-direction: column; align-items: flex-start; gap: 1rem; }
    .progress-container { margin-right: 0; width: 100%; }
}

/* CNPJ Data Table */
.company-details {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.detail-item {
    font-size: 0.85rem;
}

.detail-item strong {
    display: block;
    color: var(--text-muted);
}
