/* Trafikko Frontend Styles - shadcn/ui inspired */

:root {
    --scg-background: 0 0% 100%;
    --scg-foreground: 222.2 84% 4.9%;
    --scg-card: 0 0% 100%;
    --scg-card-foreground: 222.2 84% 4.9%;
    --scg-popover: 0 0% 100%;
    --scg-popover-foreground: 222.2 84% 4.9%;
    --scg-primary: 221.2 83.2% 53.3%;
    --scg-primary-foreground: 210 40% 98%;
    --scg-secondary: 210 40% 96.1%;
    --scg-secondary-foreground: 222.2 47.4% 11.2%;
    --scg-muted: 210 40% 96.1%;
    --scg-muted-foreground: 215.4 16.3% 46.9%;
    --scg-accent: 210 40% 96.1%;
    --scg-accent-foreground: 222.2 47.4% 11.2%;
    --scg-destructive: 0 84.2% 60.2%;
    --scg-destructive-foreground: 210 40% 98%;
    --scg-border: 214.3 31.8% 91.4%;
    --scg-input: 214.3 31.8% 91.4%;
    --scg-ring: 221.2 83.2% 53.3%;
    --scg-radius: 0.5rem;
}

* {
    box-sizing: border-box;
}

body.scg-frontend {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: hsl(var(--scg-background));
    color: hsl(var(--scg-foreground));
    line-height: 1.5;
    font-size: 16px;
}

/* Header */
.scg-header {
    border-bottom: 1px solid hsl(var(--scg-border));
    background: hsl(var(--scg-card));
    position: sticky;
    top: 0;
    z-index: 50;
}

.scg-header-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
}

.scg-header-brand a {
    font-size: 1.25rem;
    font-weight: 600;
    color: hsl(var(--scg-foreground));
    text-decoration: none;
}

.scg-header-nav {
    display: flex;
    gap: 1.5rem;
    flex: 1;
}

.scg-header-nav a {
    color: hsl(var(--scg-muted-foreground));
    text-decoration: none;
    font-size: 0.875rem;
    transition: color 0.2s;
}

.scg-header-nav a:hover {
    color: hsl(var(--scg-foreground));
}

.scg-header-user {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Container */
.scg-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 2rem;
}

/* Page Header */
.scg-page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.scg-page-header h1 {
    font-size: 2rem;
    font-weight: 600;
    margin: 0;
}

.scg-page-actions {
    display: flex;
    gap: 0.5rem;
}

/* Buttons */
.scg-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: calc(var(--scg-radius) - 2px);
    font-size: 0.875rem;
    font-weight: 500;
    height: 2.5rem;
    padding: 0 1rem;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.scg-button-primary {
    background-color: hsl(var(--scg-primary));
    color: hsl(var(--scg-primary-foreground));
}

.scg-button-primary:hover {
    background-color: hsl(var(--scg-primary) / 0.9);
}

.scg-button-ghost {
    background-color: transparent;
    color: hsl(var(--scg-foreground));
    border-color: hsl(var(--scg-border));
}

.scg-button-ghost:hover {
    background-color: hsl(var(--scg-accent));
}

.scg-button-destructive {
    background-color: hsl(var(--scg-destructive));
    color: hsl(var(--scg-destructive-foreground));
}

.scg-button-destructive:hover {
    background-color: hsl(var(--scg-destructive) / 0.9);
}

.scg-button-sm {
    height: 2rem;
    padding: 0 0.75rem;
    font-size: 0.8125rem;
}

.scg-button-block {
    width: 100%;
}

/* Cards */
.scg-card {
    background: hsl(var(--scg-card));
    border: 1px solid hsl(var(--scg-border));
    border-radius: var(--scg-radius);
    padding: 1.5rem;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.scg-card h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0 0 1rem 0;
}

.scg-card h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0 0 0.75rem 0;
}

/* Stats Grid */
.scg-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.scg-stat-card {
    background: hsl(var(--scg-card));
    border: 1px solid hsl(var(--scg-border));
    border-radius: var(--scg-radius);
    padding: 1.5rem;
}

.scg-stat-value {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.scg-stat-label {
    color: hsl(var(--scg-muted-foreground));
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.scg-stat-link {
    color: hsl(var(--scg-primary));
    text-decoration: none;
    font-size: 0.875rem;
}

.scg-stat-link:hover {
    text-decoration: underline;
}

/* Domains Grid */
.scg-domains-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.scg-domain-card {
    background: hsl(var(--scg-card));
    border: 1px solid hsl(var(--scg-border));
    border-radius: var(--scg-radius);
    padding: 1.5rem;
    transition: box-shadow 0.2s;
}

.scg-domain-card:hover {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.scg-domain-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 0.75rem;
}

.scg-domain-header h3 {
    margin: 0;
    font-size: 1.125rem;
}

.scg-domain-header h3 a {
    color: hsl(var(--scg-foreground));
    text-decoration: none;
}

.scg-domain-name {
    color: hsl(var(--scg-primary));
    font-weight: 500;
    margin: 0.5rem 0;
}

.scg-domain-summary {
    color: hsl(var(--scg-muted-foreground));
    font-size: 0.875rem;
    margin: 0.5rem 0;
    line-height: 1.5;
}

.scg-domain-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

/* Badges */
.scg-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 9999px;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
}

.scg-badge-success {
    background-color: hsl(142.1 76.2% 36.3% / 0.1);
    color: hsl(142.1 70.6% 45.3%);
}

.scg-badge-warning {
    background-color: hsl(38 92% 50% / 0.1);
    color: hsl(38 92% 50%);
}

.scg-badge-default {
    background-color: hsl(var(--scg-muted));
    color: hsl(var(--scg-muted-foreground));
}

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

.scg-form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: hsl(var(--scg-foreground));
}

