/* assets/text-generator.css - TechResider AI Text Generator Studio */
:root {
    --bg-dark: #070913;
    --bg-card: rgba(15, 21, 37, 0.75);
    --bg-card-solid: #0f1525;
    --bg-card-hover: rgba(22, 30, 52, 0.85);
    --border: #1e2d45;
    --border-glow: rgba(99, 102, 241, 0.4);
    --text: #f1f5f9;
    --muted: #94a3b8;
    --muted-dark: #475569;
    
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-light: #818cf8;
    --secondary: #a78bfa;
    --pink: #ec4899;
    --cyan: #06b6d4;
    --green: #10b981;
    --amber: #f59e0b;
    --red: #ef4444;

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.6);
    --shadow-glow: 0 0 25px rgba(99, 102, 241, 0.25);
    --radius: 16px;
    --radius-sm: 10px;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-image: 
        radial-gradient(ellipse 80% 60% at 50% -20%, rgba(99, 102, 241, 0.18) 0%, transparent 60%),
        radial-gradient(ellipse 40% 40% at 90% 20%, rgba(167, 139, 250, 0.12) 0%, transparent 50%),
        radial-gradient(ellipse 50% 50% at 10% 80%, rgba(6, 182, 212, 0.08) 0%, transparent 50%);
    background-attachment: fixed;
    line-height: 1.6;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 7px;
    height: 7px;
}
::-webkit-scrollbar-track {
    background: var(--bg-dark);
}
::-webkit-scrollbar-thumb {
    background: #1e293b;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* Navigation Bar */
nav.tg-nav {
    background: rgba(10, 14, 29, 0.85);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 0 24px;
}
.nav-inner {
    max-width: 1440px;
    margin: 0 auto;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.nav-left, .nav-right {
    display: flex;
    align-items: center;
    gap: 16px;
}
.nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}
.nav-logo {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, var(--primary), var(--pink));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 19px;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.4);
}
.nav-title {
    font-size: 17px;
    font-weight: 800;
    background: linear-gradient(90deg, var(--primary-light), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.3px;
}
.nav-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--muted);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid transparent;
    transition: var(--transition);
}
.nav-back:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--border);
}

.badge-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 30px;
    font-size: 13px;
    font-weight: 600;
    backdrop-filter: blur(8px);
}
.badge-tokens {
    background: rgba(99, 102, 241, 0.12);
    border: 1px solid rgba(99, 102, 241, 0.3);
    color: #a5b4fc;
}
.badge-cost {
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: #fcd34d;
}
.badge-user {
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #6ee7b7;
}

/* Header Container */
.app-header {
    text-align: center;
    max-width: 900px;
    margin: 32px auto 24px;
    padding: 0 20px;
}
.app-title-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    border-radius: 20px;
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.15), rgba(236, 72, 153, 0.15));
    border: 1px solid rgba(99, 102, 241, 0.3);
    font-size: 13px;
    font-weight: 600;
    color: var(--primary-light);
    margin-bottom: 14px;
}
.app-header h1 {
    font-size: 2.5rem;
    font-weight: 900;
    letter-spacing: -1px;
    line-height: 1.2;
    margin-bottom: 12px;
    background: linear-gradient(135deg, #ffffff 30%, #a5b4fc 70%, #ec4899 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.app-header p {
    font-size: 1.05rem;
    color: var(--muted);
    max-width: 680px;
    margin: 0 auto;
}

/* Main Grid Layout */
.app-container {
    max-width: 1440px;
    width: 100%;
    margin: 0 auto 40px;
    padding: 0 24px;
    display: grid;
    grid-template-columns: 460px 1fr;
    gap: 28px;
    align-items: start;
}
@media (max-width: 1100px) {
    .app-container {
        grid-template-columns: 1fr;
    }
}

/* Glass Card */
.glass-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}
.glass-card:hover {
    border-color: rgba(99, 102, 241, 0.35);
}

/* Control Panel Section Header */
.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.section-head h2 {
    font-size: 1.15rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
}
.section-head h2 span {
    font-size: 1.3rem;
}

