/* Base Styles - Premium Minimalist Design */

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

/* Focus Indicators for Accessibility (WCAG 2.1 AA Compliance) */
*:focus {
    outline: 3px solid var(--color-brand-focus, #4F46E5);
    outline-offset: 2px;
}

/* Only show focus for keyboard users (not mouse clicks) */
*:focus:not(:focus-visible) {
    outline: none;
}

*:focus-visible {
    outline: 3px solid var(--color-brand-focus, #4F46E5);
    outline-offset: 2px;
    transition: outline-offset 0.2s ease;
}

/* Enhanced focus for interactive elements */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid var(--color-brand-focus, #4F46E5);
    outline-offset: 3px;
}

body {
    font-family: var(--font-family);
    background: var(--color-bg-muted);
    min-height: 100vh;
    color: var(--color-text-primary);
    line-height: var(--line-height-loose);
}

body:not(.landing-page):not(.signup-container):not(.analysis-container) {
    padding: 20px;
}

/* Navigation - Consistent with Landing */
.main-nav {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    padding: var(--spacing-lg) 0;
    margin-bottom: 0;
    border-bottom: var(--border-width) solid rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: var(--z-dropdown);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand a {
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-primary);
    text-decoration: none;
    letter-spacing: var(--letter-spacing-tight);
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.logo-img {
    height: 40px;
    width: auto;
    object-fit: contain;
}

.logo-text {
    display: inline-block;
}

.nav-links {
    display: flex;
    gap: 32px;
    align-items: center;
}

.nav-links a,
.nav-login {
    color: var(--color-text-secondary);
    text-decoration: none;
    font-weight: var(--font-weight-regular);
    font-size: var(--font-size-base);
    transition: color var(--transition-slow);
    letter-spacing: var(--letter-spacing-normal);
}

.nav-links a:hover,
.nav-login:hover {
    color: var(--color-text-primary);
}

.nav-links a:focus-visible,
.nav-login:focus-visible {
    outline: var(--border-width-thick) solid var(--color-brand-primary);
    outline-offset: var(--spacing-sm);
    border-radius: var(--radius-sm);
}

/* User Menu Dropdown */
.user-menu {
    position: relative;
}

.user-menu-toggle {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    background: transparent;
    border: var(--border-width) solid rgba(0, 0, 0, 0.1);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-slow);
    font-family: inherit;
}

.user-menu-toggle:hover {
    background: var(--color-bg-tertiary);
    border-color: rgba(0, 0, 0, 0.2);
}

.user-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%);
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
}

.user-menu-icon {
    font-size: var(--font-size-xs);
    color: var(--color-text-secondary);
    transition: transform var(--transition-slow);
}

.user-menu.active .user-menu-icon {
    transform: rotate(180deg);
}

.user-menu-dropdown {
    position: absolute;
    top: calc(100% + var(--spacing-sm));
    right: 0;
    background: var(--color-bg);
    border: var(--border-width) solid rgba(0, 0, 0, 0.1);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all var(--transition-slow);
    z-index: 1000;
    overflow: hidden;
}

.user-menu-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: #1a1a1a;
    text-decoration: none;
    font-size: 0.95rem;
    transition: background 0.2s ease;
    cursor: pointer;
}

.dropdown-item:hover {
    background: #f5f5f5;
}

.dropdown-item:first-child {
    border-radius: 8px 8px 0 0;
}

.dropdown-item:last-child {
    border-radius: 0 0 8px 8px;
}

.dropdown-icon {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

.dropdown-divider {
    height: 1px;
    background: rgba(0, 0, 0, 0.1);
    margin: 4px 0;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 40px 0;
}

/* Footer */
.site-footer {
    background: var(--color-bg-muted);
    border-top: var(--border-width) solid rgba(0, 0, 0, 0.05);
    padding: var(--spacing-3xl) 0;
    margin-top: calc(var(--spacing-3xl) * 2);
}

.site-footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-3xl);
    text-align: center;
}

.site-footer-links {
    display: flex;
    justify-content: center;
    gap: var(--spacing-2xl);
    margin-bottom: var(--spacing-xl);
    flex-wrap: wrap;
}

.site-footer a {
    color: var(--color-text-secondary);
    text-decoration: none;
    font-size: var(--font-size-base);
    transition: color var(--transition-slow);
}

.site-footer a:hover {
    color: var(--color-text-primary);
}

.site-footer p {
    color: var(--color-text-tertiary);
    font-size: var(--font-size-sm);
    margin: 0;
}

/* Forms - Consistent Styling */
.audit-form {
    background: var(--color-bg);
    border-radius: 0;
    padding: var(--spacing-3xl);
    box-shadow: none;
    border: var(--border-width) solid rgba(0, 0, 0, 0.05);
    margin-bottom: var(--spacing-3xl);
}

