:root {
    --primary: #10B981;
    --primary-hover: #059669;
    --secondary: #F59E0B;
    --accent: #3B82F6;
    --bg-dark: #0D1117;
    --bg-panel: rgba(22, 27, 34, 0.7);
    --bg-input: rgba(13, 17, 23, 0.8);
    --text-main: #E6EDF3;
    --text-muted: #8B949E;
    --border: rgba(48, 54, 61, 0.6);
    --success: #238636;
    --danger: #DA3633;

    --type-feat: #3B82F6;
    --type-fix: #F59E0B;
    --type-chore: #8B949E;
    --type-docs: #10B981;
    --type-refactor: #8B5CF6;
    --type-test: #EC4899;
    --type-style: #14B8A6;

    --glass-border: 1px solid rgba(255, 255, 255, 0.08);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    --radius: 12px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    /* subtle gradient background */
    background-image:
        radial-gradient(circle at 15% 50%, rgba(16, 185, 129, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 85% 30%, rgba(59, 130, 246, 0.05) 0%, transparent 50%);
}

.app-container {
    width: 100%;
    max-width: 1000px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

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

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
    color: var(--primary);
}

.logo h1 {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--text-main);
}

.header-content p {
    color: var(--text-muted);
    font-size: 1.1rem;
}

main {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media (min-width: 768px) {
    main {
        grid-template-columns: 1fr 1fr;
    }
}

.glass-panel {
    background: var(--bg-panel);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: var(--glass-border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--glass-shadow);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.section-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-main);
}

textarea {
    width: 100%;
    height: 300px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    color: var(--text-main);
    font-family: 'Fira Code', monospace;
    font-size: 0.9rem;
    resize: vertical;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

button {
    cursor: pointer;
    border: none;
    background: none;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 500;
    border-radius: 6px;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.primary-btn {
    background: var(--primary);
    color: #fff;
    padding: 0.75rem 1.5rem;
    width: 100%;
}

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

.primary-btn:active {
    transform: translateY(0);
}

.icon-btn {
    color: var(--text-muted);
    padding: 0.4rem;
    border-radius: 4px;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
}

.text-btn {
    color: var(--text-muted);
}

.text-btn:hover {
    color: var(--text-main);
    text-decoration: underline;
}

.results-section {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.hidden {
    display: none !important;
}

#loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    height: 200px;
    color: var(--text-muted);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(16, 185, 129, 0.2);
    border-radius: 50%;
    border-top-color: var(--primary);
    animation: spin 1s linear infinite;
}

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

.badge {
    padding: 0.25rem 0.6rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.message-display {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.25rem;
    position: relative;
    font-family: 'Fira Code', monospace;
    font-size: 0.95rem;
}

.message-header-wrap {
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.type-scope {
    color: var(--text-muted);
}

.subject {
    color: var(--text-main);
}

.message-body {
    color: var(--text-muted);
    white-space: pre-wrap;
    margin-bottom: 0.75rem;
}

.message-footer {
    color: var(--text-muted);
    white-space: pre-wrap;
    font-size: 0.85rem;
}

.copy-btn {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
    border: 1px solid var(--border);
    opacity: 0;
    transform: translateY(5px);
    transition: all 0.2s ease;
}

.message-display:hover .copy-btn {
    opacity: 1;
    transform: translateY(0);
}

.copy-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.analysis-details h3 {
    font-size: 1rem;
    margin-bottom: 0.75rem;
    color: var(--text-muted);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.stat-card {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 600;
    font-family: 'Fira Code', monospace;
}

.stat-card.additions .stat-value {
    color: var(--success);
}

.stat-card.deletions .stat-value {
    color: var(--danger);
}

.files-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    max-height: 150px;
    overflow-y: auto;
    font-family: 'Fira Code', monospace;
    font-size: 0.8rem;
}

.file-item {
    display: flex;
    justify-content: space-between;
    padding: 0.4rem 0.5rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 4px;
}

.file-name {
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-changes {
    color: var(--text-muted);
    white-space: nowrap;
    display: flex;
    gap: 0.5rem;
}

.file-added {
    color: var(--success);
}

.file-deleted {
    color: var(--danger);
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 300px;
    overflow-y: auto;
}

.history-item {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.75rem;
    cursor: pointer;
    transition: background 0.2s ease;
}

.history-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.history-subj {
    font-family: 'Fira Code', monospace;
    font-size: 0.85rem;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.empty-state {
    color: var(--text-muted);
    text-align: center;
    padding: 1rem;
    font-size: 0.9rem;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 20px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
    z-index: 1000;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.toast.hidden {
    opacity: 0;
    transform: translate(-50%, 20px);
    pointer-events: none;
}