:root {
    --bg-base: #F9FAFB;
    --bg-panel: #FFFFFF;
    --bg-input: #FFFFFF;
    --bg-hover: #F3F4F6;

    --border-light: #E5E7EB;
    --border-highlight: #D1D5DB;

    --text-main: #111827;
    --text-muted: #6B7280;

    --primary: #3B82F6;
    --primary-hover: #2563EB;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);

    --radius-lg: 12px;
    --radius-md: 8px;
    --radius-sm: 4px;

    /* GitHub Specific */
    --gh-link: #0969da;
    --gh-bg: #f6f8fa;
    --gh-border: #d0d7de;

    /* GitLab Specific */
    --gl-link: #1068bf;
    --gl-bg: #fafafa;
    --gl-border: #dbdfe4;

    /* Bitbucket Specific */
    --bb-link: #0052cc;
    --bb-bg: #ffffff;
    --bb-border: #dfe1e6;
}

[data-theme="dark"] {
    --bg-base: #111827;
    --bg-panel: #1F2937;
    --bg-input: #111827;
    --bg-hover: #374151;

    --border-light: #374151;
    --border-highlight: #4B5563;

    --text-main: #F9FAFB;
    --text-muted: #9CA3AF;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.5);

    /* GitHub Specific Dark */
    --gh-link: #58a6ff;
    --gh-bg: #0d1117;
    --gh-border: #30363d;

    /* GitLab Specific Dark */
    --gl-link: #428fdc;
    --gl-bg: #181818;
    --gl-border: #333333;

    /* Bitbucket Specific Dark */
    --bb-link: #4c9aff;
    --bb-bg: #1d2125;
    --bb-border: #22272b;
}

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

body {
    font-family: 'Inter', system-ui, sans-serif;
    background-color: var(--bg-base);
    color: var(--text-main);
    line-height: 1.5;
    height: 100vh;
    overflow: hidden;
    transition: background-color 0.3s, color 0.3s;
}

svg {
    display: block;
}

.w-4 {
    width: 1rem;
}

.h-4 {
    height: 1rem;
}

.w-5 {
    width: 1.25rem;
}

.h-5 {
    height: 1.25rem;
}

.w-6 {
    width: 1.5rem;
}

.h-6 {
    height: 1.5rem;
}

.hidden {
    display: none !important;
}

.flex {
    display: flex;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.w-full {
    width: 100%;
}

.ml-auto {
    margin-left: auto;
}

.mx-1 {
    margin-left: 0.25rem;
    margin-right: 0.25rem;
}

.text-xs {
    font-size: 0.75rem;
}

.text-sm {
    font-size: 0.875rem;
}

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

.text-white {
    color: #fff;
}

/* Theme Toggles */
[data-theme="light"] .light-hidden {
    display: none;
}

[data-theme="dark"] .dark-hidden {
    display: none;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 0.875rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

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

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

.btn-outline {
    background: transparent;
    border-color: var(--border-light);
    color: var(--text-main);
}

.btn-outline:hover {
    background: var(--bg-hover);
    border-color: var(--border-highlight);
}

.btn-icon {
    padding: 0.5rem;
    background: transparent;
    color: var(--text-muted);
    border-radius: var(--radius-md);
}

.btn-icon:hover {
    background: var(--bg-hover);
    color: var(--text-main);
}

/* Layout */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem;
    gap: 1.5rem;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: var(--bg-panel);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

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

.brand h1 {
    font-size: 1.125rem;
    font-weight: 600;
}

.brand-icon {
    width: 36px;
    height: 36px;
    background: var(--primary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.workspace {
    display: flex;
    gap: 1.5rem;
    flex: 1;
    min-height: 0;
}

.panel {
    background: var(--bg-panel);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.editor-pane {
    flex: 1;
    min-width: 300px;
    max-width: 500px;
}

.preview-pane {
    flex: 2;
}

.pane-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-light);
}

.pane-header h3 {
    font-size: 0.9375rem;
    font-weight: 600;
}

/* Editor */
.editor-toolbar {
    padding: 0.5rem 1rem;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    gap: 0.25rem;
    align-items: center;
    background: var(--bg-hover);
}

.toolbar-btn {
    background: transparent;
    border: none;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    color: var(--text-main);
    cursor: pointer;
    font-size: 0.875rem;
    font-family: 'JetBrains Mono', monospace;
}

.toolbar-btn:hover {
    background: var(--border-light);
}

.v-divider {
    width: 1px;
    height: 16px;
    background: var(--border-highlight);
    margin: 0 0.5rem;
}

.char-count {
    font-size: 0.75rem;
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-muted);
}

.char-count.error {
    color: #ef4444;
}

.editor-body {
    flex: 1;
    display: flex;
    position: relative;
}

.commit-input {
    width: 100%;
    height: 100%;
    padding: 1.5rem;
    border: none;
    outline: none;
    background: transparent;
    color: var(--text-main);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.875rem;
    resize: none;
    line-height: 1.6;
}

.editor-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-light);
}