.input-group {
    display: flex;
    gap: var(--spacing-base);
    margin-bottom: var(--spacing-xl);
}

#urlInput {
    flex: 1;
    padding: var(--spacing-base) var(--spacing-xl);
    border: var(--border-width) solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: var(--font-size-md);
    transition: all var(--transition-slow);
    background: var(--color-bg);
    color: var(--color-text-primary);
    font-family: inherit;
}

#urlInput:focus {
    outline: none;
    border-color: var(--color-text-primary);
    background: var(--color-bg-muted);
}

#auditBtn {
    padding: var(--spacing-base) var(--spacing-2xl);
    background: var(--color-text-primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: var(--font-size-md);
    font-weight: var(--font-weight-medium);
    cursor: pointer;
    transition: all var(--transition-slow);
    letter-spacing: var(--letter-spacing-normal);
}

#auditBtn:hover {
    background: var(--color-text-primary-alt);
    transform: translateY(-2px);
}

#auditBtn:focus-visible {
    outline: var(--border-width-thick) solid var(--color-brand-primary);
    outline-offset: var(--spacing-sm);
}

.error-message {
    color: var(--color-error-dark);
    padding: var(--spacing-base) var(--spacing-xl);
    border-radius: var(--radius-md);
    background: var(--color-error-light);
    display: none;
    border: var(--border-width) solid var(--color-error-light-alt);
    font-size: var(--font-size-base);
}

/* Field-level form errors */
.input-error {
    border-color: var(--color-error) !important;
    box-shadow: 0 0 0 1px rgba(204, 51, 51, 0.15);
}

.field-error {
    margin-top: var(--spacing-sm);
    font-size: var(--font-size-sm);
    color: var(--color-error);
}

/* Shared banners for success/error states */
.banner {
    padding: 1rem 1.25rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.banner-icon {
    font-size: 1.1rem;
    line-height: 1;
}

.banner-success {
    background: var(--color-success-light);
    border: var(--border-width) solid var(--color-success);
    color: var(--color-success-dark);
}

.banner-error {
    background: var(--color-error-light);
    border: var(--border-width) solid var(--color-error);
    color: var(--color-error-dark);
}

.loading-spinner {
    text-align: center;
    color: var(--color-text-primary);
    padding: calc(var(--spacing-3xl) * 1.5) var(--spacing-3xl);
}

.spinner {
    border: var(--border-width-thick) solid rgba(0, 0, 0, 0.1);
    border-top: var(--border-width-thick) solid var(--color-text-primary);
    border-radius: var(--radius-full);
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto var(--spacing-xl);
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#resultsContainer {
    animation: fadeIn 0.5s ease;
}

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

/* Results - Minimalist Design */
.overall-score {
    background: white;
    border-radius: 0;
    padding: 60px 40px;
    box-shadow: none;
    border: 1px solid rgba(0, 0, 0, 0.05);
    margin-bottom: 40px;
    display: flex;
    align-items: center;
    gap: 60px;
    flex-wrap: wrap;
    justify-content: center;
}

.score-circle {
    position: relative;
    width: 150px;
    height: 150px;
}

.score-svg {
    width: 150px;
    height: 150px;
    transform: rotate(-90deg);
}

.circle-bg {
    fill: none;
    stroke: #e5e5e5;
    stroke-width: 3;
}

.circle {
    fill: none;
    stroke: #1a1a1a;
    stroke-width: 3;
    stroke-linecap: round;
    transition: stroke-dasharray 1s ease;
}

.score-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.score-text span:first-child {
    display: block;
    font-size: 2.5rem;
    font-weight: 600;
    color: #1a1a1a;
    letter-spacing: -0.02em;
}

.score-label {
    font-size: 0.875rem;
    color: #999;
    display: block;
    margin-top: 8px;
    font-weight: 400;
}

.audit-info {
    flex: 1;
    min-width: 250px;
}

.audit-info h2 {
    color: #1a1a1a;
    margin-bottom: 12px;
    word-break: break-all;
    font-weight: 600;
    font-size: 1.5rem;
    letter-spacing: -0.01em;
}

.audit-info p {
    color: #666;
    font-size: 0.9rem;
    font-weight: 400;
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 30px;
}

.category-card {
    background: white;
    border-radius: 0;
    padding: 40px;
    box-shadow: none;
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease, border-color 0.3s ease;
}

.category-card:hover {
    transform: translateY(-4px);
    border-color: rgba(0, 0, 0, 0.1);
}

.category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.category-header h3 {
    font-size: 1.5rem;
    color: #1a1a1a;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.category-score {
    font-size: 2rem;
    font-weight: 600;
    color: #1a1a1a;
    letter-spacing: -0.02em;
}

.category-details {
    font-size: 1rem;
}

.detail-item {
    margin-bottom: 20px;
    padding: 20px;
    background: #fafafa;
    border-radius: 0;
    border-left: 2px solid #1a1a1a;
}

.detail-item:last-child {
    margin-bottom: 0;
}

.detail-label {
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1rem;
}

.detail-value {
    color: #666;
    font-size: 0.95rem;
    margin-top: 8px;
    font-weight: 400;
    line-height: 1.6;
}

.detail-status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
}

