/* ============================================
   VALTYK CONTENT ENGINE — Design System
   Premium Dark Theme with Gradient Accents
   ============================================ */

/* === CSS Variables === */
:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: #16161f;
    --bg-card-hover: #1a1a25;
    --bg-input: #1e1e2a;
    --border: #2a2a3a;
    --border-focus: #667eea;
    --text-primary: #f0f0f5;
    --text-secondary: #8888a0;
    --text-muted: #55556a;
    --accent-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --accent-1: #667eea;
    --accent-2: #764ba2;
    --linkedin: #0077b5;
    --facebook: #1877f2;
    --twitter: #1da1f2;
    --instagram: #e4405f;
    --success: #2ecc71;
    --warning: #f39c12;
    --danger: #e74c3c;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 20px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 40px rgba(0,0,0,0.5);
    --shadow-glow: 0 0 30px rgba(102, 126, 234, 0.15);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

html {
    scroll-behavior: smooth;
}

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

/* === Animated Background === */
.bg-grid {
    position: fixed;
    inset: 0;
    background-image: 
        linear-gradient(rgba(102, 126, 234, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(102, 126, 234, 0.03) 1px, transparent 1px);
    background-size: 60px 60px;
    z-index: 0;
    pointer-events: none;
}

.bg-glow {
    position: fixed;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.4;
    z-index: 0;
    pointer-events: none;
    animation: float 20s ease-in-out infinite;
}

.bg-glow-1 {
    width: 500px;
    height: 500px;
    background: var(--accent-1);
    top: -200px;
    right: -100px;
    opacity: 0.08;
}

.bg-glow-2 {
    width: 400px;
    height: 400px;
    background: var(--accent-2);
    bottom: -150px;
    left: -100px;
    opacity: 0.06;
    animation-delay: -10s;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0); }
    33% { transform: translate(30px, -20px); }
    66% { transform: translate(-20px, 30px); }
}

/* === Header === */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 32px;
    background: rgba(10, 10, 15, 0.85);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo-icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-gradient);
    border-radius: var(--radius-md);
    font-size: 22px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.brand-name {
    font-size: 1.2rem;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.brand-tagline {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 400;
}

.stat-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 100px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.stat-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* === Main Layout === */
.main-container {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 420px 1fr;
    gap: 0;
    min-height: calc(100vh - 77px - 50px);
}

/* === Panels === */
.panel {
    padding: 32px;
}

.panel-form {
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    max-height: calc(100vh - 77px - 50px);
}

.panel-results {
    overflow-y: auto;
    max-height: calc(100vh - 77px - 50px);
    display: flex;
    flex-direction: column;
}

.panel-header {
    margin-bottom: 28px;
}

.panel-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.panel-icon {
    font-size: 1.2rem;
}

.panel-subtitle {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* === Form Styles === */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.required {
    color: var(--accent-1);
}

.optional {
    color: var(--text-muted);
    font-weight: 400;
    font-size: 0.75rem;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 0.9rem;
    transition: var(--transition);
    outline: none;
}

.form-group input:focus,
.form-group select:focus {
    border-color: var(--accent-1);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.form-group input::placeholder {
    color: var(--text-muted);
}

.form-group select option {
    background: var(--bg-card);
    color: var(--text-primary);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* === Platform Selector === */
.platform-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.platform-chip {
    cursor: pointer;
}

.platform-chip input {
    display: none;
}

.chip-content {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 100px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    transition: var(--transition);
    user-select: none;
}

.platform-chip input:checked + .chip-content {
    background: rgba(102, 126, 234, 0.15);
    border-color: var(--accent-1);
    color: var(--accent-1);
}

.platform-chip:hover .chip-content {
    border-color: var(--accent-1);
}

[data-platform="linkedin"] input:checked + .chip-content {
    background: rgba(0, 119, 181, 0.15);
    border-color: var(--linkedin);
    color: var(--linkedin);
}

[data-platform="facebook"] input:checked + .chip-content {
    background: rgba(24, 119, 242, 0.15);
    border-color: var(--facebook);
    color: var(--facebook);
}

[data-platform="twitter"] input:checked + .chip-content {
    background: rgba(29, 161, 242, 0.15);
    border-color: var(--twitter);
    color: var(--twitter);
}

[data-platform="instagram"] input:checked + .chip-content {
    background: rgba(228, 64, 95, 0.15);
    border-color: var(--instagram);
    color: var(--instagram);
}

/* === Generate Button === */
.btn-generate {
    width: 100%;
    padding: 16px 24px;
    background: var(--accent-gradient);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-family: var(--font);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    margin-top: 8px;
}

.btn-generate:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.35);
}

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

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

.btn-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* === AI Idea Generator === */
.idea-generator-section {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.08), rgba(118, 75, 162, 0.08));
    border: 1px solid rgba(102, 126, 234, 0.2);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 8px;
}

