/* Base Reset and Variables */
:root {
    --bg-primary: #0f111a;
    --bg-secondary: rgba(255, 255, 255, 0.03);
    --bg-tertiary: rgba(255, 255, 255, 0.06);
    --border-color: rgba(255, 255, 255, 0.1);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-glow: rgba(139, 92, 246, 0.5);
    
    --gradient-1: #8b5cf6;
    --gradient-2: #ec4899;
    --gradient-3: #3b82f6;

    --font-heading: 'Inter', sans-serif;
    --font-body: 'Inter', sans-serif;
    
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: var(--font-body);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

/* Dynamic Background Effect */
.bg-gradient {
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 50% 50%, rgba(139, 92, 246, 0.15), transparent 40%),
                radial-gradient(circle at 80% 20%, rgba(236, 72, 153, 0.1), transparent 30%),
                radial-gradient(circle at 20% 80%, rgba(59, 130, 246, 0.15), transparent 40%);
    animation: drift 20s ease-in-out infinite alternate;
    z-index: -1;
    pointer-events: none;
}

@keyframes drift {
    0% { transform: scale(1) translate(0, 0); }
    100% { transform: scale(1.1) translate(-2%, -2%); }
}

/* Layout */
.app-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    min-height: 100vh;
}

.main-grid {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 2rem;
    align-items: start;
    flex: 1;
}

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

/* Glassmorphism Panel */
.glass-panel {
    background: var(--bg-secondary);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transition: var(--transition);
}

.glass-panel:hover {
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 0 30px rgba(139, 92, 246, 0.1), 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

/* Typography & Header */
.header {
    text-align: center;
    padding: 2rem;
}

.logo {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 0.5rem;
}

.gradient-text {
    background: linear-gradient(135deg, var(--gradient-1), var(--gradient-2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

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

.panel-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

/* Forms and Inputs */
.form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: var(--transition);
}

.form-group:focus-within label {
    color: var(--gradient-1);
}

input[type="text"], select, textarea {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.8rem 1rem;
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: 1rem;
    transition: var(--transition);
    outline: none;
}

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

input:focus, select:focus, textarea:focus {
    border-color: var(--gradient-1);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2);
    background: rgba(0, 0, 0, 0.4);
}

/* Dropdown styling */
select option {
    background-color: #1e2130;
    color: #fff;
    padding: 10px;
}

/* Buttons */
.btn-primary, .btn-secondary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 1rem 1.5rem;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    margin-top: 1rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--gradient-1), var(--gradient-3));
    color: white;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(139, 92, 246, 0.6);
}

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

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    width: auto;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Loaders and States */
.hidden { display: none !important; }

.loader {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

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

.error-message {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
    padding: 1rem;
    border-radius: var(--radius-sm);
    text-align: center;
    font-size: 0.9rem;
}

/* Right Panel: Tabs and Content Display */
.output-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.placeholder-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    flex: 1;
    color: var(--text-secondary);
    min-height: 400px;
    gap: 1.5rem;
}

.placeholder-icon {
    color: var(--border-color);
    animation: pulse 3s infinite alternate;
}

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

.tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.tab-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.tab-btn.active {
    background: rgba(139, 92, 246, 0.2);
    color: var(--text-primary);
    box-shadow: inset 0 0 0 1px rgba(139, 92, 246, 0.5);
}

.tab-content {
    display: none;
    animation: fadeIn 0.4s ease forwards;
}

.tab-content.active {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Preview Styles */
.preview-item {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.badge {
    align-self: flex-start;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

.preview-title {
    font-size: 2rem;
    color: #fff;
}

.meta-preview {
    background: rgba(0, 0, 0, 0.2);
    padding: 1rem;
    border-left: 3px solid var(--gradient-1);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.meta-preview strong {
    color: #8ab4f8; /* Google-link-like color for meta title */
    display: block;
    margin-bottom: 0.3rem;
    font-size: 1.1rem;
}
.meta-preview p { color: #bdc1c6; font-size: 0.9rem; }

.html-preview-box {
    background: #ffffff; /* White bg makes html pop clearly */
    color: #1a1a1a;
    padding: 1.5rem;
    border-radius: var(--radius-sm);
    overflow-x: auto;
}

.html-preview-box h1 { font-size: 1.8rem; margin-bottom: 1rem; color: #000; }
.html-preview-box p { margin-bottom: 1rem; }
.html-preview-box ul { padding-left: 2rem; margin-bottom: 1rem; }

.faq-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.faq-item {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 1.2rem;
}
.faq-q {
    font-weight: 600;
    color: #fff;
    margin-bottom: 0.5rem;
    display: flex;
    gap: 0.5rem;
}
.faq-q::before { content: "Q:"; color: var(--gradient-2); }
.faq-a { color: var(--text-secondary); display: flex; gap: 0.5rem;}
.faq-a::before { content: "A:"; color: var(--gradient-3); font-weight: 600; }

/* JSON Code Box */
#jsonTab {
    position: relative;
}

.copy-btn {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
}

.json-code {
    display: block;
    background: #0d1117;
    padding: 1.5rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    font-family: monospace;
    font-size: 0.9rem;
    color: #e6edf3;
    overflow-x: auto;
    white-space: pre-wrap;
    max-height: 600px;
    overflow-y: auto;
}
