:root {
    /* Design Guidelines Colors */
    --bg-base: hsl(222, 25%, 8%);
    --bg-elevated: hsl(222, 20%, 12%);
    --bg-subtle: hsl(222, 15%, 16%);
    
    --brand-primary: hsl(252, 70%, 60%);
    --brand-hover: hsl(252, 70%, 55%);
    --accent-secondary: hsl(210, 85%, 58%);
    --success: hsl(142, 70%, 55%);
    --warning: hsl(38, 90%, 60%);
    --error: hsl(358, 75%, 58%);
    
    --text-primary: hsl(220, 15%, 95%);
    --text-secondary: hsl(220, 10%, 70%);
    --text-tertiary: hsl(220, 8%, 50%);
    --text-muted: hsl(220, 5%, 35%);
    
    --border-default: hsl(220, 15%, 20%);
    --border-elevated: hsl(220, 20%, 25%);
    --border-focus: hsl(252, 70%, 60%);
    
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, var(--bg-base) 0%, hsl(222, 20%, 10%) 100%);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* === Header === */
header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(15, 12, 41, 0.8);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-default);
    padding: var(--spacing-md) var(--spacing-lg);
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: 24px;
    font-weight: 700;
    color: var(--brand-primary);
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--brand-primary), var(--accent-secondary));
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    color: white;
}

.nav-menu {
    display: flex;
    gap: var(--spacing-lg);
}

.nav-item {
    cursor: pointer;
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
    font-weight: 500;
    color: var(--text-secondary);
}

.nav-item:hover {
    background-color: var(--bg-subtle);
    color: var(--text-primary);
}

/* === Header Auth === */
#header-auth-container {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

#header-guest {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

#header-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
}

#header-user:hover {
    background-color: var(--bg-subtle);
}

.header-user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    color: white;
    background: var(--brand-primary);
}

.header-user-info {
    display: flex;
    flex-direction: column;
}

.header-user-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

/* === Buttons === */
.btn {
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
    border: none;
    outline: none;
    font-family: inherit;
    font-size: 15px;
}

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

.btn-primary:hover {
    background: var(--brand-hover);
    transform: translateY(-1px);
}

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

.btn-secondary:hover {
    background-color: var(--bg-elevated);
}

.btn-large {
    padding: 16px 32px;
    font-size: 16px;
}

.btn-full {
    width: 100%;
}

/* === Hero Section === */
.hero {
    padding: 120px 24px 80px;
    text-align: center;
    background: radial-gradient(ellipse at top, hsl(252, 50%, 15%), var(--bg-base));
    position: relative;
    overflow: hidden;
}

.hero-content {
    max-width: 900px;
    margin: 0 auto;
}

.hero-title {
    font-size: 56px;
    font-weight: 800;
    margin-bottom: 24px;
    line-height: 1.1;
    background: linear-gradient(135deg, var(--text-primary), var(--text-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 20px;
    color: var(--text-secondary);
    margin-bottom: 40px;
    line-height: 1.6;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

.hero-buttons {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-bottom: 60px;
    flex-wrap: wrap;
}

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 60px;
    flex-wrap: wrap;
}

.stat-item {
    text-align: center;
}

.stat-number {
    font-size: 36px;
    font-weight: 700;
    color: var(--brand-primary);
    margin-bottom: 8px;
}

.stat-label {
    font-size: 14px;
    color: var(--text-tertiary);
}

/* === Sections === */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
}

.features, .how-it-works, .cta-section {
    padding: 80px 0;
}

.section-title {
    font-size: 42px;
    text-align: center;
    margin-bottom: 16px;
    font-weight: 700;
}

.section-subtitle {
    text-align: center;
    margin-bottom: 60px;
    color: var(--text-secondary);
    font-size: 18px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* === Feature Cards === */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
}

.feature-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border-elevated);
    border-radius: var(--radius-md);
    padding: 32px;
    transition: all 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-4px);
    border-color: var(--brand-primary);
}

.feature-icon {
    font-size: 48px;
    margin-bottom: 20px;
}

.feature-title {
    font-size: 22px;
    margin-bottom: 12px;
    font-weight: 600;
}

.feature-description {
    color: var(--text-secondary);
    line-height: 1.6;
}

/* === Steps === */
.steps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 32px;
}

.step-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    padding: 32px;
    text-align: center;
}