.idea-header {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.idea-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.btn-ideas {
    width: 100%;
    padding: 12px 20px;
    background: linear-gradient(135deg, #f39c12, #e74c3c);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-family: var(--font);
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.btn-ideas:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(243, 156, 18, 0.35);
}

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

.btn-ideas-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.spinner-small {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: inline-block;
}

.ideas-container {
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.idea-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    cursor: pointer;
    transition: var(--transition);
    animation: slideUp 0.4s ease forwards;
    opacity: 0;
}

.idea-card:hover {
    border-color: var(--accent-1);
    background: var(--bg-card-hover);
    transform: translateX(4px);
    box-shadow: var(--shadow-glow);
}

.idea-card.selected {
    border-color: var(--success);
    background: rgba(46, 204, 113, 0.08);
}

.idea-card-number {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--accent-1);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 4px;
}

.idea-card-title {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
    line-height: 1.4;
}

.idea-card-hook {
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-style: italic;
    margin-bottom: 8px;
    line-height: 1.4;
}

.idea-card-meta {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.idea-tag {
    padding: 3px 8px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 100px;
    font-size: 0.65rem;
    color: var(--accent-1);
    font-weight: 500;
}

.idea-tag.viral {
    background: rgba(243, 156, 18, 0.12);
    color: var(--warning);
}

.idea-use-hint {
    font-size: 0.7rem;
    color: var(--success);
    font-weight: 600;
    margin-top: 6px;
    opacity: 0;
    transition: var(--transition);
}

.idea-card:hover .idea-use-hint {
    opacity: 1;
}

/* === Divider === */
.divider-or {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 8px 0 20px;
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.divider-or::before,
.divider-or::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* === Empty State === */
.empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 60px 40px;
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    animation: float 3s ease-in-out infinite;
}

.empty-state h3 {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.empty-state p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    max-width: 400px;
    line-height: 1.6;
}

.empty-features {
    display: flex;
    gap: 8px;
    margin-top: 24px;
    flex-wrap: wrap;
    justify-content: center;
}

.feature-tag {
    padding: 6px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 100px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* === Loading State === */
.loading-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 60px 40px;
}

.loader-orb {
    position: relative;
    width: 100px;
    height: 100px;
    margin-bottom: 30px;
}

.orb-ring {
    position: absolute;
    inset: 0;
    border: 3px solid transparent;
    border-top-color: var(--accent-1);
    border-right-color: var(--accent-2);
    border-radius: 50%;
    animation: spin 1.5s linear infinite;
}

.orb-core {
    position: absolute;
    inset: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    background: var(--bg-card);
    border-radius: 50%;
}

.loading-state h3 {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 8px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.loading-sub {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 24px;
}

.loading-progress {
    width: 260px;
    height: 4px;
    background: var(--bg-card);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: var(--accent-gradient);
    border-radius: 4px;
    transition: width 0.5s ease;
}

/* === Results === */
.results-content {
    padding: 0;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.results-meta {
    display: flex;
    gap: 8px;
}

.meta-tag {
    padding: 4px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 100px;
    font-size: 0.72rem;
    color: var(--text-muted);
}

.results-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 24px;
}

/* === Platform Cards === */
.platform-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: var(--transition);
    animation: slideUp 0.5s ease forwards;
    opacity: 0;
}

.platform-card:hover {
    border-color: rgba(102, 126, 234, 0.3);
    box-shadow: var(--shadow-glow);
}

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

.card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.card-header h3 {
    flex: 1;
    font-size: 0.95rem;
    font-weight: 600;
}

.platform-badge {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    font-size: 1.1rem;
}

.badge-linkedin { background: rgba(0, 119, 181, 0.15); }
.badge-facebook { background: rgba(24, 119, 242, 0.15); }
.badge-twitter { background: rgba(29, 161, 242, 0.15); }
.badge-instagram { background: rgba(228, 64, 95, 0.15); }
.badge-image { background: rgba(255, 215, 0, 0.15); }

.btn-copy {
    padding: 6px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 100px;
    color: var(--text-secondary);
    font-family: var(--font);
    font-size: 0.75rem;
    cursor: pointer;
    transition: var(--transition);
}

.btn-copy:hover {
    border-color: var(--accent-1);
    color: var(--accent-1);
}

.card-body {
    padding: 20px;
}

.card-body .post-content {
    font-size: 0.88rem;
    line-height: 1.7;
    color: var(--text-primary);
    white-space: pre-wrap;
}

.card-body .hashtags {
    margin-top: 12px;
    font-size: 0.8rem;
    color: var(--accent-1);
    opacity: 0.8;
}

.thread-tweets {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tweet-item {
    padding: 14px 16px;
    background: var(--bg-input);
    border-radius: var(--radius-md);
    border-left: 3px solid var(--twitter);
    font-size: 0.85rem;
    line-height: 1.5;
}

.tweet-number {
    font-size: 0.7rem;
    color: var(--twitter);
    font-weight: 700;
    margin-bottom: 4px;
}

/* === Image Prompt Card === */
.image-prompt-card {
    background: var(--bg-card);
    border: 1px solid rgba(255, 215, 0, 0.2);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 24px;
    animation: slideUp 0.5s ease 0.4s forwards;
    opacity: 0;
}

.image-prompt-text {
    padding: 20px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-style: italic;
    line-height: 1.6;
}

/* === New Content Button === */
.btn-new {
    width: 100%;
    padding: 14px 24px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-new:hover {
    border-color: var(--accent-1);
    background: rgba(102, 126, 234, 0.1);
}

/* === Toast === */
.toast {
    position: fixed;
    bottom: -60px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: var(--bg-card);
    border: 1px solid var(--success);
    border-radius: 100px;
    font-size: 0.85rem;
    color: var(--success);
    box-shadow: var(--shadow-lg);
    transition: bottom 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
}

.toast.show {
    bottom: 30px;
}

/* === Footer === */
.footer {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 16px;
    border-top: 1px solid var(--border);
    font-size: 0.75rem;
    color: var(--text-muted);
}

.footer a {
    color: var(--accent-1);
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}

/* === Responsive === */
@media (max-width: 900px) {
    .main-container {
        grid-template-columns: 1fr;
    }
    
    .panel-form {
        border-right: none;
        border-bottom: 1px solid var(--border);
        max-height: none;
    }
    
    .panel-results {
        max-height: none;
        min-height: 400px;
    }
    
    .header {
        padding: 12px 16px;
    }
    
    .panel {
        padding: 20px 16px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
}

/* === Scrollbar === */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* === DALL-E Image Generator Button === */
.btn-generate-image {
    width: 100%;
    margin-top: 16px;
    padding: 14px 24px;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 50%, #ffd86f 100%);
    background-size: 200% 200%;
    border: none;
    border-radius: var(--radius-md);
    color: #fff;
    font-family: var(--font);
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    letter-spacing: 0.3px;
    animation: shimmerGradient 3s ease infinite;
}

@keyframes shimmerGradient {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.btn-generate-image:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(245, 87, 108, 0.4);
}

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

.image-gen-card {
    border-color: rgba(245, 87, 108, 0.3) !important;
}

.image-gen-card:hover {
    border-color: rgba(245, 87, 108, 0.5) !important;
    box-shadow: 0 0 20px rgba(245, 87, 108, 0.1);
}
