/* ==========================================================================
   WebCraft — Minimalist Monochromatic Design System (Black & White)
   ========================================================================== */

:root {
    --bg-black: #000000;
    --bg-dark: #0a0a0a;
    --bg-panel: #0e0e0e;
    --bg-card: #141414;
    --bg-elevated: #1a1a1a;
    --bg-hover: #222222;

    --border: #222222;
    --border-subtle: #181818;
    --border-hover: #333333;
    --border-focus: #555555;

    --text-primary: #ffffff;
    --text-secondary: #a1a1aa;
    --text-tertiary: #71717a;
    --text-muted: #52525b;

    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;

    --transition: 0.15s ease;
}

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

html, body {
    height: 100%;
    width: 100%;
    background-color: var(--bg-black);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 13px;
    line-height: 1.5;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Main Container */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
}

/* Navbar */
.navbar {
    height: 52px;
    background: var(--bg-black);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    flex-shrink: 0;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-logo {
    width: 26px;
    height: 26px;
    border-radius: var(--radius-sm);
    background: #ffffff;
    color: #000000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
}

.brand-info h1 {
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.version-tag {
    font-size: 0.68rem;
    font-weight: 500;
    color: var(--text-tertiary);
    border: 1px solid var(--border);
    padding: 1px 6px;
    border-radius: 4px;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.system-status {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    padding: 4px 10px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--bg-dark);
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 0 6px rgba(255, 255, 255, 0.4);
}

.sites-counter {
    font-size: 0.75rem;
    color: var(--text-secondary);
    padding: 4px 10px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--bg-dark);
}

.sites-counter span {
    color: var(--text-primary);
    font-weight: 600;
}

.nav-btn {
    text-decoration: none;
    font-size: 0.75rem;
    font-weight: 500;
    padding: 5px 12px;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    transition: var(--transition);
}

.ghost-btn {
    color: var(--text-secondary);
    background: transparent;
    border: 1px solid var(--border);
}

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

/* Workspace */
.workspace {
    display: flex;
    flex: 1;
    height: calc(100vh - 52px);
    overflow: hidden;
}

/* Left Console Panel */
.console-panel {
    width: 420px;
    background: var(--bg-dark);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 20px;
    gap: 18px;
    overflow-y: auto;
    flex-shrink: 0;
}

.console-header h2 {
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--text-primary);
}

.console-header .subtitle {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-top: 3px;
    line-height: 1.4;
}

/* Prompt Form */
.prompt-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.input-wrapper {
    position: relative;
    background: var(--bg-black);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition: var(--transition);
}

.input-wrapper:focus-within {
    border-color: var(--border-focus);
}

textarea#promptInput {
    width: 100%;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.85rem;
    padding: 12px;
    resize: vertical;
    min-height: 95px;
    line-height: 1.5;
}

textarea#promptInput::placeholder {
    color: var(--text-muted);
}

.input-tools {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px;
    border-top: 1px solid var(--border-subtle);
    background: var(--bg-black);
}

.char-count {
    font-size: 0.7rem;
    color: var(--text-tertiary);
    font-family: var(--font-mono);
}

.icon-tool-btn {
    background: transparent;
    border: none;
    color: var(--text-tertiary);
    font-size: 0.78rem;
    cursor: pointer;
    padding: 3px 6px;
    border-radius: 4px;
    transition: var(--transition);
}

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

/* Chips / Presets */
.chips-container {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.chips-label {
    font-size: 0.7rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-tertiary);
}

.chips-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.chip {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.73rem;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.chip:hover {
    color: var(--text-primary);
    border-color: var(--border-hover);
    background: var(--bg-elevated);
}

/* Generate Button */
.generate-btn {
    background: #ffffff;
    border: 1px solid #ffffff;
    color: #000000;
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 600;
    padding: 10px 16px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.generate-btn:hover {
    background: #e4e4e7;
    border-color: #e4e4e7;
}

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

.generate-btn .btn-loader {
    display: none;
}

.generate-btn.loading {
    background: var(--bg-elevated);
    border-color: var(--border);
    color: var(--text-secondary);
    cursor: not-allowed;
}

.generate-btn.loading .btn-text {
    display: none;
}

.generate-btn.loading .btn-loader {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

/* Stepper Card */
.stepper-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px;
}

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

.stepper-header h3 {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
}

.elapsed-timer {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    padding: 2px 7px;
    border-radius: 4px;
    background: var(--bg-dark);
}

.steps-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.step-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 9px;
    border-radius: var(--radius-sm);
    background: var(--bg-dark);
    border: 1px solid transparent;
    transition: var(--transition);
}

.step-item.active {
    border-color: var(--border-hover);
    background: var(--bg-elevated);
}

.step-item.completed {
    background: var(--bg-dark);
}

.step-icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.68rem;
    font-family: var(--font-mono);
    color: var(--text-tertiary);
    flex-shrink: 0;
}

.step-item.active .step-icon {
    background: #ffffff;
    color: #000000;
    border-color: #ffffff;
    font-weight: 600;
}

.step-item.completed .step-icon {
    background: var(--border-hover);
    color: #ffffff;
    border-color: var(--border-hover);
}

.step-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.step-title {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-primary);
}

.step-desc {
    font-size: 0.68rem;
    color: var(--text-tertiary);
}

.step-status {
    font-size: 0.72rem;
    color: var(--text-tertiary);
}

.step-item.active .step-status {
    color: var(--text-primary);
}

.step-item.completed .step-status {
    color: var(--text-primary);
}

/* Agent Log Accordion */
.agent-log-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.log-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 12px;
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.log-header:hover {
    color: var(--text-primary);
}

