/* ═══════════════════════════════════════════════════════════════════════════
   ZYPHERIUS — Generator Styles (Sites & Apps)
   Split-view layout with chat and preview
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─────────────────────────────────────────────────────────────────────────
   BACKGROUND
   ───────────────────────────────────────────────────────────────────────── */
.bg-container {
    position: fixed;
    inset: 0;
    z-index: -1;
    background: var(--bg-primary);
}

.bg-gradient {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 20% 30%, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
                radial-gradient(ellipse at 80% 70%, rgba(139, 92, 246, 0.06) 0%, transparent 50%);
}

/* ─────────────────────────────────────────────────────────────────────────
   APP LAYOUT
   ───────────────────────────────────────────────────────────────────────── */
.app-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ─────────────────────────────────────────────────────────────────────────
   SIDEBAR
   ───────────────────────────────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    height: 100%;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: var(--space-4) var(--space-4);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    text-decoration: none;
}

.logo-icon {
    width: 32px;
    height: 32px;
}

.logo-icon svg {
    width: 100%;
    height: 100%;
}

.logo-text {
    font-size: var(--text-lg);
    font-weight: var(--font-bold);
    color: var(--text-primary);
}

.new-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-lg);
    background: var(--gradient-button);
    color: white;
    transition: all var(--duration-fast) var(--ease-default);
}

.new-btn:hover {
    background: var(--gradient-button-hover);
    transform: scale(1.05);
}

/* Section */
.sidebar-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: var(--space-3);
    overflow: hidden;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-2) var(--space-3);
    margin-bottom: var(--space-2);
}

.section-header span {
    font-size: var(--text-xs);
    font-weight: var(--font-medium);
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Projects List */
.projects-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.project-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-default);
}

.project-item:hover {
    background: var(--bg-hover);
}

.project-item.active {
    background: var(--bg-elevated);
}

.project-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    overflow: hidden;
}

.project-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.project-info {
    flex: 1;
    min-width: 0;
}

.project-name {
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.project-date {
    font-size: var(--text-xs);
    color: var(--text-dim);
}

/* Empty State */
.empty-state {
    padding: var(--space-8) var(--space-4);
    text-align: center;
}

.empty-state p {
    font-size: var(--text-sm);
    color: var(--text-muted);
    margin-bottom: var(--space-1);
}

.empty-state span {
    font-size: var(--text-xs);
    color: var(--text-dim);
}

/* Sidebar Footer */
.sidebar-footer {
    padding: var(--space-3);
    border-top: 1px solid var(--border-subtle);
}

.user-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-lg);
    font-size: var(--text-sm);
    color: var(--text-secondary);
    transition: all var(--duration-fast) var(--ease-default);
}

.user-btn:hover {
    background: var(--bg-hover);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

/* ─────────────────────────────────────────────────────────────────────────
   MAIN CONTENT
   ───────────────────────────────────────────────────────────────────────── */
.main-content {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* ─────────────────────────────────────────────────────────────────────────
   CHAT SECTION
   ───────────────────────────────────────────────────────────────────────── */
.chat-section {
    flex: 1;
    min-width: 400px;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
    transition: flex var(--duration-slow) var(--ease-default);
}

.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-width: var(--max-chat-width);
    margin: 0 auto;
    width: 100%;
    padding: var(--space-6);
}

/* Messages */
.messages {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-4) 0;
}

/* Welcome Message */
.welcome-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: var(--space-16) var(--space-6);
    min-height: 60vh;
}

.welcome-icon {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-2xl);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--space-6);
}

.welcome-icon.sites-icon {
    background: rgba(139, 92, 246, 0.15);
    color: var(--accent-violet);
}

.welcome-icon.apps-icon {
    background: rgba(236, 72, 153, 0.15);
    color: var(--accent-pink);
}

.welcome-message h2 {
    font-size: var(--text-2xl);
    font-weight: var(--font-semibold);
    color: var(--text-primary);
    margin-bottom: var(--space-3);
}

.welcome-message p {
    font-size: var(--text-base);
    color: var(--text-muted);
    max-width: 400px;
    margin-bottom: var(--space-8);
}

/* Suggestions */
.suggestions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--space-2);
}

.suggestion {
    padding: var(--space-3) var(--space-4);
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    font-size: var(--text-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-default);
}

.suggestion:hover {
    background: var(--bg-hover);
    border-color: var(--border-default);
    color: var(--text-primary);
    transform: translateY(-2px);
}

/* Message */
.message {
    display: flex;
    gap: var(--space-3);
    padding: var(--space-4) 0;
    animation: slideUp var(--duration-normal) var(--ease-out);
}