.scg-input,
.scg-textarea,
.scg-select {
    width: 100%;
    border-radius: calc(var(--scg-radius) - 2px);
    border: 1px solid hsl(var(--scg-input));
    background-color: hsl(var(--scg-background));
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    transition: border-color 0.2s;
}

.scg-input:focus,
.scg-textarea:focus,
.scg-select:focus {
    outline: none;
    border-color: hsl(var(--scg-ring));
    box-shadow: 0 0 0 2px hsl(var(--scg-ring) / 0.2);
}

.scg-textarea {
    resize: vertical;
    min-height: 80px;
}

.scg-form-description {
    font-size: 0.8125rem;
    color: hsl(var(--scg-muted-foreground));
    margin-top: 0.5rem;
}

.scg-form-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.scg-form-checkbox {
    display: flex;
    align-items: center;
}

.scg-form-checkbox label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    margin: 0;
}

.scg-form-checkbox input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
}

/* Sign In */
.scg-signin-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: hsl(var(--scg-muted) / 0.5);
    padding: 2rem;
}

.scg-signin-card {
    background: hsl(var(--scg-card));
    border: 1px solid hsl(var(--scg-border));
    border-radius: var(--scg-radius);
    padding: 2rem;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.scg-signin-header {
    text-align: center;
    margin-bottom: 2rem;
}

.scg-signin-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0 0 0.5rem 0;
}

.scg-signin-header p {
    color: hsl(var(--scg-muted-foreground));
    font-size: 0.875rem;
    margin: 0;
}

.scg-signin-form {
    margin-top: 1.5rem;
}

/* Alerts */
.scg-alert {
    padding: 0.75rem 1rem;
    border-radius: calc(var(--scg-radius) - 2px);
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.scg-alert-error {
    background-color: hsl(var(--scg-destructive) / 0.1);
    color: hsl(var(--scg-destructive));
    border: 1px solid hsl(var(--scg-destructive) / 0.2);
}

/* Empty State */
.scg-empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: hsl(var(--scg-muted-foreground));
}

/* Articles List */
.scg-articles-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.scg-article-card {
    background: hsl(var(--scg-card));
    border: 1px solid hsl(var(--scg-border));
    border-radius: var(--scg-radius);
    padding: 1.5rem;
}

.scg-article-header h3 {
    margin: 0 0 0.75rem 0;
}

.scg-article-header h3 a {
    color: hsl(var(--scg-foreground));
    text-decoration: none;
}

.scg-article-header h3 a:hover {
    color: hsl(var(--scg-primary));
}

.scg-article-meta {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    font-size: 0.875rem;
    color: hsl(var(--scg-muted-foreground));
}

.scg-article-meta span {
    display: inline-flex;
    align-items: center;
}

/* Summary Grid */
.scg-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.scg-dl {
    margin: 0;
}

.scg-dl dt {
    font-weight: 600;
    font-size: 0.875rem;
    margin-top: 1rem;
    margin-bottom: 0.25rem;
}

.scg-dl dt:first-child {
    margin-top: 0;
}

.scg-dl dd {
    margin: 0;
    color: hsl(var(--scg-muted-foreground));
    font-size: 0.875rem;
}

/* Article Layout */
.scg-article-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 2rem;
}

.scg-article-main {
    min-width: 0;
}

.scg-article-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.scg-article-meta-bar {
    display: flex;
    gap: 1.5rem;
    padding: 1rem;
    background: hsl(var(--scg-muted) / 0.5);
    border-radius: calc(var(--scg-radius) - 2px);
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    font-size: 0.875rem;
}

.scg-article-content {
    line-height: 1.75;
    user-select: text;
}

