/* ==========================================================================
   AETHER AI CODE STUDIO - EDITOR & SANDBOX WORKSPACE STYLES
   ========================================================================== */

/* Split Pane Workspace Container */
.workspace-split {
    display: flex;
    flex: 1;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* Sidebar Navigation */
.sidebar {
    width: 260px;
    background: #09090b;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    height: 100%;
    transition: margin-left 0.25s ease;
    z-index: 20;
}

.sidebar.collapsed {
    margin-left: -260px;
}

.sidebar-header {
    height: 56px;
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.brand-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 1rem;
    color: #f4f4f5;
    letter-spacing: -0.01em;
}

.brand-icon-logo {
    width: 26px;
    height: 26px;
    border-radius: 8px;
    background: linear-gradient(135deg, #27272a, #18181b);
    border: 1px solid rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 0.8rem;
    font-weight: 800;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 14px 12px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.new-chat-btn {
    width: 100%;
    justify-content: flex-start;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #f4f4f5;
    border-radius: 10px;
    font-size: 0.88rem;
    font-weight: 600;
    transition: all var(--transition-fast);
}

.new-chat-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.3);
    color: #ffffff;
    transform: translateY(-1px);
}

.history-section-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #71717a;
    padding: 0 6px;
    font-weight: 700;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 12px;
    border-radius: 10px;
    color: #a1a1aa;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    border: 1px solid transparent;
}

.history-item:hover {
    background: #18181b;
    color: #f4f4f5;
    border-color: rgba(255, 255, 255, 0.08);
}

.history-item.active {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.2);
    font-weight: 500;
}

.history-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 20%;
    height: 60%;
    width: 3px;
    background: #ffffff;
    border-radius: 2px;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
}

.history-item-title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
}

.delete-conv-btn {
    opacity: 0;
    background: transparent;
    border: none;
    color: #71717a;
    padding: 4px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.history-item:hover .delete-conv-btn {
    opacity: 1;
}

.delete-conv-btn:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.15);
}

/* Editor Right Panel */
.editor-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #09090b;
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    height: 100%;
    position: relative;
}

.editor-panel.hidden {
    display: none;
}

.editor-header {
    height: 44px;
    background: #121215;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
}

.editor-tabs {
    display: flex;
    align-items: center;
    gap: 4px;
    overflow-x: auto;
}

.tab-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: transparent;
    color: #a1a1aa;
    border: 1px solid transparent;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    font-size: 0.82rem;
    font-family: var(--font-mono);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.tab-item:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.05);
}

.tab-item.active {
    background: #18181b;
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-bottom-color: #18181b;
    font-weight: 500;
}

.editor-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Split Code & Preview Subpanel */
.editor-split-view {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: calc(100% - 44px);
    overflow: hidden;
}

.code-area-wrapper {
    flex: 1;
    display: flex;
    position: relative;
    overflow: hidden;
    background: #0d0e12;
}

.code-textarea-editor {
    width: 100%;
    height: 100%;
    background: transparent;
    color: #f4f4f5;
    font-family: var(--font-mono);
    font-size: 0.88rem;
    line-height: 1.6;
    border: none;
    outline: none;
    padding: 16px;
    resize: none;
    white-space: pre;
    tab-size: 4;
    caret-color: #ffffff;
}

/* Sandbox Live Preview Container */
.preview-container {
    height: 50%;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: #09090b;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* Mini Integrated Browser Top Chrome */
.browser-chrome-bar {
    height: 40px;
    background: #121215;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    gap: 12px;
    font-family: var(--font-mono);
}

.browser-nav-btns {
    display: flex;
    align-items: center;
    gap: 6px;
}

.browser-icon-btn {
    background: transparent;
    border: none;
    color: #a1a1aa;
    width: 26px;
    height: 26px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
}

.browser-icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.browser-address-bar {
    flex: 1;
    max-width: 460px;
    height: 26px;
    background: #08090c;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    font-size: 0.76rem;
    color: #a1a1aa;
    overflow: hidden;
}

.browser-url {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #d4d4d8;
}

.browser-chrome-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.browser-test-agent-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #f4f4f5;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.72rem;
    font-weight: 600;
    font-family: var(--font-sans);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.15s ease;
}

.browser-test-agent-btn:hover {
    background: rgba(255, 255, 255, 0.18);
    border-color: #ffffff;
    color: #ffffff;
}

.btn-run-ide {
    background: #18181b;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #f4f4f5;
    padding: 5px 12px;
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.btn-run-ide:hover {
    background: #27272a;
    border-color: #ffffff;
    color: #ffffff;
    transform: translateY(-1px);
}

.badge-mono {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #a1a1aa;
    font-size: 0.72rem;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 500;
}

.preview-iframe {
    width: 100%;
    height: calc(100% - 38px);
    border: none;
    background: #0d0e12;
    border-bottom-left-radius: 4px;
    border-bottom-right-radius: 4px;
}

/* Sidebar Bottom User & Usage Card */
.sidebar-footer {
    padding: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: #0d0e12;
    margin-top: auto;
}

.sidebar-user-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    cursor: pointer;
    transition: all 0.15s ease;
}

.sidebar-user-card:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
}

.user-avatar-badge {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #38bdf8 0%, #818cf8 100%);
    color: #ffffff;
    font-weight: 700;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.user-info {
    flex: 1;
    overflow: hidden;
}

.user-name-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    margin-bottom: 4px;
}

.user-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: #f4f4f5;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-plan-tag {
    font-size: 0.65rem;
    padding: 1px 6px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: #a1a1aa;
    font-weight: 500;
}