.message + .message {
    border-top: 1px solid var(--border-subtle);
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    background: var(--bg-elevated);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.message-avatar.ai {
    background: var(--gradient-brand);
}

.message-content {
    flex: 1;
    min-width: 0;
}

.message-text {
    font-size: var(--text-sm);
    line-height: var(--leading-relaxed);
    color: var(--text-primary);
}

.message-text p {
    margin-bottom: var(--space-3);
}

.message-text p:last-child {
    margin-bottom: 0;
}

.message-text ul, .message-text ol {
    margin: var(--space-3) 0;
    padding-left: var(--space-6);
}

.message-text li {
    margin-bottom: var(--space-2);
    color: var(--text-secondary);
}

/* ─────────────────────────────────────────────────────────────────────────
   INPUT
   ───────────────────────────────────────────────────────────────────────── */
.input-container {
    padding: var(--space-4) 0;
    border-top: 1px solid var(--border-subtle);
}

.input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: var(--space-2);
    padding: var(--space-3);
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-2xl);
    transition: all var(--duration-fast) var(--ease-default);
}

.input-wrapper:focus-within {
    border-color: var(--border-accent);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.message-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    resize: none;
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-sm);
    color: var(--text-primary);
    max-height: 150px;
    line-height: var(--leading-normal);
}

.message-input::placeholder {
    color: var(--text-dim);
}

.input-actions {
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.attach-btn,
.send-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-lg);
    color: var(--text-muted);
    transition: all var(--duration-fast) var(--ease-default);
}

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

.send-btn {
    background: var(--gradient-button);
    color: white;
}

.send-btn:hover {
    background: var(--gradient-button-hover);
}

/* ─────────────────────────────────────────────────────────────────────────
   PREVIEW SECTION
   ───────────────────────────────────────────────────────────────────────── */
.preview-section {
    width: 0;
    overflow: hidden;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    transition: width var(--duration-slow) var(--ease-smooth);
    position: relative;
}

.preview-section.open {
    width: 50%;
    min-width: 500px;
}

.preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-tertiary);
    gap: var(--space-4);
}

.preview-tabs {
    display: flex;
    gap: var(--space-1);
}

.preview-tab {
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--text-muted);
    transition: all var(--duration-fast) var(--ease-default);
}

.preview-tab:hover {
    color: var(--text-secondary);
}

.preview-tab.active {
    color: var(--text-primary);
    background: var(--bg-elevated);
}

.preview-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

/* Device Switcher */
.device-switcher {
    display: flex;
    align-items: center;
    background: var(--bg-elevated);
    border-radius: var(--radius-md);
    padding: 2px;
}

.device-btn {
    width: 32px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    color: var(--text-dim);
    transition: all var(--duration-fast) var(--ease-default);
}

.device-btn:hover {
    color: var(--text-secondary);
}

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

.preview-action {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    color: var(--text-muted);
    transition: all var(--duration-fast) var(--ease-default);
}

.preview-action:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.deploy-btn {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    background: var(--gradient-button);
    color: white;
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    border-radius: var(--radius-lg);
    transition: all var(--duration-fast) var(--ease-default);
}

.deploy-btn:hover {
    background: var(--gradient-button-hover);
    transform: translateY(-1px);
}

/* Preview Content */
.preview-content {
    flex: 1;
    overflow: hidden;
    position: relative;
}

.preview-frame-container {
    width: 100%;
    height: 100%;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--duration-normal) var(--ease-default);
}

/* Device Preview Sizes */
.preview-frame-container[data-device="desktop"] {
    padding: 0;
}

.preview-frame-container[data-device="desktop"] .preview-frame {
    width: 100%;
    height: 100%;
}

.preview-frame-container[data-device="tablet"] {
    padding: var(--space-6);
    background: var(--bg-primary);
}

.preview-frame-container[data-device="tablet"] .preview-frame {
    width: 768px;
    max-width: 100%;
    height: 100%;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
}

.preview-frame-container[data-device="mobile"] {
    padding: var(--space-6);
    background: var(--bg-primary);
}

.preview-frame-container[data-device="mobile"] .preview-frame {
    width: 375px;
    max-width: 100%;
    height: 100%;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
}

.preview-frame {
    border: none;
    background: white;
}

/* Code View */
.code-view {
    width: 100%;
    height: 100%;
    overflow: auto;
    padding: var(--space-4);
}

.code-block {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    overflow-x: auto;
}

.code-block code {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    white-space: pre;
}

/* ─────────────────────────────────────────────────────────────────────────
   RESPONSIVE
   ───────────────────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
    .sidebar {
        width: 60px;
        min-width: 60px;
    }
    
    .logo-text,
    .section-header span,
    .project-info,
    .user-btn span {
        display: none;
    }
    
    .sidebar-header {
        flex-direction: column;
        gap: var(--space-2);
        padding: var(--space-3);
    }
    
    .sidebar-section {
        display: none;
    }
    
    .user-btn {
        justify-content: center;
    }
    
    .preview-section.open {
        position: absolute;
        right: 0;
        top: 0;
        bottom: 0;
        width: 60%;
        z-index: 100;
    }
    
    .device-switcher {
        display: none;
    }
}

@media (max-width: 768px) {
    .sidebar {
        display: none;
    }
    
    .chat-section {
        min-width: 100%;
    }
    
    .preview-section.open {
        width: 100%;
        min-width: 100%;
    }
}
