/* ============================================
   GitHub README Generator — Arctic Blue
   Primary: #3B82F6 | Secondary: #60A5FA
   Accent: #F59E0B | Background: #0A1022
   ============================================ */

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

:root {
    --primary: #3B82F6;
    --primary-glow: rgba(59, 130, 246, 0.15);
    --secondary: #60A5FA;
    --accent: #F59E0B;
    --accent-glow: rgba(245, 158, 11, 0.12);
    --bg: #0A1022;
    --bg-card: #111827;
    --bg-card-hover: #1a2236;
    --bg-input: #0d1520;
    --border: #1e293b;
    --border-focus: #3B82F6;
    --text: #e2e8f0;
    --text-muted: #94a3b8;
    --text-dim: #64748b;
    --success: #34d399;
    --error: #f87171;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-xs: 6px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(59, 130, 246, 0.1);
}

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

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

/* --- Header --- */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(10, 16, 34, 0.85);
    backdrop-filter: blur(16px) saturate(1.8);
    -webkit-backdrop-filter: blur(16px) saturate(1.8);
    border-bottom: 1px solid var(--border);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0.75rem 1.5rem;
}

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

.logo-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary-glow), var(--accent-glow));
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: var(--radius-sm);
    color: var(--primary);
    transition: var(--transition);
}

.logo-icon:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-glow);
}

.logo-title {
    font-size: 1.125rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--text), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
}

.logo-subtitle {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

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

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #2563eb);
    color: white;
    border-color: rgba(59, 130, 246, 0.3);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.25);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.35);
    transform: translateY(-1px);
}

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

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

.btn-ghost:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.05);
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
}

/* --- Main Layout --- */
.main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem;
}

.content-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    align-items: start;
}

/* --- Form Panel --- */
.form-panel {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.form-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: var(--transition);
}

.form-section:hover {
    border-color: rgba(59, 130, 246, 0.15);
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1rem;
    cursor: pointer;
    user-select: none;
    background: rgba(255, 255, 255, 0.02);
    border: none;
    width: 100%;
    transition: var(--transition);
}

.section-header:hover {
    background: rgba(255, 255, 255, 0.04);
}

.section-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-title h2 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text);
}

.section-icon {
    font-size: 1rem;
}

.chevron {
    color: var(--text-dim);
    transition: transform 0.25s ease;
    flex-shrink: 0;
}

.section-header[aria-expanded="false"] .chevron {
    transform: rotate(-90deg);
}

.section-body {
    padding: 0.75rem 1rem 1rem;
    border-top: 1px solid var(--border);
}

.section-body.collapsed {
    display: none;
}

/* --- Form Elements --- */
.form-group {
    margin-bottom: 0.75rem;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 0.375rem;
}

.required {
    color: var(--error);
}

.optional {
    color: var(--text-dim);
    font-weight: 400;
    font-size: 0.6875rem;
}

input[type="text"],
input[type="url"],
textarea,
select {
    width: 100%;
    padding: 0.625rem 0.75rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    color: var(--text);
    font-family: var(--font);
    font-size: 0.8125rem;
    transition: var(--transition);
    outline: none;
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

input::placeholder,
textarea::placeholder {
    color: var(--text-dim);
    opacity: 0.5;
}

textarea {
    resize: vertical;
    min-height: 60px;
}

.code-textarea {
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    tab-size: 2;
}

select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2rem;
}

/* --- Badge / Tech Grid --- */
.badge-grid,
.tech-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
}

.badge-toggle,
.tech-toggle {
    cursor: pointer;
}

.badge-toggle input,
.tech-toggle input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.badge-chip,
.tech-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.625rem;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-dim);
    transition: var(--transition);
}

.badge-toggle input:checked+.badge-chip,
.tech-toggle input:checked+.tech-chip {
    background: var(--primary-glow);
    border-color: rgba(59, 130, 246, 0.3);
    color: var(--secondary);
}

.badge-chip:hover,
.tech-chip:hover {
    border-color: rgba(59, 130, 246, 0.2);
    color: var(--text-muted);
}

/* --- Toggle Row --- */
.toggle-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    color: var(--text-muted);
    cursor: pointer;
}

.toggle-row input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
}

/* --- Preview Panel --- */
.preview-panel {
    position: sticky;
    top: 72px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    max-height: calc(100vh - 96px);
    display: flex;
    flex-direction: column;
}

.preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.02);
    flex-shrink: 0;
}

.preview-tabs {
    display: flex;
    gap: 0.25rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-xs);
    padding: 0.1875rem;
}

.preview-tab {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    background: transparent;
    border: none;
    border-radius: calc(var(--radius-xs) - 2px);
    font-family: var(--font);
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-dim);
    cursor: pointer;
    transition: var(--transition);
}

.preview-tab:hover {
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.05);
}

.preview-tab.active {
    background: rgba(59, 130, 246, 0.15);
    color: var(--secondary);
    box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.2);
}

.preview-body {
    flex: 1;
    overflow-y: auto;
}

.preview-content {
    padding: 1.5rem;
    font-size: 0.875rem;
    line-height: 1.7;
}

.preview-content h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.75rem;
}

.preview-content h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 1.5rem 0 0.75rem;
    color: var(--secondary);
}

.preview-content h3 {
    font-size: 1rem;
    font-weight: 600;
    margin: 1rem 0 0.5rem;
}

.preview-content p {
    margin-bottom: 0.75rem;
    color: var(--text-muted);
}

.preview-content ul,
.preview-content ol {
    margin: 0.5rem 0 0.75rem 1.25rem;
    color: var(--text-muted);
}

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

.preview-content code {
    padding: 0.15rem 0.4rem;
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.15);
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.8em;
    color: var(--secondary);
}

.preview-content pre {
    padding: 1rem;
    margin: 0.75rem 0;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    overflow-x: auto;
}

.preview-content pre code {
    padding: 0;
    background: none;
    border: none;
    font-size: 0.8125rem;
    line-height: 1.6;
    color: var(--text);
}

.preview-content img {
    max-width: 100%;
    border-radius: 4px;
}

.preview-content .badge-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin-bottom: 1rem;
}

.preview-content .badge-row img {
    border-radius: 0;
}

.preview-content .tech-icons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0.5rem 0 1rem;
}

.preview-content .tech-icons img {
    border-radius: 0;
}

.preview-content blockquote {
    border-left: 3px solid var(--primary);
    padding: 0.5rem 1rem;
    margin: 0.75rem 0;
    background: rgba(59, 130, 246, 0.05);
    border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
    color: var(--text-muted);
    font-style: italic;
}

.raw-content {
    padding: 1rem;
    margin: 0;
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--text);
    background: transparent;
}

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

.toast {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    font-size: 0.8125rem;
    color: var(--text);
    animation: toast-in 0.3s ease;
}

.toast.success {
    border-color: rgba(52, 211, 153, 0.3);
}

.toast.error {
    border-color: rgba(248, 113, 113, 0.3);
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

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

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

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

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* --- Responsive --- */
@media (max-width: 900px) {
    .content-grid {
        grid-template-columns: 1fr;
    }

    .preview-panel {
        position: static;
        max-height: 600px;
    }
}

@media (max-width: 540px) {
    .header-inner {
        padding: 0.625rem 1rem;
    }

    .main {
        padding: 1rem;
    }

    .preview-content {
        padding: 1rem;
    }

    .badge-grid,
    .tech-grid {
        gap: 0.25rem;
    }
}