.scg-article-content h1,
.scg-article-content h2,
.scg-article-content h3 {
    margin-top: 2rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

.scg-article-content h1 {
    font-size: 2rem;
}

.scg-article-content h2 {
    font-size: 1.5rem;
}

.scg-article-content h3 {
    font-size: 1.25rem;
}

.scg-article-content p {
    margin-bottom: 1rem;
}

.scg-article-content ul,
.scg-article-content ol {
    margin: 1rem 0;
    padding-left: 2rem;
}

.scg-article-content li {
    margin-bottom: 0.5rem;
}

.scg-article-content blockquote {
    border-left: 4px solid hsl(var(--scg-primary));
    padding-left: 1rem;
    margin: 1rem 0;
    color: hsl(var(--scg-muted-foreground));
    font-style: italic;
}

.scg-article-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

.scg-article-content table th,
.scg-article-content table td {
    border: 1px solid hsl(var(--scg-border));
    padding: 0.75rem;
    text-align: left;
}

.scg-article-content table th {
    background: hsl(var(--scg-muted));
    font-weight: 600;
}

/* Queue */
.scg-queue-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.scg-queue-item {
    background: hsl(var(--scg-card));
    border: 1px solid hsl(var(--scg-border));
    border-radius: var(--scg-radius);
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.scg-queue-item-info {
    flex: 1;
}

.scg-queue-keyword {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
}

.scg-queue-title {
    color: hsl(var(--scg-muted-foreground));
    font-size: 0.875rem;
    margin: 0.5rem 0;
    font-style: italic;
}

.scg-queue-meta {
    font-size: 0.8125rem;
    color: hsl(var(--scg-muted-foreground));
}

.scg-queue-meta .scg-link {
    color: hsl(var(--scg-primary));
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.scg-queue-meta .scg-link:hover {
    color: hsl(var(--scg-primary));
    text-decoration: underline;
}

.scg-queue-keyword-metrics {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid hsl(var(--scg-border));
}

.scg-metric-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    background: hsl(var(--scg-muted));
    border-radius: calc(var(--scg-radius) / 2);
    font-size: 0.75rem;
    color: hsl(var(--scg-muted-foreground));
}

.scg-metric-badge strong {
    margin-right: 0.25rem;
    font-weight: 500;
}

.scg-metric-badge.scg-competition-low {
    background: #d1fae5;
    color: #065f46;
}

.scg-metric-badge.scg-competition-medium {
    background: #fef3c7;
    color: #92400e;
}

.scg-metric-badge.scg-competition-high {
    background: #fee2e2;
    color: #991b1b;
}

.scg-metric-badge.scg-difficulty-easy {
    background: #d1fae5;
    color: #065f46;
}

.scg-metric-badge.scg-difficulty-medium {
    background: #fef3c7;
    color: #92400e;
}

.scg-metric-badge.scg-difficulty-hard {
    background: #fee2e2;
    color: #991b1b;
}

.scg-metric-badge.scg-trending {
    background: #fef3c7;
    color: #92400e;
    font-weight: 500;
}

.scg-metric-badge.scg-data-source-api {
    background: #d1fae5;
    color: #065f46;
    font-weight: 600;
    border: 1px solid #10b981;
}

.scg-metric-badge.scg-data-source-estimation {
    background: #f3f4f6;
    color: #6b7280;
    font-weight: 500;
    border: 1px solid #d1d5db;
}

.scg-queue-item-actions {
    display: flex;
    gap: 0.5rem;
}

/* Modal */
.scg-modal {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
}

.scg-modal-content {
    background: hsl(var(--scg-card));
    border-radius: var(--scg-radius);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.scg-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid hsl(var(--scg-border));
}

.scg-modal-header h2 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.scg-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: hsl(var(--scg-muted-foreground));
    padding: 0;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.scg-modal-close:hover {
    color: hsl(var(--scg-foreground));
}

.scg-modal-body {
    padding: 1.5rem;
}

/* Progress Bar */
.scg-progress-bar {
    width: 100%;
    height: 0.5rem;
    background: hsl(var(--scg-muted));
    border-radius: 9999px;
    overflow: hidden;
    margin: 1rem 0;
}

.scg-progress-fill {
    height: 100%;
    background: hsl(var(--scg-primary));
    width: 0%;
    animation: progress 2s infinite;
}

@keyframes progress {
    0% { width: 0%; }
    50% { width: 70%; }
    100% { width: 100%; }
}

.scg-progress-text {
    text-align: center;
    color: hsl(var(--scg-muted-foreground));
    font-size: 0.875rem;
}

/* Footer */
.scg-footer {
    border-top: 1px solid hsl(var(--scg-border));
    margin-top: 4rem;
    padding: 2rem 0;
}

.scg-footer-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 2rem;
    text-align: center;
    color: hsl(var(--scg-muted-foreground));
    font-size: 0.875rem;
}

/* Responsive */
@media (max-width: 768px) {
    .scg-header-container {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .scg-header-nav {
        width: 100%;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .scg-container {
        padding: 1rem;
    }
    
    .scg-page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .scg-stats-grid,
    .scg-domains-grid,
    .scg-summary-grid {
        grid-template-columns: 1fr;
    }
    
    .scg-article-layout {
        grid-template-columns: 1fr;
    }
    
    .scg-queue-item {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .scg-queue-item-actions {
        width: 100%;
        justify-content: flex-start;
    }
}

