@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap');

/* || Design Tokens || */
:root {
    --bg:            #050711;
    --surface:       rgba(12, 15, 26, 0.85);
    --surface-hover: rgba(255, 255, 255, 0.03);
    --border:        rgba(255, 255, 255, 0.08);
    --border-hover:  rgba(255, 255, 255, 0.15);

    --primary:       #6366f1;
    --primary-2:     #818cf8;
    --accent:        #a855f7;
    --glow-primary:  rgba(99, 102, 241, 0.35);
    --glow-accent:   rgba(168, 85, 247, 0.25);

    --green:         #10b981;
    --red:           #ef4444;

    --text:          #e2e8f0;
    --text-dim:      #64748b;
    --text-muted:    #334155;

    --font:          'Inter', system-ui, sans-serif;
    --font-display:  'Outfit', system-ui, sans-serif;

    --radius-sm:     8px;
    --radius:        16px;
    --radius-lg:     24px;
    --radius-xl:     32px;
}

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

/* || Base || */
html { scroll-behavior: smooth; }

body {
    background-color: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem 4rem;
    overflow-x: hidden;
}

/* || Animated Background Orbs || */
.bg-orbs {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
    animation: drift 20s ease-in-out infinite alternate;
}

.orb-1 {
    width: 600px; height: 600px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.5), transparent 70%);
    top: -200px; left: -200px;
    animation-duration: 18s;
}

.orb-2 {
    width: 500px; height: 500px;
    background: radial-gradient(circle, rgba(168, 85, 247, 0.4), transparent 70%);
    bottom: -150px; right: -150px;
    animation-duration: 22s;
    animation-delay: -8s;
}

.orb-3 {
    width: 300px; height: 300px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.3), transparent 70%);
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    animation-duration: 25s;
    animation-delay: -4s;
}

@keyframes drift {
    from { transform: translate(0, 0) scale(1); }
    to   { transform: translate(40px, 30px) scale(1.1); }
}

/* || App Container || */
.app-container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 780px;
    background: var(--surface);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 2.5rem;
    box-shadow:
        0 0 0 1px rgba(255,255,255,0.04) inset,
        0 40px 80px -20px rgba(0, 0, 0, 0.6),
        0 0 60px -20px var(--glow-primary);
}

/* || Header || */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

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

.logo-icon {
    width: 50px; height: 50px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 14px;
    display: grid;
    place-items: center;
    font-size: 1.4rem;
    color: white;
    box-shadow: 0 4px 16px var(--glow-primary);
}

.logo-text h1 {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.4rem;
    background: linear-gradient(120deg, #fff 30%, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1.1;
}

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

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

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.85rem;
    border-radius: 99px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.badge-green {
    background: rgba(16, 185, 129, 0.1);
    color: var(--green);
    border: 1px solid rgba(16, 185, 129, 0.25);
}

.badge-purple {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary-2);
    border: 1px solid rgba(99, 102, 241, 0.25);
}

/* || Tabs || */
.tabs {
    display: flex;
    position: relative;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 5px;
    margin-bottom: 1.5rem;
}

.tab-btn {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-dim);
    padding: 0.75rem 1rem;
    cursor: pointer;
    font-family: var(--font);
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    position: relative;
    z-index: 1;
    transition: color 0.25s ease;
    border-radius: var(--radius-sm);
}

.tab-btn.active { color: #fff; }

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

.tab-indicator {
    position: absolute;
    top: 5px; left: 5px;
    width: calc(50% - 5px);
    height: calc(100% - 10px);
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: var(--radius-sm);
    box-shadow: 0 4px 16px var(--glow-primary);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* || Input Card || */
.input-card {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.textarea-wrapper { position: relative; }

textarea {
    width: 100%;
    height: 210px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    color: var(--text);
    font-family: var(--font);
    font-size: 0.95rem;
    line-height: 1.65;
    resize: vertical;
    outline: none;
    transition: border-color 0.25s, box-shadow 0.25s;
}

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

textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.12);
}

.char-count {
    position: absolute;
    bottom: 10px; right: 14px;
    font-size: 0.72rem;
    color: var(--text-muted);
}

/* || Primary Button || */
.primary-btn {
    width: 100%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    border: none;
    color: #fff;
    padding: 1rem 1.5rem;
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s;
    box-shadow: 0 4px 20px var(--glow-primary);
    letter-spacing: 0.01em;
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px var(--glow-primary);
}

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

.primary-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
}