.step-number {
    width: 60px;
    height: 60px;
    background: var(--brand-primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 700;
    margin: 0 auto 24px;
}

.step-title {
    font-size: 22px;
    margin-bottom: 12px;
    font-weight: 600;
}

.step-description {
    color: var(--text-secondary);
    line-height: 1.6;
}

/* === CTA Section === */
.cta-section {
    background: radial-gradient(ellipse at center, hsl(252, 50%, 15%), var(--bg-base));
    padding: 100px 24px;
}

.cta-content {
    text-align: center;
    max-width: 700px;
    margin: 0 auto;
}

.cta-title {
    font-size: 42px;
    font-weight: 700;
    margin-bottom: 16px;
}

.cta-subtitle {
    font-size: 18px;
    color: var(--text-secondary);
    margin-bottom: 32px;
}

/* === Dashboard === */
.dashboard {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: var(--bg-elevated);
    border-right: 1px solid var(--border-default);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
}

.sidebar-menu {
    padding: 24px 16px;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    margin: 4px 0;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-secondary);
}

.sidebar-item:hover {
    background-color: var(--bg-subtle);
    color: var(--text-primary);
}

.sidebar-item.active {
    background-color: var(--brand-primary);
    color: white;
}

.sidebar-item-disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.sidebar-item-disabled:hover {
    background-color: transparent;
    color: var(--text-secondary);
}

.user-panel {
    padding: 20px;
    border-top: 1px solid var(--border-default);
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.user-panel:hover {
    background-color: var(--bg-subtle);
}

.user-avatar {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--brand-primary), var(--accent-secondary));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
}

.user-info {
    flex: 1;
}

.user-name {
    font-weight: 600;
    font-size: 14px;
}

.user-email {
    font-size: 12px;
    color: var(--text-tertiary);
}

.main-content {
    margin-left: 260px;
    padding: 32px;
    flex: 1;
}

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

.dashboard-title {
    font-size: 32px;
    font-weight: 700;
}

/* === Projects Grid === */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
}

.project-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border-elevated);
    border-radius: var(--radius-md);
    padding: 24px;
    transition: all 0.3s ease;
    position: relative;
}

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

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

.project-title {
    font-size: 20px;
    font-weight: 600;
    flex: 1;
}

.project-tag {
    background-color: var(--bg-subtle);
    color: var(--brand-primary);
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 500;
}

.project-description {
    color: var(--text-secondary);
    margin-bottom: 16px;
    line-height: 1.5;
    font-size: 14px;
}

.project-meta {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-bottom: 16px;
}

.project-actions {
    display: flex;
    gap: 12px;
    justify-content: space-between;
}

.action-btn {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
    border: none;
    outline: none;
    background: var(--bg-subtle);
    color: var(--text-primary);
}

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

.action-btn-delete {
    background: none;
    color: var(--error);
    padding: 8px;
}

.action-btn-delete:hover {
    background-color: rgba(231, 76, 60, 0.2);
}

.empty-state {
    text-align: center;
    padding: 80px 24px;
}

.empty-icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-title {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 8px;
}

.empty-description {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

/* === Modal === */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: var(--bg-elevated);
    border: 1px solid var(--border-elevated);
    border-radius: var(--radius-lg);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-large {
    max-width: 700px;
}

.modal-header {
    padding: 24px 24px 16px;
    border-bottom: 1px solid var(--border-default);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 24px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 32px;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
}

.modal-close:hover {
    background-color: var(--bg-subtle);
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
}

/* === Forms === */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 14px;
    color: var(--text-secondary);
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    background-color: var(--bg-subtle);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 15px;
    transition: all 0.2s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--border-focus);
    background-color: var(--bg-elevated);
}

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

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.keywords-hint {
    color: var(--text-secondary);
    margin-bottom: 16px;
    font-size: 14px;
}

.keywords-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.keyword-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-subtle);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
}

.keyword-item input {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    padding: 0;
}

.keyword-item input:focus {
    outline: none;
}

.keyword-remove {
    background: none;
    border: none;
    color: var(--error);
    cursor: pointer;
    padding: 4px;
    font-size: 18px;
}

/* === Toast === */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 16px 24px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-elevated);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-weight: 500;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
    z-index: 2000;
    min-width: 280px;
    max-width: 400px;
    display: flex;
    align-items: center;
    gap: 12px;
}

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

.toast.success {
    border-color: var(--success);
}

.toast.error {
    border-color: var(--error);
}

.toast.info {
    border-color: var(--brand-primary);
}

.toast-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}

.toast-icon.success {
    color: var(--success);
}

.toast-icon.error {
    color: var(--error);
}

.toast-icon.info {
    color: var(--brand-primary);
}

.toast-message {
    flex: 1;
}

