/* eRacun Validator - CSS Stylesheet */

/* CSS Variables for theming */
:root {
    --bg: #ffffff;
    --bg-secondary: #f8fafc;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] {
    --bg: #0f172a;
    --bg-secondary: #1e293b;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --border: #334155;
    --primary: #3b82f6;
    --primary-hover: #60a5fa;
    --success: #34d399;
    --warning: #fbbf24;
    --error: #f87171;
    --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* Reset and base styles */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

/* Container */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 1rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    padding: 1rem 0;
    border-bottom: 1px solid var(--border);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.logo a {
    color: var(--primary);
    text-decoration: none;
}

.logo a:hover {
    color: var(--primary-hover);
}

.header-controls {
    display: flex;
    gap: 0.5rem;
}

.theme-toggle,
.lang-toggle {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--text);
    transition: background 0.2s, border-color 0.2s;
}

.theme-toggle:hover,
.lang-toggle:hover {
    background: var(--border);
}

/* Main content */
.main {
    flex: 1;
    padding: 2rem 0;
}

/* Upload section */
.upload-section {
    text-align: center;
}

.upload-section h2 {
    margin: 0 0 0.5rem 0;
    font-size: 1.5rem;
    font-weight: 600;
}

.subtitle {
    color: var(--text-muted);
    margin: 0 0 2rem 0;
}

/* Drop zone */
.drop-zone {
    border: 2px dashed var(--border);
    border-radius: 8px;
    padding: 3rem 2rem;
    margin-bottom: 1.5rem;
    transition: border-color 0.2s, background 0.2s;
    cursor: pointer;
}

.drop-zone:hover,
.drop-zone.dragover {
    border-color: var(--primary);
    background: var(--bg-secondary);
}

.drop-zone-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.drop-zone-text {
    font-size: 1.125rem;
    margin: 0 0 0.5rem 0;
}

.drop-zone-hint {
    color: var(--text-muted);
    margin: 0 0 1rem 0;
    font-size: 0.875rem;
}

.file-input-label input[type="file"] {
    display: none;
}

.file-name {
    margin-top: 1rem;
    color: var(--primary);
    font-weight: 500;
    min-height: 1.5rem;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s, opacity 0.2s;
    background: var(--bg-secondary);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn:hover {
    background: var(--border);
}

.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Loading indicator */
.loading {
    text-align: center;
    padding: 2rem;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Results */
.results {
    text-align: left;
}

.results-header {
    margin-bottom: 1.5rem;
}

/* Card */
.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--card-shadow);
}

.card h3 {
    margin: 0 0 1rem 0;
    font-size: 1.125rem;
}

/* Summary grid */
.summary-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.5rem 1rem;
    margin: 0;
}

.summary-grid dt {
    color: var(--text-muted);
    font-weight: 500;
}

.summary-grid dd {
    margin: 0;
}

/* Status badge */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
}

.status-badge.valid {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border: 2px solid var(--success);
}

.status-badge.invalid {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
    border: 2px solid var(--error);
}

.status-icon {
    font-size: 1.5rem;
}

/* Results summary */
.results-summary {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.summary-item {
    flex: 1;
    text-align: center;
    padding: 1rem;
    border-radius: 6px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
}

.summary-item .count {
    display: block;
    font-size: 2rem;
    font-weight: 700;
}

.summary-item .label {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.summary-item.errors .count {
    color: var(--error);
}

.summary-item.warnings .count {
    color: var(--warning);
}

/* Results sections */
.results-section {
    border: 1px solid var(--border);
    border-radius: 6px;
    margin-bottom: 1rem;
    overflow: hidden;
}

.results-section summary {
    padding: 1rem;
    background: var(--bg-secondary);
    cursor: pointer;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.results-section summary:hover {
    background: var(--border);
}

.results-section.errors summary {
    border-left: 3px solid var(--error);
}

.results-section.warnings summary {
    border-left: 3px solid var(--warning);
}

.section-icon {
    font-size: 1rem;
}

/* Results list */
.results-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.result-item {
    padding: 1rem;
    border-top: 1px solid var(--border);
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: flex-start;
}

.rule-id {
    background: var(--bg-secondary);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.875rem;
    font-weight: 500;
    flex-shrink: 0;
}

.message {
    flex: 1;
    min-width: 200px;
}

.location {
    display: block;
    width: 100%;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
    word-break: break-all;
}

/* Success message */
.success-message {
    text-align: center;
    padding: 2rem;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid var(--success);
    border-radius: 8px;
}

.success-message .icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 1rem;
}

.success-message p {
    margin: 0;
    color: var(--success);
    font-weight: 500;
}

/* Error message */
.error-message {
    text-align: center;
    padding: 2rem;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--error);
    border-radius: 8px;
}

.error-message .error-code {
    margin: 0 0 1rem 0;
}

.error-message p {
    margin: 0 0 1rem 0;
}

/* Error page */
.error-page {
    text-align: center;
    padding: 3rem;
}

.error-page .error-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.error-page h2 {
    margin: 0 0 1rem 0;
}

.error-page .error-code {
    background: var(--bg-secondary);
    padding: 0.5rem 1rem;
    border-radius: 4px;
    display: inline-block;
    margin-bottom: 1rem;
}

.error-page .error-message {
    color: var(--text-muted);
    margin-bottom: 2rem;
}

/* Footer */
.footer {
    padding: 1rem 0;
    border-top: 1px solid var(--border);
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.footer p {
    margin: 0;
}

/* Code */
code {
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Mono', 'Droid Sans Mono', monospace;
    background: var(--bg-secondary);
    padding: 0.125rem 0.375rem;
    border-radius: 3px;
    font-size: 0.875em;
}

/* Utility classes */
.text-muted {
    color: var(--text-muted);
}

/* Responsive */
@media (max-width: 600px) {
    .header-content {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .results-summary {
        flex-direction: column;
    }

    .summary-grid {
        grid-template-columns: 1fr;
    }

    .summary-grid dt {
        font-weight: 600;
    }

    .result-item {
        flex-direction: column;
    }
}