.btn-content {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* || Progress Section || */
.progress-section {
    margin-top: 1.5rem;
    background: rgba(99, 102, 241, 0.05);
    border: 1px solid rgba(99, 102, 241, 0.15);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    animation: slideIn 0.3s ease;
}

.progress-top {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.progress-icon {
    width: 40px; height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: grid;
    place-items: center;
    color: white;
    font-size: 1.1rem;
    flex-shrink: 0;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 var(--glow-primary); }
    50%       { box-shadow: 0 0 0 8px transparent; }
}

.progress-labels {
    flex: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
}

.pct {
    font-weight: 600;
    color: var(--primary-2);
}

.progress-bar-track {
    height: 6px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 99px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(to right, var(--primary), var(--accent));
    border-radius: 99px;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 8px var(--glow-primary);
}

.progress-note {
    margin-top: 0.85rem;
    font-size: 0.75rem;
    color: var(--text-dim);
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

/* || Output Section || */
.output-section {
    margin-top: 1.5rem;
    animation: slideIn 0.4s ease;
}

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

.output-title {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.icon-btn {
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border);
    color: var(--text-dim);
    width: 36px; height: 36px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: grid;
    place-items: center;
    font-size: 1rem;
    transition: all 0.2s;
}

.icon-btn:hover {
    background: rgba(255,255,255,0.09);
    color: white;
    border-color: var(--border-hover);
}

/* || Markdown Output || */
.markdown-body {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    color: var(--text);
    line-height: 1.75;
    font-size: 0.95rem;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3 {
    font-family: var(--font-display);
    font-weight: 700;
    margin: 1.5rem 0 0.75rem;
    color: #fff;
    line-height: 1.3;
}

.markdown-body h2 { font-size: 1.15rem; }
.markdown-body h3 { font-size: 1rem; color: var(--primary-2); }

.markdown-body p       { margin-bottom: 1rem; }
.markdown-body ul,
.markdown-body ol      { padding-left: 1.5rem; margin-bottom: 1rem; }
.markdown-body li      { margin-bottom: 0.4rem; }
.markdown-body strong  { color: #fff; font-weight: 600; }
.markdown-body em      { color: var(--primary-2); }
.markdown-body code    {
    background: rgba(99, 102, 241, 0.12);
    color: var(--primary-2);
    padding: 0.15em 0.4em;
    border-radius: 4px;
    font-size: 0.88em;
}

.markdown-body pre {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1rem;
    overflow-x: auto;
    margin-bottom: 1rem;
}

.markdown-body pre code {
    background: none;
    padding: 0;
    color: #c4b5fd;
}

.markdown-body blockquote {
    border-left: 3px solid var(--primary);
    padding-left: 1rem;
    margin: 1rem 0;
    color: var(--text-dim);
    font-style: italic;
}

/* || Loader Spinner || */
.loader {
    width: 22px; height: 22px;
    border: 2.5px solid rgba(255,255,255,0.25);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* || Footer || */
.app-footer {
    position: relative;
    z-index: 1;
    margin-top: 1.5rem;
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.app-footer a {
    color: var(--primary-2);
    text-decoration: none;
}
.app-footer a:hover { text-decoration: underline; }

/* || Animations || */
@keyframes slideIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* || Utility || */
.hidden { display: none !important; }

/* || Responsive || */
@media (max-width: 640px) {
    .app-container   { padding: 1.5rem 1.25rem; border-radius: var(--radius-lg); }
    .app-header      { flex-direction: column; align-items: flex-start; }
    .header-badges   { flex-wrap: wrap; }
    .logo-text h1    { font-size: 1.2rem; }
    textarea         { height: 170px; }
}
