/* ========================================
   README Generator — Crimson Red Dark Theme
   ======================================== */
:root {
    --primary: #D63031;
    --primary-hover: #C0392B;
    --primary-glow: rgba(214, 48, 49, 0.25);
    --secondary: #FF7675;
    --accent: #00B894;
    --accent-glow: rgba(0, 184, 148, 0.2);

    --bg-base: #1A0A0A;
    --bg-surface: #2D1515;
    --bg-elevated: #3D1F1F;
    --bg-input: #251010;
    --bg-hover: #4A2828;

    --text-primary: #FDE8E8;
    --text-secondary: #F0ABAB;
    --text-muted: #BB6B6B;

    --border: rgba(214, 48, 49, 0.15);
    --border-active: rgba(214, 48, 49, 0.4);
    --radius: 12px;
    --radius-sm: 8px;
    --font: 'Inter', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --transition: 200ms ease;
}

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

body {
    font-family: var(--font);
    background: var(--bg-base);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    background-image:
        radial-gradient(ellipse at 20% 0%, rgba(214, 48, 49, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 100%, rgba(0, 184, 148, 0.04) 0%, transparent 50%);
}

::-webkit-scrollbar {
    width: 6px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 3px;
}

.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Header */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo h1 {
    font-size: 1.15rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-actions {
    display: flex;
    gap: 0.5rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.9rem;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}

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

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

.btn-secondary {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

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

.btn-accent {
    background: var(--accent);
    color: #0D0D0D;
    font-weight: 700;
}

.btn-accent:hover {
    box-shadow: 0 4px 12px var(--accent-glow);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover {
    color: var(--text-primary);
}

.btn-sm {
    padding: 0.3rem 0.6rem;
    font-size: 0.78rem;
}

.hidden {
    display: none !important;
}

/* Inputs */
.input {
    font-family: var(--font);
    font-size: 0.85rem;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text-primary);
    outline: none;
    width: 100%;
    transition: border-color var(--transition);
}

.input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

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

.textarea {
    resize: vertical;
    font-family: var(--font);
}

.select {
    cursor: pointer;
}

/* Layout */
.main-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    margin-bottom: 2rem;
    align-items: start;
}

/* Cards */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin-bottom: 0.75rem;
}

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

.card-header h2 {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.form-grid {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.form-group label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.2rem;
}

.form-group.full {
    width: 100%;
}

/* Badges */
.badge-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.5rem;
}

.badge-item {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.5rem;
    border-radius: 16px;
    font-size: 0.72rem;
    font-weight: 600;
    background: var(--bg-elevated);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.badge-item img {
    height: 18px;
    border-radius: 3px;
}

.badge-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.85rem;
}

.badge-form {
    display: flex;
    gap: 0.4rem;
    align-items: center;
}

.badge-form .input {
    width: auto;
    flex: 1;
}

.badge-form .select {
    width: 120px;
    flex-shrink: 0;
}

/* Sections */
.section-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.section-item {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.75rem;
}

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

.section-top h4 {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--secondary);
}

.section-top .section-actions {
    display: flex;
    gap: 0.25rem;
}

.section-textarea {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    min-height: 60px;
    width: 100%;
    padding: 0.5rem;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text-primary);
    resize: vertical;
    outline: none;
}

.section-textarea:focus {
    border-color: var(--primary);
}

.section-add-bar {
    display: flex;
    gap: 0.4rem;
}

.section-add-bar .select {
    flex: 1;
}

/* Preview */
.preview-panel {
    position: sticky;
    top: 1rem;
}

.preview-tabs {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 0.5rem;
}

.preview-tab {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    font-weight: 600;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition);
}

.preview-tab.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.preview-content {
    background: #fff;
    color: #24292e;
    border-radius: var(--radius);
    padding: 1.5rem;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
    font-size: 0.9rem;
    line-height: 1.7;
    overflow: auto;
    max-height: 80vh;
    border: 1px solid var(--border);
}

.preview-content h1 {
    font-size: 1.6rem;
    border-bottom: 1px solid #eee;
    padding-bottom: 0.3rem;
    margin-bottom: 0.75rem;
}

.preview-content h2 {
    font-size: 1.2rem;
    border-bottom: 1px solid #eee;
    padding-bottom: 0.2rem;
    margin: 1.2rem 0 0.5rem;
}

.preview-content h3 {
    font-size: 1rem;
    margin: 1rem 0 0.3rem;
}

.preview-content p {
    margin-bottom: 0.75rem;
}

.preview-content ul,
.preview-content ol {
    margin-bottom: 0.75rem;
    padding-left: 1.5rem;
}

.preview-content li {
    margin-bottom: 0.25rem;
}

.preview-content code {
    background: #f0f0f0;
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    font-family: var(--font-mono);
    font-size: 0.85em;
}

.preview-content pre {
    background: #f6f8fa;
    padding: 1rem;
    border-radius: 6px;
    overflow-x: auto;
    margin-bottom: 0.75rem;
}

.preview-content pre code {
    background: none;
    padding: 0;
}

.preview-content img {
    max-width: 100%;
    height: auto;
}

.preview-content a {
    color: var(--primary);
}

.raw-content {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    line-height: 1.7;
    color: var(--secondary);
    overflow: auto;
    max-height: 80vh;
    margin: 0;
}

.raw-content code {
    white-space: pre-wrap;
}

/* Toast */
.toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    padding: 0.65rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 500;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
    animation: slideIn 0.3s ease, fadeOut 0.3s ease 2.5s forwards;
}

.toast-success {
    background: rgba(0, 184, 148, 0.15);
    color: var(--accent);
    border: 1px solid rgba(0, 184, 148, 0.3);
}

.toast-info {
    background: rgba(214, 48, 49, 0.15);
    color: var(--primary);
    border: 1px solid rgba(214, 48, 49, 0.3);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(40px);
    }

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

@keyframes fadeOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
        pointer-events: none;
    }
}

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

    .preview-panel {
        position: static;
    }
}