.user-plan-tag.pro {
    background: rgba(56, 189, 248, 0.2);
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.4);
}

.usage-meter-wrapper {
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 4px;
}

.usage-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #38bdf8 0%, #818cf8 100%);
    border-radius: 2px;
    transition: width 0.3s ease;
}

.usage-subtext {
    font-size: 0.68rem;
    color: #a1a1aa;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-settings-icon {
    background: transparent;
    border: none;
    color: #a1a1aa;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.user-settings-icon:hover {
    color: #ffffff;
}

/* Account Modal Styling */
.account-modal-card {
    max-width: 580px;
    width: 90%;
    background: #121215;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
    overflow: hidden;
}

.account-modal-tabs {
    display: flex;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: #0d0e12;
    padding: 0 16px;
    gap: 8px;
}

.account-tab-btn {
    background: transparent;
    border: none;
    color: #a1a1aa;
    padding: 10px 14px;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.15s ease;
}

.account-tab-btn:hover {
    color: #f4f4f5;
}

.account-tab-btn.active {
    color: #ffffff;
    border-bottom-color: #ffffff;
    font-weight: 600;
}

.account-tab-btn.pro-tab-tag {
    color: #38bdf8;
}

.usage-status-card {
    background: #18181b;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
}

.status-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.status-title {
    font-weight: 600;
    color: #ffffff;
    font-size: 0.92rem;
}

.status-desc {
    font-size: 0.75rem;
    color: #a1a1aa;
}

.usage-big-progress {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.progress-bar-bg {
    height: 8px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #38bdf8 0%, #818cf8 100%);
    border-radius: 4px;
}

.progress-numbers {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.78rem;
    color: #a1a1aa;
}

.pro-banner {
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.1) 0%, rgba(129, 140, 248, 0.1) 100%);
    border: 1px solid rgba(56, 189, 248, 0.25);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.pro-banner-text h4 {
    color: #ffffff;
    font-size: 0.95rem;
    margin-bottom: 4px;
}

.pro-banner-text p {
    color: #a1a1aa;
    font-size: 0.78rem;
    line-height: 1.4;
}

.pro-banner .btn {
    background: #18181b !important;
    border: 1px solid rgba(56, 189, 248, 0.4) !important;
    color: #ffffff !important;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.pro-banner .btn:hover {
    background: #27272a !important;
    border-color: #38bdf8 !important;
    color: #ffffff !important;
    transform: translateY(-1px);
}

.pricing-cards-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 10px;
}

.pricing-card {
    background: #18181b;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    position: relative;
}

.pro-pricing-card {
    border-color: rgba(56, 189, 248, 0.4);
    background: linear-gradient(180deg, #18181b 0%, rgba(56, 189, 248, 0.05) 100%);
}

.pro-badge-header {
    position: absolute;
    top: -10px;
    right: 14px;
    background: #38bdf8;
    color: #09090b;
    font-weight: 700;
    font-size: 0.65rem;
    padding: 2px 8px;
    border-radius: 10px;
}

.pricing-header h4 {
    font-size: 1rem;
    color: #ffffff;
}

.price {
    font-size: 1.5rem;
    font-weight: 800;
    color: #ffffff;
    margin: 8px 0 14px;
}

.price span {
    font-size: 0.8rem;
    color: #a1a1aa;
    font-weight: 400;
}

.pricing-features {
    list-style: none;
    font-size: 0.78rem;
    color: #d4d4d8;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 18px;
    flex: 1;
}

.btn-pricing {
    width: 100%;
    padding: 8px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
}

.btn-current {
    background: rgba(255, 255, 255, 0.08);
    color: #a1a1aa;
}

.btn-pro-upgrade {
    background: #ffffff;
    color: #09090b;
    transition: all 0.15s ease;
}

.btn-pro-upgrade:hover {
    background: #38bdf8;
    color: #09090b;
}

/* Virtual Console Drawer */
.console-drawer {
    height: 130px;
    background: #07080a;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    font-family: var(--font-mono);
    font-size: 0.8rem;
}

.console-header {
    height: 30px;
    background: #121215;
    padding: 0 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #a1a1aa;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.console-logs {
    flex: 1;
    overflow-y: auto;
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: #08090c;
}

.log-line {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #a1a1aa;
    line-height: 1.5;
    font-size: 0.8rem;
}
.log-line.log-error { color: #f87171; }
.log-line.log-warn { color: #facc15; }
.log-line.log-info { color: #38bdf8; }
.log-line.log-success { color: #4ade80; }

/* ==========================================================================
   MOBILE SMARTPHONE OPTIMIZATION (iPhone & Android UI <= 768px)
   ========================================================================== */
@media (max-width: 768px) {
    .app-layout {
        flex-direction: column !important;
    }

    .app-sidebar {
        width: 100% !important;
        height: auto !important;
        min-height: unset !important;
        padding: 10px 14px !important;
        border-right: none !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
    }

    .conversations-history,
    .sidebar-footer {
        display: none !important;
    }

    .workspace-split {
        flex-direction: column !important;
        height: calc(100vh - 56px) !important;
    }

    .chat-container {
        width: 100% !important;
        flex: 1 !important;
    }

    .chat-header {
        padding: 8px 12px !important;
    }

    .welcome-hero {
        padding: 20px 14px !important;
    }

    .welcome-title {
        font-size: 1.4rem !important;
    }

    .input-dock-container {
        padding: 8px 10px 12px !important;
    }

    .input-pill-box {
        padding: 6px 10px !important;
    }

    .pill-textarea {
        font-size: 0.88rem !important;
    }

    .account-modal-card {
        width: 95% !important;
        margin: 10px !important;
    }
}
