:root {
    --bg-color: #050511;
    --panel-bg: rgba(255, 255, 255, 0.03);
    --panel-border: rgba(255, 255, 255, 0.08);
    --primary: #6366f1;
    --primary-glow: rgba(99, 102, 241, 0.4);
    --secondary: #06b6d4;
    --accent: #f43f5e;
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --font-heading: 'Space Grotesk', sans-serif;
    --font-body: 'Outfit', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: var(--font-body);
    height: 100vh;
    overflow: hidden;
    position: relative;
}

/* Background Animation */
.background-globes {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: -1;
}

.globe {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
}

.globe-1 {
    width: 500px;
    height: 500px;
    background: var(--primary);
    top: -100px;
    left: -100px;
    animation: float 20s infinite ease-in-out;
}

.globe-2 {
    width: 400px;
    height: 400px;
    background: var(--secondary);
    bottom: -50px;
    right: -100px;
    animation: float 15s infinite ease-in-out reverse;
}

.globe-3 {
    width: 300px;
    height: 300px;
    background: var(--accent);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0.2;
}

@keyframes float {

    0%,
    100% {
        transform: translate(0, 0);
    }

    50% {
        transform: translate(30px, 50px);
    }
}

/* Layout */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: 20px;
    max-width: 1600px;
    margin: 0 auto;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--panel-border);
}

.logo {
    display: flex;
    align-items: center;
    gap: 15px;
    font-family: var(--font-heading);
}

.logo i {
    font-size: 1.8rem;
    color: var(--secondary);
}

.logo h1 {
    font-size: 1.8rem;
    font-weight: 700;
}

.highlight {
    color: var(--primary);
    text-shadow: 0 0 15px var(--primary-glow);
}

.api-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: var(--text-muted);
    background: var(--panel-bg);
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid var(--panel-border);
}

.status-indicator {
    width: 8px;
    height: 8px;
    background-color: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 10px #10b981;
}

main {
    display: flex;
    flex: 1;
    gap: 20px;
    overflow: hidden;
    /* Prevent scrolling on main */
    margin-bottom: 80px;
    /* Space for control bar */
}

.panel {
    flex: 1;
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.panel:hover {
    border-color: rgba(255, 255, 255, 0.2);
}

.panel-header {
    padding: 15px 20px;
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--panel-border);
}

.panel-header h2 {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.badge {
    font-size: 0.75rem;
    padding: 4px 8px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
}

.output-badge {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
    display: none;
}

.textarea-wrapper,
.output-wrapper {
    flex: 1;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

textarea {
    flex: 1;
    width: 100%;
    background: transparent;
    border: none;
    padding: 20px;
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.6;
    resize: none;
    outline: none;
}

textarea::placeholder {
    color: rgba(148, 163, 184, 0.3);
}

.output-wrapper {
    padding: 20px;
    overflow-y: auto;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Markdown Styles in Output */
.markdown-body {
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.7;
    color: #e2e8f0;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3 {
    font-family: var(--font-heading);
    color: white;
    margin-top: 1.5em;
    margin-bottom: 0.8em;
}

.markdown-body strong {
    color: var(--secondary);
}

.markdown-body ul,
.markdown-body ol {
    padding-left: 20px;
    margin-bottom: 1em;
}

.markdown-body li {
    margin-bottom: 0.5em;
}

/* Controls Middle (Hidden for now, moved to bottom) */
.controls {
    display: none;
}

/* Control Bar Bottom */
.control-bar {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 1000px;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(20px);
    border: 1px solid var(--panel-border);
    border-radius: 20px;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    z-index: 100;
}

.mode-selector {
    display: flex;
    gap: 10px;
    background: rgba(0, 0, 0, 0.3);
    padding: 5px;
    border-radius: 12px;
}

.mode-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 10px 20px;
    font-family: var(--font-body);
    font-size: 0.9rem;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.mode-btn:hover {
    color: white;
    background: rgba(255, 255, 255, 0.05);
}

.mode-btn.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 0 15px var(--primary-glow);
}

.primary-btn {
    background: linear-gradient(135deg, var(--secondary), var(--primary));
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 12px;
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s;
    box-shadow: 0 0 20px rgba(6, 182, 212, 0.3);
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 25px rgba(6, 182, 212, 0.5);
}

.primary-btn:active {
    transform: translateY(0);
}

/* Loading */
.loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(5, 5, 17, 0.8);
    backdrop-filter: blur(5px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.loader-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.spinner {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.spinner-item {
    width: 15px;
    height: 15px;
    background: var(--primary);
    border-radius: 50%;
    animation: bounce 0.6s infinite alternate;
}

.spinner-item:nth-child(2) {
    background: var(--secondary);
    animation-delay: 0.2s;
}

.spinner-item:nth-child(3) {
    background: var(--accent);
    animation-delay: 0.4s;
}

@keyframes bounce {
    to {
        transform: translateY(-20px);
    }
}

.loading-text {
    font-family: var(--font-heading);
    letter-spacing: 2px;
    text-transform: uppercase;
    font-size: 0.9rem;
    color: var(--text-main);
}

.word-count {
    padding: 10px 20px;
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: right;
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid var(--panel-border);
}

.placeholder-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    opacity: 0.5;
}

.placeholder-state i {
    font-size: 3rem;
    margin-bottom: 20px;
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.2rem;
    transition: color 0.3s;
}

.icon-btn:hover {
    color: white;
}

.actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

#moveToInputBtn {
    font-size: 0.8rem;
    border: 1px solid var(--panel-border);
    padding: 5px 10px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 5px;
}

#moveToInputBtn:hover {
    background: rgba(255, 255, 255, 0.05);
}