/* Tabs */
.platform-tabs {
    display: flex;
    gap: 0.25rem;
    background: var(--bg-hover);
    padding: 0.25rem;
    border-radius: var(--radius-md);
}

.tab-btn {
    padding: 0.375rem 0.75rem;
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.tab-btn.active {
    background: var(--bg-panel);
    color: var(--text-main);
    box-shadow: var(--shadow-sm);
}

.tab-btn:not(.active):hover {
    color: var(--text-main);
}

/* Preview Area */
.preview-body {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
    background: var(--bg-base);
}

.preview-view {
    display: none;
}

.preview-view.active {
    display: block;
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Shared markdown styles in commits */
.markdown-body {
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-main);
}

.markdown-body p {
    margin-bottom: 10px;
}

.markdown-body p:last-child {
    margin-bottom: 0;
}

.markdown-body code {
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
    font-size: 85%;
    padding: 0.2em 0.4em;
    border-radius: 6px;
}

/* 
 * GITHUB PREVIEW 
 */
.gh-commit {
    border: 1px solid var(--gh-border);
    border-radius: 6px;
    padding: 16px;
    background: var(--gh-bg);
    display: flex;
    gap: 16px;
}

.gh-avatar img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #fff;
}

.gh-content {
    flex: 1;
    min-width: 0;
}

.gh-subject {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 4px;
    word-break: break-word;
}

.gh-subject:hover {
    color: var(--gh-link);
    cursor: pointer;
}

.gh-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.gh-author {
    font-weight: 600;
    color: var(--text-main);
}

.gh-body {
    margin-top: 12px;
    color: var(--text-main);
    white-space: pre-wrap;
    word-break: break-word;
}

.gh-body code {
    background: rgba(175, 184, 193, 0.2);
}

.gh-commit-links {
    flex-shrink: 0;
    display: flex;
    align-items: flex-start;
}

.gh-sha {
    font-family: ui-monospace, sans-serif;
    font-size: 12px;
    color: var(--gh-link);
    border: 1px solid var(--gh-border);
    padding: 4px 8px;
    border-radius: 6px;
    background: var(--bg-panel);
}

.issue-link,
.markdown-body a {
    color: var(--gh-link);
    text-decoration: none;
}

.issue-link:hover,
.markdown-body a:hover {
    text-decoration: underline;
}

/* 
 * GITLAB PREVIEW 
 */
.gl-commit {
    border: 1px solid var(--gl-border);
    border-radius: 4px;
    background: var(--gl-bg);
    padding: 16px;
}

.gl-header {
    display: flex;
    gap: 12px;
    align-items: center;
    border-bottom: 1px solid var(--gl-border);
    padding-bottom: 16px;
    margin-bottom: 16px;
}

.gl-avatar img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
}

.gl-title-wrap {
    flex: 1;
    min-width: 0;
}

.gl-subject {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 4px;
}

.gl-meta {
    font-size: 12px;
    color: var(--text-muted);
}

.gl-actions {
    display: flex;
    align-items: center;
}

.gl-sha {
    color: var(--gl-link);
    font-family: monospace;
    font-size: 14px;
}

.gl-body {
    font-size: 14px;
    white-space: pre-wrap;
    color: var(--text-muted);
}

[data-theme="dark"] .gl-body {
    color: #bfbfc3;
}

.gl-body code {
    background: rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .gl-body code {
    background: rgba(255, 255, 255, 0.1);
}

/* 
 * BITBUCKET PREVIEW 
 */
.bb-commit {
    display: flex;
    gap: 16px;
    padding: 16px;
    border: 1px solid var(--bb-border);
    border-radius: 3px;
    background: var(--bb-bg);
}

.bb-content {
    flex: 1;
    min-width: 0;
}

.bb-subject {
    font-size: 16px;
    font-weight: 500;
    color: var(--bb-link);
    margin-bottom: 8px;
}

.bb-subject:hover {
    text-decoration: underline;
    cursor: pointer;
}

.bb-body {
    font-size: 14px;
    color: var(--text-main);
    margin-bottom: 12px;
    white-space: pre-wrap;
    font-family: sans-serif;
}

.bb-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
}

.bb-avatar img {
    width: 24px;
    height: 24px;
    border-radius: 3px;
}

.bb-side {
    flex-shrink: 0;
}

.bb-sha {
    font-family: monospace;
    font-size: 14px;
    color: var(--text-muted);
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--text-main);
    color: var(--bg-base);
    padding: 0.75rem 1.5rem;
    border-radius: 999px;
    font-weight: 500;
    font-size: 0.875rem;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 100;
    box-shadow: var(--shadow-md);
    pointer-events: none;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}