.status-good {
    background: #f0f0f0;
    color: #1a1a1a;
}

.status-warning {
    background: #f5f5f5;
    color: #666;
}

.status-bad {
    background: #fee;
    color: #c33;
}

.status-info {
    background: #f0f4ff;
    color: #1a1a1a;
}

/* Tabs - Minimalist */
.tabs-container {
    background: white;
    border-radius: 0;
    padding: 0;
    margin-bottom: 40px;
    box-shadow: none;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.tabs {
    display: flex;
    gap: 0;
    flex-wrap: wrap;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    padding: 0;
}

.tab-button {
    padding: 20px 32px;
    background: transparent;
    border: none;
    border-radius: 0;
    font-size: 0.95rem;
    font-weight: 500;
    color: #666;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    letter-spacing: -0.01em;
}

.tab-button:hover {
    background: #fafafa;
    color: #1a1a1a;
}

.tab-button.active {
    color: #1a1a1a;
    background: transparent;
    font-weight: 600;
}

.tab-button.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: #1a1a1a;
}

.tab-content {
    display: none;
    padding: 40px;
    animation: fadeIn 0.3s ease;
}

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

/* Recommendations */
.recommendations-toggle {
    margin-top: 20px;
    padding: 12px 20px;
    background: #fafafa;
    border: 1px solid #e5e5e5;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.3s ease;
    font-weight: 500;
    color: #1a1a1a;
    font-size: 0.9rem;
}

.recommendations-toggle:hover {
    background: #f5f5f5;
    border-color: #ccc;
}

.toggle-icon {
    font-size: 0.875rem;
    transition: transform 0.3s ease;
}

.toggle-text {
    font-size: 0.9rem;
}

.recommendations-content {
    margin-top: 20px;
    padding: 24px;
    background: #fafafa;
    border-radius: 0;
    border-left: 2px solid #1a1a1a;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
    }
    to {
        opacity: 1;
        max-height: 1000px;
    }
}

.recommendations-section,
.improvement-section {
    margin-bottom: 24px;
}

.recommendations-section:last-child,
.improvement-section:last-child {
    margin-bottom: 0;
}