/* === Processing Indicator === */
.processing-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--bg-subtle);
    border: 1px solid var(--border-elevated);
    border-radius: var(--radius-md);
    margin-top: 12px;
    margin-bottom: 4px;
}

.processing-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--bg-elevated);
    border-top-color: var(--brand-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}

.processing-text {
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
}

/* === Loading === */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--bg-subtle);
    border-top-color: var(--brand-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* === Results Dashboard === */
.results-view {
    padding: var(--spacing-xl);
    max-width: 1400px;
    margin: 0 auto;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--spacing-xl);
    gap: var(--spacing-lg);
}

.dashboard-subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: var(--spacing-sm);
}

.stats-section {
    margin-bottom: var(--spacing-xl);
}

.stat-card {
    background: linear-gradient(135deg, var(--bg-elevated), var(--bg-subtle));
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    padding: var(--spacing-lg);
    transition: all 0.2s ease;
}

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

.stat-card-main {
    text-align: center;
    padding: var(--spacing-xl);
    border: 2px solid var(--brand-primary);
    background: linear-gradient(135deg, 
        hsla(252, 70%, 60%, 0.1), 
        hsla(252, 70%, 60%, 0.05)
    );
}

.stat-label {
    font-size: 14px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--spacing-sm);
}

.stat-value {
    font-size: 56px;
    font-weight: 800;
    color: var(--brand-primary);
    line-height: 1;
    margin-bottom: var(--spacing-sm);
}

.stat-details {
    font-size: 16px;
    color: var(--text-tertiary);
}

.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-xl);
}

.service-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    padding: var(--spacing-lg);
    text-align: center;
    transition: all 0.2s ease;
}

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

.service-name {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-sm);
    font-weight: 600;
}

.service-percentage {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 4px;
}

.service-percentage.positive {
    color: var(--success);
}

.service-percentage.neutral {
    color: var(--text-tertiary);
}

.service-details {
    font-size: 13px;
    color: var(--text-tertiary);
}

.results-table-container {
    margin-bottom: var(--spacing-xl);
}

.section-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-lg);
}

.results-table {
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.table-header {
    display: flex;
    background: var(--bg-subtle);
    border-bottom: 2px solid var(--border-elevated);
}

.table-row {
    display: flex;
    border-bottom: 1px solid var(--border-default);
    transition: background 0.2s ease;
}

.table-row:hover {
    background: var(--bg-subtle);
}

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

.table-cell {
    flex: 1;
    padding: var(--spacing-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-cell {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.query-cell {
    flex: 2;
    justify-content: flex-start;
    font-size: 14px;
    color: var(--text-primary);
}

.status-cell {
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: var(--radius-sm);
    margin: 2px;
}

.status-cell:hover {
    background: var(--bg-base);
}

.status-indicator {
    font-size: 18px;
    font-weight: 700;
}

.status-found {
    color: var(--success);
}

.status-found .status-indicator {
    color: var(--success);
}

.status-not-found {
    color: var(--text-muted);
}

.status-not-found .status-indicator {
    color: var(--text-muted);
}

/* === Result Detail Modal === */
.modal-large {
    max-width: 700px;
    width: 90%;
}

.detail-section {
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-lg);
    border-bottom: 1px solid var(--border-default);
}

.detail-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.detail-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--spacing-sm);
}

.detail-value {
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.6;
}

.detail-text {
    background: var(--bg-base);
    padding: var(--spacing-md);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--brand-primary);
}

.detail-highlight {
    background: linear-gradient(90deg, 
        hsla(252, 70%, 60%, 0.2), 
        hsla(252, 70%, 60%, 0.05)
    );
    padding: var(--spacing-md);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--brand-primary);
}

.status-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-badge.status-found {
    background: hsla(142, 70%, 55%, 0.15);
    color: var(--success);
    border: 1px solid var(--success);
}

.status-badge.status-not-found {
    background: hsla(220, 5%, 35%, 0.15);
    color: var(--text-muted);
    border: 1px solid var(--border-default);
}

/* === Responsive === */
@media (max-width: 768px) {
    .hero-title {
        font-size: 36px;
    }
    
    .hero-subtitle {
        font-size: 16px;
    }
    
    .nav-menu {
        display: none;
    }
    
    #header-auth-container {
        flex-direction: column;
        gap: 8px;
    }
    
    .header-user-info {
        display: none;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        width: 70px;
    }
    
    .sidebar-item span:last-child {
        display: none;
    }
    
    .main-content {
        margin-left: 70px;
    }
}

/* === Button Loading State === */
.btn-loader {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}