/* Form Elements */
.form-group {
    margin-bottom: 20px;
}
.form-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.85rem;
    font-weight: 600;
    color: #cbd5e1;
    margin-bottom: 8px;
}
.form-label-hint {
    font-size: 0.75rem;
    color: var(--muted);
    font-weight: 400;
}

.select-input, .text-input, .textarea-input {
    width: 100%;
    background: rgba(10, 14, 29, 0.7);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    color: var(--text);
    font-family: inherit;
    font-size: 0.95rem;
    transition: var(--transition);
    outline: none;
}
.select-input:focus, .text-input:focus, .textarea-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
    background: rgba(15, 21, 37, 0.95);
}

.textarea-container {
    position: relative;
}
.textarea-input {
    min-height: 140px;
    resize: vertical;
    line-height: 1.6;
}
.textarea-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 0.78rem;
    color: var(--muted);
}
.counter-badge {
    background: rgba(255, 255, 255, 0.05);
    padding: 2px 8px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    text-decoration: none;
}
.btn-primary {
    background: linear-gradient(135deg, var(--primary), #4338ca);
    color: #ffffff;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.35);
}
.btn-primary:hover {
    background: linear-gradient(135deg, #4f46e5, #3730a3);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
    transform: translateY(-1px);
}
.btn-primary:active {
    transform: translateY(0);
}
.btn-secondary {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
    border: 1px solid var(--border);
}
.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(99, 102, 241, 0.4);
}
.btn-accent {
    background: linear-gradient(135deg, #ec4899, #c026d3);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(236, 72, 153, 0.3);
}
.btn-accent:hover {
    background: linear-gradient(135deg, #db2777, #a21caf);
    transform: translateY(-1px);
}
.btn-full {
    width: 100%;
}
.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
    border-radius: 6px;
}
.btn-icon {
    padding: 8px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--muted);
    border: 1px solid var(--border);
    cursor: pointer;
}
.btn-icon:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary-light);
}

/* Preset Pills */
.presets-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}
.preset-chip {
    padding: 6px 12px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    color: #cbd5e1;
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.preset-chip:hover {
    background: rgba(99, 102, 241, 0.15);
    border-color: rgba(99, 102, 241, 0.4);
    color: #ffffff;
    transform: translateY(-1px);
}

/* Accordion Advanced Options */
.accordion-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 12px;
}
.accordion-toggle:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(99, 102, 241, 0.3);
}
.accordion-toggle .chevron {
    transition: transform 0.3s ease;
}
.accordion-toggle.active .chevron {
    transform: rotate(180deg);
}
.accordion-content {
    display: none;
    padding: 16px;
    background: rgba(10, 14, 29, 0.5);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
}
.accordion-content.show {
    display: block;
}

/* Parameter Grid */
.param-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}
@media (max-width: 500px) {
    .param-grid {
        grid-template-columns: 1fr;
    }
}

/* Slider Controls */
.slider-container {
    display: flex;
    align-items: center;
    gap: 12px;
}
.range-slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: #1e293b;
    border-radius: 3px;
    outline: none;
}
.range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.5);
    transition: var(--transition);
}
.range-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}
.slider-val {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--primary-light);
    min-width: 32px;
    text-align: right;
}

/* Output Workspace */
.workspace-card {
    min-height: 580px;
    display: flex;
    flex-direction: column;
}

.workspace-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}
.workspace-tabs {
    display: flex;
    background: rgba(10, 14, 29, 0.7);
    padding: 4px;
    border-radius: 10px;
    border: 1px solid var(--border);
}
.tab-btn {
    padding: 6px 14px;
    border-radius: 7px;
    border: none;
    background: transparent;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}
