/* ============================================
   Git Commit Msg Generator — Styles
   Theme: Dark terminal-inspired
   ============================================ */

:root {
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;

    --bg: #0d1117;
    --bg-card: #161b22;
    --bg-input: #0d1117;
    --bg-hover: #1c2333;

    --border: rgba(48, 54, 61, 0.8);
    --border-hover: rgba(48, 54, 61, 1);
    --border-focus: #388bfd;

    --text: #e6edf3;
    --text-secondary: #8b949e;
    --text-muted: #484f58;

    --green: #3fb950;
    --green-dim: rgba(63, 185, 80, 0.15);
    --red: #f85149;
    --red-dim: rgba(248, 81, 73, 0.15);
    --blue: #58a6ff;
    --blue-dim: rgba(88, 166, 255, 0.15);
    --yellow: #d29922;
    --yellow-dim: rgba(210, 153, 34, 0.15);
    --purple: #bc8cff;

    --radius: 10px;
    --radius-sm: 6px;
    --shadow: 0 2px 16px rgba(0, 0, 0, 0.5);
    --transition: 0.2s ease;
}

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

.app {
    max-width: 720px;
    margin: 0 auto;
    padding: 24px 16px 40px;
}

/* Header */
.header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 24px;
}

.header-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    background: linear-gradient(135deg, var(--green), var(--blue));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    box-shadow: 0 0 20px rgba(63, 185, 80, 0.2);
}

.header-title {
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.header-sub {
    font-size: 0.82rem;
    color: var(--text-secondary);
}

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 14px;
    box-shadow: var(--shadow);
    transition: border-color var(--transition);
}

.card:hover {
    border-color: var(--border-hover);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.card-title {
    font-size: 0.9rem;
    font-weight: 600;
}

/* Tabs */
.tab-bar {
    display: flex;
    gap: 4px;
}

.tab {
    padding: 5px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}

.tab:hover {
    color: var(--text);
    border-color: var(--border-hover);
}

.tab.active {
    background: var(--blue-dim);
    color: var(--blue);
    border-color: var(--blue);
}

/* Input Areas */
.input-area {
    width: 100%;
    min-height: 180px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    color: var(--text);
    resize: vertical;
    line-height: 1.6;
    tab-size: 2;
    transition: border-color var(--transition), box-shadow var(--transition);
}

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

.input-area:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(56, 139, 253, 0.15);
}

.text-input {
    font-family: var(--font-sans);
}

/* Options */
.options-row {
    display: flex;
    gap: 12px;
    margin-top: 14px;
    flex-wrap: wrap;
}

.option-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 120px;
}

.option-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    font-weight: 600;
}

.option-group select,
.option-group input[type="text"] {
    padding: 8px 10px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 0.82rem;
    transition: border-color var(--transition);
}

.option-group select:focus,
.option-group input:focus {
    outline: none;
    border-color: var(--border-focus);
}

.option-group select option {
    background: var(--bg-card);
}

.check-group {
    justify-content: flex-end;
    flex: none;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    color: var(--text-secondary);
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--yellow);
}

.style-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
}

.style-row select {
    flex: 1;
    padding: 8px 10px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 0.82rem;
}

.style-row select:focus {
    outline: none;
    border-color: var(--border-focus);
}

.style-row select option {
    background: var(--bg-card);
}

/* Generate Button */
.btn-generate {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px;
    margin-top: 16px;
    background: linear-gradient(135deg, var(--green), #238636);
    border: none;
    border-radius: var(--radius-sm);
    color: #fff;
    font-family: var(--font-sans);
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition);
    box-shadow: 0 2px 12px rgba(63, 185, 80, 0.2);
}

.btn-generate:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(63, 185, 80, 0.3);
}

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

/* Output */
.commit-output {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--green);
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.6;
    min-height: 60px;
}

.output-meta {
    margin-top: 10px;
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.meta-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.72rem;
    font-weight: 600;
}

.meta-tag.type {
    background: var(--blue-dim);
    color: var(--blue);
}

.meta-tag.scope {
    background: var(--purple);
    color: #fff;
    background: rgba(188, 140, 255, 0.15);
    color: var(--purple);
}

.meta-tag.breaking {
    background: var(--red-dim);
    color: var(--red);
}

.btn-copy {
    padding: 6px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}

.btn-copy:hover {
    border-color: var(--green);
    color: var(--green);
    background: var(--green-dim);
}

/* History */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 300px;
    overflow-y: auto;
}

.history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
}

.history-item:hover {
    border-color: var(--border-hover);
    background: var(--bg-hover);
}

.history-msg {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.history-time {
    font-size: 0.7rem;
    color: var(--text-muted);
    flex-shrink: 0;
    margin-left: 12px;
}

.btn-clear-history {
    padding: 4px 10px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-family: var(--font-sans);
    font-size: 0.72rem;
    cursor: pointer;
    transition: all var(--transition);
}

.btn-clear-history:hover {
    border-color: var(--red);
    color: var(--red);
}

/* Footer */
.footer {
    text-align: center;
    margin-top: 16px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Toast */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(80px);
    background: var(--bg-card);
    border: 1px solid var(--green);
    border-radius: var(--radius-sm);
    padding: 10px 20px;
    font-size: 0.82rem;
    color: var(--green);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    pointer-events: none;
    z-index: 100;
}

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

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

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

.card {
    animation: fadeIn 0.35s ease-out;
}

/* Responsive */
@media (max-width: 520px) {
    .app {
        padding: 16px 10px 32px;
    }

    .options-row {
        flex-direction: column;
    }

    .header-title {
        font-size: 1.1rem;
    }
}