/* =========================
   GLOBAL
========================= */

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Inter, system-ui, -apple-system, sans-serif;
    background: #0b1120;
    color: #e5e7eb;
}

/* =========================
   LAYOUT
========================= */

.app {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* =========================
   SIDEBAR
========================= */

.sidebar {
    width: 260px;
    background: #0f172a;
    border-right: 1px solid #1e293b;
    display: flex;
    flex-direction: column;
    padding: 20px;
}

.sidebar-header {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
    color: #c7d2fe;
}

/* Project List */

.project-list {
    list-style: none;
    padding: 0;
    margin: 0;
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Project Bubble */

.project-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    border-radius: 14px;
    background: #111827;
    border: 1px solid #1f2937;
    font-size: 14px;
    color: #cbd5e1;
    transition: all 0.2s ease;
    cursor: pointer;
}

.project-list li:hover {
    background: #1e293b;
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

.project-list li.active {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: white;
    border: none;
    box-shadow: 0 8px 22px rgba(79, 70, 229, 0.4);
}

/* Open Build Button */
#openBuildBtn {
    padding: 6px 12px;
    border-radius: 6px;
    border: none;
    font-weight: 600;
    color: white;
    cursor: not-allowed;
    background-color: #888; /* grey when disabled */
    opacity: 0.5;
    transition: all 0.2s ease;
}

#openBuildBtn.enabled {
    background: linear-gradient(135deg, #6366f1, #4f46e5); /* purple gradient when enabled */
    cursor: pointer;
    opacity: 1;
}

#openBuildBtn.enabled:hover {
    transform: scale(1.03);
    opacity: 0.95;
}

/* New Project Button */

#newProjectBtn {
    margin-top: 16px;
    padding: 12px;
    border-radius: 12px;
    border: none;
    background: #1e293b;
    color: white;
    cursor: pointer;
    transition: 0.2s ease;
    font-weight: 500;
}

#newProjectBtn:hover {
    background: #334155;
    transform: translateY(-1px);
}

/* =========================
   MAIN PANEL
========================= */

.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #0b1120;
}

/* Header */

.header {
    padding: 16px 24px;
    border-bottom: 1px solid #1e293b;
    background: #0f172a;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1 {
    font-size: 18px;
    color: #c7d2fe;
    margin: 0;
}

.active-project {
    font-size: 14px;
    color: #94a3b8;
}

/* =========================
   CHAT AREA
========================= */

.output {
    flex: 1;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    overflow-y: auto;
}

/* Messages */

.message {
    max-width: 65%;
    padding: 14px 18px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.6;
    word-wrap: break-word;
    white-space: pre-wrap;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.message.user {
    align-self: flex-end;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: white;
}

.message.ai {
    align-self: flex-start;
    background: #111827;
    color: #e5e7eb;
    border: 1px solid #1f2937;
}

/* Input Bar */

.input-bar {
    display: flex;
    gap: 12px;
    padding: 14px;
    border-top: 1px solid #1e293b;
    background: #0f172a;
}

.input-bar textarea {
    flex: 1;
    padding: 12px;
    border-radius: 12px;
    border: 1px solid #1e293b;
    background: #0b1120;
    color: #e5e7eb;
    font-size: 14px;
    resize: none;
    outline: none;
}

.input-bar textarea:focus {
    border-color: #4f46e5;
}

.input-bar button {
    padding: 12px 18px;
    border-radius: 12px;
    border: none;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: white;
    cursor: pointer;
    transition: 0.2s ease;
    font-weight: 500;
}

.input-bar button:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(79, 70, 229, 0.4);
}

/* Scrollbar */

.output::-webkit-scrollbar {
    width: 6px;
}

.output::-webkit-scrollbar-thumb {
    background: #4f46e5;
    border-radius: 3px;
}

/* =========================
   AUTH PAGES
========================= */

.auth-body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    background: #0b1120;
}

.auth-container {
    width: 380px;
    background: #0f172a;
    padding: 36px;
    border-radius: 16px;
    border: 1px solid #1e293b;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.auth-container h1 {
    margin: 0;
    text-align: center;
    font-size: 20px;
    color: #c7d2fe;
}

.auth-container input {
    padding: 12px;
    border-radius: 10px;
    border: 1px solid #1e2937;
    background: #111827;
    color: #e5e7eb;
}

.auth-container input:focus {
    outline: none;
    border-color: #4f46e5;
}

.auth-container button {
    padding: 12px;
    border-radius: 10px;
    border: none;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: white;
    cursor: pointer;
    transition: 0.2s ease;
}

.auth-container button:hover {
    box-shadow: 0 6px 18px rgba(79, 70, 229, 0.4);
}

.auth-container p {
    text-align: center;
    font-size: 13px;
    color: #94a3b8;
}

.auth-container a {
    color: #4f46e5;
    text-decoration: none;
}

.auth-container a:hover {
    text-decoration: underline;
}

.error {
    color: #ef4444;
    font-size: 13px;
    text-align: center;
}

/* =========================
   AUTH BUTTON ANIMATION
========================= */

.action-btn {
    position: relative;
    overflow: hidden;
}

.action-btn.loading {
    opacity: 0.8;
    pointer-events: none;
}

.action-btn .btn-loader,
.action-btn .btn-result {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.action-btn.loading .btn-text {
    visibility: hidden;
}

.action-btn.loading .btn-loader {
    display: flex;
}

/* Spinner */
.action-btn .btn-loader::after {
    content: "";
    width: 18px;
    height: 18px;
    border: 3px solid white;
    border-top: 3px solid transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* Success */
.action-btn.success {
    background: #16a34a !important;
}

.action-btn.success .btn-text {
    visibility: hidden;
}

.action-btn.success .btn-loader {
    display: none;
}

.action-btn.success .btn-result::after {
    content: "✔";
    font-size: 18px;
}

/* Error */
.action-btn.error {
    background: #dc2626 !important;
}

.action-btn.error .btn-text {
    visibility: hidden;
}

.action-btn.error .btn-loader {
    display: none;
}

.action-btn.error .btn-result::after {
    content: "✖";
    font-size: 18px;
}

.build-card {
    background: #111827;
    border: 1px solid #1f2937;
    border-radius: 12px;
    padding: 16px;
    margin-top: 12px;
    animation: fadeIn 0.25s ease-out;
}

.build-title {
    font-weight: 600;
    font-size: 14px;
    color: #e5e7eb;
    margin-bottom: 6px;
}

.build-status {
    font-size: 13px;
    color: #9ca3af;
}

.build-success {
    font-weight: 600;
    font-size: 14px;
    color: #10b981;
    margin-bottom: 6px;
}

.open-btn {
    margin-top: 12px;
    background: #2563eb;
    border: none;
    color: white;
    padding: 8px 14px;
    font-size: 13px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.open-btn:hover {
    background: #1d4ed8;
}

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

.beta-overlay {
    position: fixed;
    inset: 0;
    background: #0f172a; /* solid background */
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.beta-card {
    background: white;
    padding: 40px;
    border-radius: 16px;
    width: 340px;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.beta-card h2 {
    margin-bottom: 10px;
}

.beta-card p {
    font-size: 14px;
    color: #555;
    margin-bottom: 20px;
}

.beta-card input {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid #ddd;
    margin-bottom: 15px;
    font-size: 14px;
}

.beta-card input:focus {
    outline: none;
    border-color: #4f46e5;
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.2);
}

.beta-card button {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    border: none;
    background: #4f46e5;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s ease;
}

.beta-card button:hover {
    background: #4338ca;
}

.beta-error {
    margin-top: 10px;
    font-size: 13px;
    color: red;
}


