:root {
    --bg-color: #0f172a;
    --panel-bg: rgba(30, 41, 59, 0.7);
    --panel-border: rgba(255, 255, 255, 0.1);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-color: #6366f1;
    --accent-hover: #4f46e5;
    --accent-light: rgba(99, 102, 241, 0.2);
    --error-color: #ef4444;
    --success-color: #10b981;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    background-image: 
        radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(236, 72, 153, 0.1) 0px, transparent 50%);
    background-attachment: fixed;
}

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

/* Header */
.app-header {
    text-align: center;
    margin-bottom: 3rem;
}

.logo {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -1px;
    background: linear-gradient(135deg, #a5b4fc, #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

.sparkle {
    -webkit-text-fill-color: initial;
    display: inline-block;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.8; }
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Main Layout */
.app-main {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 2rem;
}

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

/* Glass Panels */
.glass-panel {
    background: var(--panel-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--panel-border);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

/* Form Styles */
.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 0.95rem;
    color: #cbd5e1;
}

textarea {
    width: 100%;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    color: var(--text-primary);
    padding: 1rem;
    font-family: inherit;
    font-size: 1rem;
    resize: vertical;
    transition: all 0.3s ease;
}

textarea:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px var(--accent-light);
}

/* Drag and Drop Zone */
.drop-zone {
    border: 2px dashed var(--panel-border);
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(15, 23, 42, 0.4);
    position: relative;
    overflow: hidden;
}

.drop-zone:hover, .drop-zone.dragover {
    border-color: var(--accent-color);
    background: var(--accent-light);
}

.upload-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    display: inline-block;
}

.highlight {
    color: var(--accent-color);
    font-weight: 600;
}

.file-hint {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

/* Image Preview */
.image-preview {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-color);
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.remove-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.remove-btn:hover {
    background: var(--error-color);
}

/* Buttons */
.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.primary-btn {
    width: 100%;
    background: linear-gradient(135deg, var(--accent-color), #8b5cf6);
    color: white;
    box-shadow: 0 4px 6px -1px rgba(99, 102, 241, 0.4);
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(99, 102, 241, 0.5);
}

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

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

.icon-btn {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Output Panel States */
.output-panel {
    display: flex;
    flex-direction: column;
    min-height: 400px;
    position: relative;
}

.state-view {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.hidden {
    display: none !important;
}

/* Empty & Error States */
#emptyState, #errorState {
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--text-secondary);
}

.empty-illustration {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.error-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.error-message {
    color: var(--error-color);
    font-weight: 600;
    font-size: 1.1rem;
}

.error-details {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    word-break: break-all;
}

/* Loading State */
#loadingState {
    align-items: center;
    justify-content: center;
    text-align: center;
}

.loader {
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top: 4px solid var(--accent-color);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin-bottom: 1.5rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    font-weight: 600;
    font-size: 1.2rem;
    background: linear-gradient(90deg, #fff, var(--accent-color), #fff);
    background-size: 200% auto;
    color: transparent;
    -webkit-background-clip: text;
    background-clip: text;
    animation: shine 2s linear infinite;
}

@keyframes shine {
    to { background-position: 200% center; }
}

.loading-sub {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

/* Result State */
.result-actions {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--panel-border);
}

.markdown-body {
    overflow-y: auto;
    padding-right: 0.5rem;
}

/* Custom Scrollbar */
.markdown-body::-webkit-scrollbar {
    width: 6px;
}

.markdown-body::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.markdown-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

/* Markdown Rendering Styles */
.markdown-body h1, .markdown-body h2, .markdown-body h3 {
    margin-top: 1.5em;
    margin-bottom: 0.5em;
    color: #e2e8f0;
}

.markdown-body h1 { font-size: 1.8rem; border-bottom: 1px solid var(--panel-border); padding-bottom: 0.3em; }
.markdown-body h2 { font-size: 1.5rem; }
.markdown-body h3 { font-size: 1.25rem; }

.markdown-body p { margin-bottom: 1em; }

.markdown-body ul, .markdown-body ol {
    margin-bottom: 1em;
    padding-left: 2em;
}

.markdown-body li { margin-bottom: 0.25em; }

.markdown-body strong { color: #f8fafc; }

.markdown-body code {
    background: rgba(0, 0, 0, 0.3);
    padding: 0.2em 0.4em;
    border-radius: 3px;
    font-family: monospace;
    font-size: 0.9em;
}

/* JSON Structured Rendering */
.json-body {
    overflow-y: auto;
    padding-right: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

#outTitle {
    font-size: 2rem;
    color: var(--text-primary);
    border-bottom: 2px solid var(--accent-light);
    padding-bottom: 0.5rem;
    margin-bottom: 0;
}

.short-desc {
    font-size: 1.1rem;
    color: var(--text-secondary);
    font-style: italic;
    border-left: 4px solid var(--accent-color);
    padding-left: 1rem;
    margin-bottom: 1rem;
}

.content-section {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid var(--panel-border);
}

.content-section h3 {
    margin-top: 0;
    margin-bottom: 1rem;
    color: var(--accent-color);
    font-size: 1.2rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.hashtags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.hashtag {
    background: var(--accent-light);
    color: var(--accent-color);
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
}