.tab-btn.active {
    background: var(--primary);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.workspace-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* Refactor Bar */
.refactor-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow-x: auto;
    padding: 10px 12px;
    background: rgba(10, 14, 29, 0.6);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
}
.refactor-btn {
    white-space: nowrap;
    padding: 5px 11px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    color: #cbd5e1;
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.refactor-btn:hover {
    background: rgba(99, 102, 241, 0.15);
    border-color: rgba(99, 102, 241, 0.4);
    color: #ffffff;
}

/* Output Display Area */
.output-body {
    flex: 1;
    background: rgba(10, 14, 29, 0.5);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 20px;
    min-height: 380px;
    position: relative;
    overflow-y: auto;
    max-height: 600px;
}
.output-content {
    font-size: 0.98rem;
    line-height: 1.75;
    color: #e2e8f0;
}
.output-content h1, .output-content h2, .output-content h3, .output-content h4 {
    color: #ffffff;
    margin-top: 1.4em;
    margin-bottom: 0.6em;
    font-weight: 700;
}
.output-content h1 { font-size: 1.6rem; border-bottom: 1px solid var(--border); padding-bottom: 6px; }
.output-content h2 { font-size: 1.35rem; }
.output-content h3 { font-size: 1.15rem; }
.output-content p { margin-bottom: 1.2em; }
.output-content ul, .output-content ol { margin-left: 20px; margin-bottom: 1.2em; }
.output-content li { margin-bottom: 6px; }
.output-content blockquote {
    border-left: 4px solid var(--primary);
    padding-left: 16px;
    margin: 1.2em 0;
    color: #94a3b8;
    font-style: italic;
    background: rgba(99, 102, 241, 0.05);
    padding-top: 8px;
    padding-bottom: 8px;
    border-radius: 0 8px 8px 0;
}
.output-content code {
    background: rgba(255, 255, 255, 0.08);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 0.88em;
    color: var(--pink);
}
.output-content pre {
    background: #090d18;
    border: 1px solid var(--border);
    padding: 16px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 1.2em 0;
}
.output-content pre code {
    background: none;
    padding: 0;
    color: #a5b4fc;
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 320px;
    text-align: center;
    color: var(--muted);
    padding: 40px 20px;
}
.empty-icon {
    width: 64px;
    height: 64px;
    border-radius: 20px;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin-bottom: 16px;
}
.empty-state h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
}
.empty-state p {
    font-size: 0.88rem;
    max-width: 360px;
    line-height: 1.5;
}

/* Loading Skeleton */
.loading-skeleton {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 10px 0;
}
.skeleton-line {
    height: 16px;
    background: linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.09) 50%, rgba(255,255,255,0.03) 75%);
    background-size: 200% 100%;
    animation: skeletonWave 1.5s infinite;
    border-radius: 4px;
}
@keyframes skeletonWave {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Metrics Footer */
.workspace-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 14px;
    margin-top: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 0.8rem;
    color: var(--muted);
    flex-wrap: wrap;
    gap: 12px;
}
.metrics-group {
    display: flex;
    align-items: center;
    gap: 16px;
}
.metric-item {
    display: flex;
    align-items: center;
    gap: 6px;
}
.metric-item strong {
    color: var(--text);
}

/* History Drawer */
.history-section {
    max-width: 1440px;
    width: 100%;
    margin: 0 auto 60px;
    padding: 0 24px;
}
.history-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
    margin-top: 16px;
}
.history-card {
    background: rgba(15, 21, 37, 0.6);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px;
    transition: var(--transition);
    cursor: pointer;
}
.history-card:hover {
    border-color: rgba(99, 102, 241, 0.4);
    background: rgba(22, 30, 52, 0.8);
    transform: translateY(-2px);
}
.history-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--muted);
    margin-bottom: 8px;
}
.history-model {
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary-light);
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
}
.history-prompt {
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--text);
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.history-preview {
    font-size: 0.8rem;
    color: var(--muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.toast {
    background: var(--bg-card-solid);
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
    color: var(--text);
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideInRight 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.toast-success { border-left-color: var(--green); }
.toast-error { border-left-color: var(--red); }
@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Responsive Overrides */
@media (max-width: 768px) {
    nav.tg-nav { padding: 0 16px; }
    .nav-title { font-size: 15px; }
    .app-header h1 { font-size: 1.8rem; }
    .app-container { padding: 0 16px; }
    .glass-card { padding: 16px; }
    .workspace-header { flex-direction: column; align-items: stretch; }
    .workspace-actions { justify-content: space-between; }
}
