:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --background: #f8fafc;
    --card-background: #ffffff;
    --border-color: #e2e8f0;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --debug-color: #8b5cf6;
    --info-color: #3b82f6;
    --fatal-color: #dc2626;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--background);
    padding: 20px;
}

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

header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
}

main {
    max-width: 1200px;
    margin: 0 auto;
}

.card {
    background: var(--card-background);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 1.5rem;
}

h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

h3 {
    font-size: 1.25rem;
    margin: 1.5rem 0 1rem 0;
}

h4 {
    font-size: 1.1rem;
    margin: 1rem 0 0.5rem 0;
}

.drop-zone {
    border: 3px dashed var(--border-color);
    border-radius: 8px;
    padding: 3rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    background: var(--background);
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: var(--primary-color);
    background: #eff6ff;
}

.drop-zone p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin: 0.5rem 0;
}

.drop-zone .hint {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

#file-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.button-group {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.btn-primary:hover {
    background: var(--primary-hover);
}

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

.btn-secondary:hover {
    background: #475569;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

#paste-area-container {
    margin-top: 1.5rem;
}

#paste-area-container label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

#paste-textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    resize: vertical;
    margin-bottom: 0.75rem;
}

#paste-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.status-message {
    padding: 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-weight: 500;
}

.status-message.success {
    background: #d1fae5;
    color: #065f46;
}

.status-message.error {
    background: #fee2e2;
    color: #991b1b;
}

.status-message.warning {
    background: #fef3c7;
    color: #92400e;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
}

.summary-container {
    background: var(--background);
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

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

.stat-card {
    background: var(--card-background);
    padding: 1rem;
    border-radius: 6px;
    border-left: 4px solid var(--primary-color);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    margin-top: 0.25rem;
}

.histogram {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.histogram-item {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.histogram-label {
    min-width: 80px;
    font-weight: 600;
    font-size: 0.9rem;
}

.histogram-bar-container {
    flex: 1;
    height: 28px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.histogram-bar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s ease;
    display: flex;
    align-items: center;
    padding: 0 0.5rem;
    color: white;
    font-weight: 600;
    font-size: 0.85rem;
}

.histogram-count {
    min-width: 50px;
    text-align: right;
    font-weight: 600;
}

.level-DEBUG { background: var(--debug-color); }
.level-INFO { background: var(--info-color); }
.level-WARN { background: var(--warning-color); }
.level-ERROR { background: var(--error-color); }
.level-FATAL { background: var(--fatal-color); }

#error-codes-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.75rem;
}

.error-code-item {
    background: var(--card-background);
    padding: 0.75rem;
    border-radius: 6px;
    border-left: 3px solid var(--error-color);
    font-size: 0.9rem;
}

.error-code-name {
    font-weight: 700;
    font-family: 'Courier New', monospace;
}

.error-code-count {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

#time-histogram {
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
    height: 100px;
    padding: 0.5rem;
    background: var(--card-background);
    border-radius: 6px;
}

.time-bar {
    flex: 1;
    background: var(--primary-color);
    border-radius: 2px 2px 0 0;
    position: relative;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.time-bar:hover {
    opacity: 0.8;
}

.time-bar-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    white-space: nowrap;
    display: none;
}

.time-bar:hover .time-bar-tooltip {
    display: block;
}

.filters-container {
    background: var(--background);
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.filter-row {
    margin-bottom: 1rem;
}

.filter-row:last-child {
    margin-bottom: 0;
}

.filter-row label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

#search-input {
    width: 100%;
    max-width: 400px;
    padding: 0.5rem 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.95rem;
}

#search-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.chip-container {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.chip {
    padding: 0.4rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid;
    background: white;
}

.chip:hover {
    transform: translateY(-1px);
}

.chip.active {
    color: white;
}

.chip.chip-DEBUG { border-color: var(--debug-color); color: var(--debug-color); }
.chip.chip-DEBUG.active { background: var(--debug-color); }

.chip.chip-INFO { border-color: var(--info-color); color: var(--info-color); }
.chip.chip-INFO.active { background: var(--info-color); }

.chip.chip-WARN { border-color: var(--warning-color); color: var(--warning-color); }
.chip.chip-WARN.active { background: var(--warning-color); }

.chip.chip-ERROR { border-color: var(--error-color); color: var(--error-color); }
.chip.chip-ERROR.active { background: var(--error-color); }

.chip.chip-FATAL { border-color: var(--fatal-color); color: var(--fatal-color); }
.chip.chip-FATAL.active { background: var(--fatal-color); }

.chip.chip-logger {
    border-color: var(--secondary-color);
    color: var(--secondary-color);
}

.chip.chip-logger.active {
    background: var(--secondary-color);
    color: white;
}

#log-lines-container {
    margin-top: 1.5rem;
}

#line-count {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: normal;
}

.log-lines {
    background: #1e293b;
    color: #e2e8f0;
    padding: 1rem;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    line-height: 1.5;
    overflow-x: auto;
    max-height: 600px;
    overflow-y: auto;
}

.log-line {
    padding: 0.25rem 0;
    white-space: pre-wrap;
    word-break: break-word;
}

.log-line.hidden {
    display: none;
}

.log-line .timestamp {
    color: #94a3b8;
}

.log-line .level {
    font-weight: 700;
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
}

.log-line .level-DEBUG { color: var(--debug-color); }
.log-line .level-INFO { color: var(--info-color); }
.log-line .level-WARN { color: var(--warning-color); }
.log-line .level-ERROR { color: var(--error-color); }
.log-line .level-FATAL { color: var(--fatal-color); }

.log-line .logger {
    color: #60a5fa;
}

.log-line .error-code {
    color: #fbbf24;
    font-weight: 600;
}

footer {
    text-align: center;
    margin-top: 3rem;
    padding: 2rem 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

footer a {
    color: var(--primary-color);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    header h1 {
        font-size: 2rem;
    }

    .card {
        padding: 1.5rem;
    }

    .drop-zone {
        padding: 2rem 1rem;
    }

    .results-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .button-group {
        width: 100%;
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .summary-stats {
        grid-template-columns: 1fr;
    }
}