.log-body {
    padding: 10px 12px;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    line-height: 1.5;
    color: var(--text-secondary);
    white-space: pre-wrap;
    max-height: 140px;
    overflow-y: auto;
    border-top: 1px solid var(--border-subtle);
    background: var(--bg-black);
}

/* Deployed Sites Gallery */
.gallery-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.gallery-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.gallery-header h3 {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
}

.sites-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.site-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: var(--transition);
}

.site-card:hover {
    border-color: var(--border-hover);
    background: var(--bg-elevated);
}

.site-card.active {
    border-color: #ffffff;
    background: var(--bg-elevated);
}

.site-card-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow: hidden;
}

.site-name {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.site-meta {
    display: flex;
    align-items: center;
    gap: 6px;
}

.site-badge {
    font-size: 0.65rem;
    font-family: var(--font-mono);
    color: var(--text-tertiary);
    border: 1px solid var(--border);
    padding: 1px 5px;
    border-radius: 3px;
    background: var(--bg-dark);
}

.site-card-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.site-card-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-tertiary);
    font-size: 0.72rem;
    padding: 4px 7px;
    border-radius: 4px;
    text-decoration: none;
    transition: var(--transition);
}

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

/* ==========================================================================
   Preview Stage
   ========================================================================== */

.preview-stage {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-black);
    overflow: hidden;
}

/* Browser Bar */
.browser-bar {
    height: 48px;
    background: var(--bg-dark);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    gap: 14px;
    flex-shrink: 0;
}

.browser-dots {
    display: flex;
    align-items: center;
    gap: 5px;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border);
}

/* URL Bar */
.url-bar-container {
    flex: 1;
    max-width: 520px;
}

.url-bar {
    display: flex;
    align-items: center;
    background: var(--bg-black);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 3px 8px;
    gap: 6px;
    transition: var(--transition);
}

.url-bar:focus-within {
    border-color: var(--border-focus);
}

.url-lock {
    font-size: 0.7rem;
    color: var(--text-tertiary);
}

.url-bar input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.url-action-btn {
    background: transparent;
    border: none;
    color: var(--text-tertiary);
    font-size: 0.75rem;
    cursor: pointer;
    padding: 2px 4px;
    transition: var(--transition);
}

.url-action-btn:hover {
    color: var(--text-primary);
}

/* Viewport Controls */
.viewport-controls {
    display: flex;
    align-items: center;
    background: var(--bg-black);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 2px;
    gap: 2px;
}

.viewport-btn {
    background: transparent;
    border: none;
    color: var(--text-tertiary);
    font-size: 0.8rem;
    padding: 4px 7px;
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition);
}

.viewport-btn:hover {
    color: var(--text-primary);
}

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

/* Stage Actions */
.stage-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.stage-btn {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 500;
    padding: 5px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: var(--transition);
}

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

.primary-stage-btn {
    background: #ffffff;
    color: #000000;
    border-color: #ffffff;
    font-weight: 600;
}

.primary-stage-btn:hover {
    background: #e4e4e7;
    color: #000000;
}

.stage-btn.disabled {
    opacity: 0.3;
    pointer-events: none;
}

/* Viewport Canvas */
.viewport-canvas {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px;
    background: var(--bg-black);
    overflow: hidden;
    position: relative;
}

.viewport-frame {
    position: relative;
    height: 100%;
    background: #ffffff;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border);
    transition: width 0.25s ease, max-width 0.25s ease;
}

.viewport-frame.desktop {
    width: 100%;
    max-width: 100%;
}

.viewport-frame.tablet {
    width: 768px;
    max-width: 768px;
    border: 6px solid #1c1c1c;
    border-radius: 16px;
}

.viewport-frame.mobile {
    width: 375px;
    max-width: 375px;
    border: 8px solid #1c1c1c;
    border-radius: 24px;
}

iframe#previewIframe {
    width: 100%;
    height: 100%;
    border: none;
    background: #ffffff;
    display: block;
}

/* Welcome Overlay */
.welcome-overlay {
    position: absolute;
    inset: 0;
    background: var(--bg-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 10;
    transition: opacity 0.2s ease;
}

.welcome-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.welcome-card {
    max-width: 440px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.welcome-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    background: var(--bg-card);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: var(--text-primary);
}

.welcome-card h2 {
    font-size: 1.15rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--text-primary);
}

.welcome-card p {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.quick-sites-preview {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    margin-top: 6px;
}

.quick-site-chip {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.73rem;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.quick-site-chip:hover {
    border-color: var(--border-hover);
    color: var(--text-primary);
    background: var(--bg-elevated);
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal-overlay.hidden {
    display: none;
}

.modal-card {
    width: 780px;
    max-width: 90vw;
    height: 560px;
    max-height: 85vh;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: var(--bg-black);
    border-bottom: 1px solid var(--border);
}

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

.file-tabs {
    display: flex;
    gap: 3px;
    background: var(--bg-dark);
    padding: 2px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.file-tab {
    background: transparent;
    border: none;
    color: var(--text-tertiary);
    font-family: var(--font-mono);
    font-size: 0.73rem;
    padding: 3px 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition);
}

.file-tab:hover {
    color: var(--text-primary);
}

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

.modal-body {
    flex: 1;
    overflow: auto;
    background: var(--bg-black);
    padding: 14px;
}

.modal-body pre {
    margin: 0;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: #e4e4e7;
    line-height: 1.5;
}

/* Toast Container */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 2000;
    pointer-events: none;
}

.toast {
    background: var(--bg-card);
    border: 1px solid var(--border-hover);
    color: var(--text-primary);
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
    pointer-events: auto;
}

.hidden {
    display: none !important;
}

/* Minimal Custom Scrollbars */
::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}

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

::-webkit-scrollbar-thumb {
    background: #27272a;
    border-radius: 2px;
}

::-webkit-scrollbar-thumb:hover {
    background: #3f3f46;
}