.recommendations-section h4,
.improvement-section h4 {
    color: #1a1a1a;
    margin-bottom: 16px;
    font-size: 1.125rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.recommendations-section ul,
.improvement-section ul {
    list-style: none;
    padding-left: 0;
    margin: 0;
}

.recommendations-section li,
.improvement-section li {
    padding: 12px 0 12px 28px;
    position: relative;
    color: #666;
    line-height: 1.7;
    font-size: 0.95rem;
}

.recommendations-section li:before {
    content: "•";
    position: absolute;
    left: 12px;
    color: #1a1a1a;
    font-weight: bold;
    font-size: 1.2rem;
}

.improvement-section li:before {
    content: "→";
    position: absolute;
    left: 0;
    color: #1a1a1a;
}

/* Competitor Section */
.competitor-section {
    background: #fafafa;
    padding: 40px;
    border-radius: 0;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.discover-btn {
    padding: 14px 28px;
    background: #1a1a1a;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    letter-spacing: -0.01em;
}

.discover-btn:hover {
    background: #333;
    transform: translateY(-2px);
}

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

.competitors-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
    margin-top: 24px;
}

.competitor-suggestion-card {
    background: white;
    padding: 24px;
    border-radius: 0;
    box-shadow: none;
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.competitor-suggestion-card:hover {
    border-color: #1a1a1a;
    transform: translateY(-2px);
}

.competitor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.competitor-header h5 {
    margin: 0;
    color: #1a1a1a;
    font-size: 1.125rem;
    font-weight: 600;
}

.competitor-reason {
    color: #666;
    font-size: 0.9rem;
    margin: 12px 0;
    line-height: 1.6;
}

.competitor-note {
    color: #999;
    font-style: italic;
    margin: 12px 0;
    font-size: 0.875rem;
}

.competitor-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.competitor-url-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #e5e5e5;
    border-radius: 6px;
    font-size: 0.9rem;
    font-family: inherit;
}

.competitor-url-input:focus {
    outline: none;
    border-color: #1a1a1a;
}

.analyze-competitor-btn {
    padding: 12px 20px;
    background: #1a1a1a;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.3s ease;
}

.analyze-competitor-btn:hover {
    background: #333;
}

.confidence-badge {
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
}

.confidence-badge.high {
    background: #f0f0f0;
    color: #1a1a1a;
}

.confidence-badge.medium {
    background: #f5f5f5;
    color: #666;
}

.confidence-badge.low {
    background: #fee;
    color: #c33;
}

.competitor-card {
    background: white;
    padding: 32px;
    border-radius: 0;
    box-shadow: none;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.competitor-item {
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.competitor-item:last-child {
    border-bottom: none;
}

.competitor-item ul {
    margin: 16px 0 0 24px;
    padding: 0;
}

.competitor-item li {
    margin: 8px 0;
    color: #666;
    line-height: 1.6;
}

.keyword-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.keyword-tag {
    background: #1a1a1a;
    color: white;
    padding: 6px 14px;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 500;
}

.keyword-section {
    margin-bottom: 32px;
    padding: 24px;
    background: #fafafa;
    border-radius: 0;
    border-left: 2px solid #1a1a1a;
}

.keyword-section h4 {
    margin-bottom: 20px;
    color: #1a1a1a;
    font-weight: 600;
    font-size: 1.125rem;
}

.density-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.density-list li {
    padding: 12px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    color: #666;
}

.density-list li:last-child {
    border-bottom: none;
}

.action-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.action-item {
    background: white;
    padding: 28px;
    border-radius: 0;
    border-left: 2px solid #1a1a1a;
    box-shadow: none;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.action-item.priority {
    border-left-color: #c33;
}

.action-item.quick-win {
    border-left-color: #1a1a1a;
}

.action-item.strategy {
    border-left-color: #666;
}

.action-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.action-header strong {
    color: #1a1a1a;
    font-size: 1.125rem;
    font-weight: 600;
}

.action-item p {
    color: #666;
    margin: 12px 0;
    line-height: 1.7;
}

.action-meta {
    display: flex;
    gap: 20px;
    margin-top: 16px;
    font-size: 0.875rem;
    color: #999;
}

.badge {
    padding: var(--badge-padding-y) var(--badge-padding-x);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
}

.badge.high {
    background: var(--color-error-light);
    color: var(--color-error);
}

.badge.medium {
    background: var(--color-bg-tertiary);
    color: var(--color-text-secondary);
}

.badge.low {
    background: var(--color-bg-secondary);
    color: var(--color-text-primary);
}

.badge.time {
    background: var(--color-bg-secondary);
    color: var(--color-text-primary);
}

.badge.timeline {
    background: var(--color-bg-tertiary);
    color: var(--color-text-secondary);
}

/* Responsive + Mobile Navigation */
@media (max-width: 768px) {
    .container {
        padding: 24px 24px 0;
    }
    
    .nav-container {
        padding: 0 24px;
    }
    
    .nav-links {
        position: fixed;
        inset: 64px 0 auto 0;
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(20px);
        flex-direction: column;
        align-items: flex-start;
        padding: 16px 24px 24px;
        gap: 16px;
        transform: translateY(-16px);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.25s ease, transform 0.25s ease;
        border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    }

    .nav-links.nav-open {
        opacity: 1;
        pointer-events: auto;
        transform: translateY(0);
    }

    .nav-toggle {
        display: inline-flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 4px;
        width: 40px;
        height: 40px;
        border-radius: 999px;
        border: 1px solid rgba(0, 0, 0, 0.12);
        background: #ffffff;
        cursor: pointer;
        margin-left: auto;
    }

    .nav-toggle-bar {
        width: 18px;
        height: 2px;
        border-radius: 999px;
        background: #1a1a1a;
    }

    .main-nav {
        padding: 12px 0;
    }
    
    .logo-img {
        height: 32px;
    }
    
    .logo-text {
        font-size: 1.1rem;
    }
    
    .user-menu-dropdown {
        right: 0;
        min-width: 180px;
    }
    
    .input-group {
        flex-direction: column;
    }
    
    #auditBtn {
        width: 100%;
    }
    
    .category-grid {
        grid-template-columns: 1fr;
    }
    
    .overall-score {
        flex-direction: column;
        text-align: center;
        padding: 40px 24px;
    }
    
    .tabs {
        flex-direction: column;
    }
    
    .tab-button {
        width: 100%;
        text-align: left;
        padding: 16px 24px;
    }
    
    .tab-content {
        padding: 24px;
    }
}
