/* =========================================================
   CERETA AI
   Modern SQL Assistant UI
   UI ONLY
   ========================================================= */

:root {
    --cereta-bg: #f6f7fb;
    --cereta-card: #ffffff;
    --cereta-border: #e7e9f0;
    --cereta-text: #172033;
    --cereta-muted: #7b8497;
    --cereta-purple: #5b5ce2;
    --cereta-purple-dark: #4d4ed0;
    --cereta-purple-soft: #f0efff;
    --cereta-green: #0b9f68;
    --cereta-green-soft: #eaf9f2;
    --cereta-code: #111827;
}


/* =========================================================
   PAGE
   ========================================================= */

.cereta-page {
    min-height: 100vh;
    box-sizing: border-box;
    padding: 20px;
    background: var(--cereta-bg);
    color: var(--cereta-text);
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}


/* =========================================================
   HEADER
   ========================================================= */

.cereta-header {
    display: flex;
    align-items: center;
    gap: 18px;
    min-height: 76px;
    padding: 12px 16px;
    background: #fff;
    border: 1px solid var(--cereta-border);
    border-radius: 15px;
    box-shadow: 0 2px 10px rgba(15, 23, 42, .035);
    margin-bottom: 16px;
}

.cereta-brand {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 250px;
    margin-right: auto;
}

.cereta-logo {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 11px;
    background: var(--cereta-purple-soft);
    color: var(--cereta-purple);
    font-size: 22px;
    font-weight: 700;
}

.cereta-brand h1 {
    margin: 0;
    font-size: 21px;
    line-height: 1.1;
    font-weight: 750;
    letter-spacing: -.4px;
}

.cereta-brand p {
    margin: 4px 0 0;
    color: var(--cereta-muted);
    font-size: 11px;
}


/* =========================================================
   HEADER CONTROLS
   ========================================================= */

.cereta-header-control {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

    .cereta-header-control label {
        color: #697286;
        font-size: 12px;
        font-weight: 700;
        letter-spacing: .06em;
    }

    .cereta-header-control select,
    #recent {
        height: 36px;
        min-width: 130px;
        padding: 0 10px;
        border: 1px solid #dfe3eb;
        border-radius: 8px;
        background: #fff;
        color: #273044;
        font-size: 12px;
        outline: none;
    }

        .cereta-header-control select:focus,
        #recent:focus {
            border-color: var(--cereta-purple);
            box-shadow: 0 0 0 3px rgba(91, 92, 226, .08);
        }


/* =========================================================
   DATABASE HEADER STATUS
   ========================================================= */

.database-header-info {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 130px;
}

.database-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22a06b;
}

.database-header-info strong {
    display: block;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
    font-weight: 700;
}

.database-header-info span {
    display: block;
    margin-top: 2px;
    color: var(--cereta-muted);
    font-size: 11px;
}

.header-clear {
    height: 36px;
    padding: 0 13px;
    border: 1px solid #dfe3eb;
    border-radius: 8px;
    background: #fff;
    color: #3c4558;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}


/* =========================================================
   DATABASE CONTEXT
   ========================================================= */

.database-context {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 16px;
    margin-bottom: 14px;
    border: 1px solid var(--cereta-border);
    border-radius: 13px;
    background: #fff;
}

.database-context-main {
    display: flex;
    align-items: center;
    gap: 11px;
}

.database-icon {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    background: var(--cereta-purple-soft);
    color: var(--cereta-purple);
    font-size: 15px;
}

.eyebrow {
    display: block;
    margin-bottom: 3px;
    color: var(--cereta-purple);
    font-size: 8px;
    font-weight: 800;
    letter-spacing: .09em;
}

.database-name {
    font-size: 14px;
    font-weight: 750;
}

.database-meta {
    display: flex;
    gap: 7px;
    margin-top: 3px;
    color: var(--cereta-muted);
    font-size: 9px;
}

.connected-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 9px;
    border-radius: 20px;
    background: var(--cereta-green-soft);
    color: var(--cereta-green);
    font-size: 9px;
    font-weight: 700;
}


/* =========================================================
   DATABASE INSIGHTS
   ========================================================= */

.database-insights {
    margin-bottom: 14px;
    padding: 14px 16px;
    border: 1px solid var(--cereta-border);
    border-radius: 13px;
    background: #fff;
}

.database-insights-header h3 {
    margin: 0;
    font-size: 13px;
}

.database-insights-content {
    margin-top: 9px;
    color: #4b5567;
    font-size: 11px;
    line-height: 1.6;
}


/* =========================================================
   WORKSPACE
   ========================================================= */

.cereta-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 350px;
    gap: 16px;
    align-items: start;
}

.cereta-main {
    min-width: 0;
}


/* =========================================================
   QUICK PROMPTS
   ========================================================= */

.quick-prompts {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 10px;
    overflow-x: auto;
    scrollbar-width: none;
}

    .quick-prompts::-webkit-scrollbar {
        display: none;
    }

.quick-label {
    flex: 0 0 auto;
    color: #667085;
    font-size: 10px;
    font-weight: 700;
}

.prompt-chip {
    flex: 0 0 auto;
    padding: 7px 12px;
    border: 1px solid #e1e3ec;
    border-radius: 20px;
    background: #fff;
    color: #4d54c7;
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: .15s ease;
}

    .prompt-chip:hover {
        border-color: #c8c8fa;
        background: var(--cereta-purple-soft);
    }


/* =========================================================
   ASK CARD
   ========================================================= */

.ask-card {
    padding: 17px;
    border: 1px solid #d9d8ff;
    border-radius: 14px;
    background: linear-gradient( 145deg, #ffffff 0%, #fcfcff 100% );
    box-shadow: 0 3px 15px rgba(91, 92, 226, .045);
    margin-bottom: 13px;
}

.ask-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.ask-card-title {
    display: flex;
    align-items: center;
    gap: 9px;
}

.ask-ai-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: var(--cereta-purple-soft);
    color: var(--cereta-purple);
    font-size: 15px;
}

.ask-card-title h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
}

.read-only-badge,
.read-only-small {
    padding: 5px 8px;
    border-radius: 20px;
    background: var(--cereta-green-soft);
    color: var(--cereta-green);
    font-size: 8px;
    font-weight: 800;
}

.question-input {
    display: block;
    width: 100%;
    min-height: 90px;
    box-sizing: border-box;
    padding: 13px;
    border: 1px solid #cfd2e9;
    border-radius: 9px;
    background: #fff;
    color: #273044;
    font-family: inherit;
    font-size: 12px;
    line-height: 1.55;
    resize: vertical;
    outline: none;
}

    .question-input:focus {
        border-color: var(--cereta-purple);
        box-shadow: 0 0 0 3px rgba(91, 92, 226, .07);
    }

    .question-input:disabled {
        background: #fafbfc;
        cursor: not-allowed;
    }

.ask-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
}

.ask-security {
    display: flex;
    align-items: center;
    gap: 5px;
    color: #8a93a5;
    font-size: 9px;
}

.security-icon {
    color: #667085;
}

.separator {
    color: #c2c6d0;
}

.ask-button {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    height: 38px;
    padding: 0 16px;
    border: 0;
    border-radius: 9px;
    background: linear-gradient( 135deg, #6264e8, #5555d9 );
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 5px 12px rgba(91, 92, 226, .18);
}

    .ask-button:disabled {
        opacity: .5;
        cursor: not-allowed;
    }


/* =========================================================
   EMPTY STATE
   ========================================================= */

.empty-state-card {
    padding: 27px;
    border: 1px solid var(--cereta-border);
    border-radius: 14px;
    background: #fff;
    text-align: center;
}

.empty-state-icon {
    width: 38px;
    height: 38px;
    margin: 0 auto 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 11px;
    background: var(--cereta-purple-soft);
    color: var(--cereta-purple);
}

.empty-state-card h3 {
    margin: 0;
    font-size: 15px;
}

.empty-state-card p {
    max-width: 550px;
    margin: 7px auto 0;
    color: var(--cereta-muted);
    font-size: 11px;
    line-height: 1.6;
}


/* =========================================================
   QUESTION BUBBLE
   ========================================================= */

.question-bubble {
    max-width: 80%;
    margin: 0 0 10px auto;
    padding: 10px 13px;
    border-radius: 12px 12px 3px 12px;
    background: var(--cereta-purple);
    color: #fff;
    font-size: 11px;
    line-height: 1.5;
}


/* =========================================================
   ANSWER
   ========================================================= */

.answer-card {
    margin-bottom: 12px;
    padding: 17px;
    border: 1px solid var(--cereta-border);
    border-radius: 14px;
    background: #fff;
}

.result-label {
    display: block;
    margin-bottom: 11px;
    color: var(--cereta-green);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .04em;
}

.answer-card h2 {
    margin: 5px 0;
    font-size: 14px;
}

.answer-card p {
    margin: 5px 0;
    color: var(--cereta-muted);
    font-size: 10px;
}

.metric-value {
    font-size: 38px;
    line-height: 1;
    font-weight: 800;
    color: var(--cereta-text);
}


/* =========================================================
   DATA PANEL
   ========================================================= */

.data-panel {
    margin-bottom: 12px;
    padding: 13px;
    border: 1px solid var(--cereta-border);
    border-radius: 13px;
    background: #fff;
}

.data-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 9px;
}

    .data-heading h3 {
        margin: 0;
        font-size: 12px;
    }

    .data-heading span {
        color: var(--cereta-muted);
        font-size: 9px;
    }

.table-wrap {
    overflow-x: auto;
    border: 1px solid #edf0f4;
    border-radius: 8px;
}

    .table-wrap table {
        width: 100%;
        border-collapse: collapse;
        font-size: 9px;
    }

    .table-wrap th,
    .table-wrap td {
        padding: 7px 9px;
        border-bottom: 1px solid #edf0f4;
        text-align: left;
        white-space: nowrap;
    }

    .table-wrap th {
        background: #f8f9fc;
        color: #667085;
        font-weight: 700;
    }

    .table-wrap td {
        color: #374151;
    }


/* =========================================================
   INSPECTOR
   ========================================================= */

.cereta-inspector {
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: sticky;
    top: 15px;
}

.inspector-card {
    padding: 15px;
    border: 1px solid var(--cereta-border);
    border-radius: 13px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(15, 23, 42, .025);
}

.inspector-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 13px;
}

.inspector-title {
    display: flex;
    align-items: center;
    gap: 7px;
}

    .inspector-title h3 {
        margin: 0;
        font-size: 12px;
        font-weight: 750;
    }

.inspector-icon {
    color: var(--cereta-purple);
    font-size: 17px;
    font-weight: 700;
}

    .inspector-icon.purple {
        color: var(--cereta-purple);
    }

.execution-status {
    padding: 4px 8px;
    border-radius: 20px;
    background: #f1f2f5;
    color: #7b8497;
    font-size: 8px;
    font-weight: 700;
}

    .execution-status.complete {
        background: var(--cereta-green-soft);
        color: var(--cereta-green);
    }

    .execution-status.failed {
        background: #fff0f0;
        color: #dc3545;
    }


/* =========================================================
   EXECUTION TIMELINE
   ========================================================= */

.execution-timeline {
    position: relative;
    list-style: none;
    margin: 0;
    padding: 0;
}

    .execution-timeline li {
        position: relative;
        display: flex;
        align-items: center;
        gap: 9px;
        min-height: 30px;
        color: #8a93a5;
        font-size: 10px;
    }

        .execution-timeline li:not(:last-child)::after {
            content: "";
            position: absolute;
            left: 5px;
            top: 19px;
            width: 1px;
            height: 16px;
            background: #e1e4eb;
        }

.timeline-icon {
    position: relative;
    z-index: 1;
    width: 11px;
    color: #a5adbc;
    background: #fff;
    font-size: 11px;
    text-align: center;
}

.execution-timeline li.complete {
    color: #364152;
}

    .execution-timeline li.complete .timeline-icon {
        color: var(--cereta-green);
    }

.execution-timeline li.active {
    color: var(--cereta-purple);
    font-weight: 650;
}

    .execution-timeline li.active .timeline-icon {
        color: var(--cereta-purple);
    }

.execution-timeline li.failed {
    color: #dc3545;
}

    .execution-timeline li.failed .timeline-icon {
        color: #dc3545;
    }

.execution-footer {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #eef0f4;
    color: #9aa2b1;
    font-size: 9px;
}

    .execution-footer strong {
        color: #687184;
        font-weight: 650;
    }


/* =========================================================
   SQL
   ========================================================= */

.sql-container {
    overflow: hidden;
    border-radius: 8px;
    background: var(--cereta-code);
}

#sql-display {
    margin: 0;
    max-height: 250px;
    overflow: auto;
    padding: 13px;
    color: #dbe4f0;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    font-size: 9px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
}

.read-only-small {
    font-size: 7px;
}

.parameters {
    margin-top: 8px;
    color: #737d90;
    font-size: 9px;
}

    .parameters h4 {
        margin: 0 0 5px;
        font-size: 9px;
    }

.parameter-row {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    padding: 5px 0;
    border-bottom: 1px solid #f0f1f4;
}


/* =========================================================
   AI USAGE
   ========================================================= */

.usage-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: conic-gradient( var(--cereta-purple) 0 50%, #dddffc 50% 100% );
}

.provider-badge {
    color: #7b8497;
    font-size: 8px;
}

.usage-list {
    display: flex;
    flex-direction: column;
}

.usage-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f0f1f4;
}

    .usage-row:last-child {
        border-bottom: 0;
    }

    .usage-row span {
        color: #8a93a5;
        font-size: 9px;
    }

    .usage-row strong {
        color: #30394b;
        font-size: 10px;
    }

.cost-row {
    margin-top: 5px;
    padding: 9px 8px;
    border-radius: 7px;
    background: #f5f3ff;
}

    .cost-row strong {
        color: var(--cereta-purple);
    }


/* =========================================================
   ERROR
   ========================================================= */

.error {
    padding: 12px;
    border: 1px solid #ffd5d5;
    border-radius: 8px;
    background: #fff5f5;
    color: #b42318;
}

    .error strong {
        font-size: 11px;
    }

    .error p {
        margin: 5px 0 0;
        font-size: 10px;
    }


/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 1200px) {

    .cereta-header {
        flex-wrap: wrap;
    }

    .cereta-brand {
        width: 100%;
        margin-right: 0;
    }

    .cereta-workspace {
        grid-template-columns: minmax(0, 1fr) 310px;
    }
}


@media (max-width: 950px) {

    .cereta-page {
        padding: 14px;
    }

    .cereta-workspace {
        grid-template-columns: 1fr;
    }

    .cereta-inspector {
        position: static;
    }

    .database-context {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}


@media (max-width: 650px) {

    .cereta-header {
        align-items: stretch;
    }

    .cereta-header-control {
        flex: 1;
    }

        .cereta-header-control select {
            width: 100%;
        }

    .database-header-info {
        display: none;
    }

    .quick-prompts {
        margin-bottom: 8px;
    }

    .ask-card {
        padding: 13px;
    }

    .ask-card-footer {
        align-items: stretch;
        flex-direction: column;
        gap: 10px;
    }

    .ask-button {
        width: 100%;
        justify-content: center;
    }

    .ask-security {
        justify-content: center;
    }

    .question-bubble {
        max-width: 92%;
    }
}

/* =========================================================
   CERETA - LARGER / MORE READABLE UI
   UI ONLY - NO FUNCTIONALITY CHANGE
   ========================================================= */

/* ---------------------------------------------------------
   BASE
   --------------------------------------------------------- */

.cereta-page {
    font-size: 14px;
}


/* ---------------------------------------------------------
   HEADER
   --------------------------------------------------------- */

.cereta-brand h1 {
    font-size: 27px;
    letter-spacing: -.5px;
}

.cereta-brand p {
    font-size: 14px;
}

.cereta-header-control label {
    font-size: 11px;
}

.cereta-header-control select,
#recent {
    height: 40px;
    font-size: 13px;
}

.database-header-info strong {
    font-size: 12px;
}

.database-header-info span {
    font-size: 10px;
}

.header-clear {
    height: 40px;
    font-size: 13px;
    padding: 0 15px;
}


/* ---------------------------------------------------------
   DATABASE CONTEXT
   --------------------------------------------------------- */

.database-context {
    padding: 17px 20px;
}

.database-icon {
    width: 40px;
    height: 40px;
    font-size: 17px;
}

.database-name {
    font-size: 18px;
}

.database-meta {
    margin-top: 5px;
    font-size: 12px;
}

.eyebrow {
    font-size: 10px;
}

.connected-badge {
    padding: 6px 11px;
    font-size: 11px;
}


/* ---------------------------------------------------------
   DATABASE OVERVIEW
   --------------------------------------------------------- */

.database-insights {
    padding: 18px 20px;
}

.database-insights-header h3 {
    font-size: 17px;
}

.database-insights-content {
    margin-top: 10px;
    font-size: 14px;
    line-height: 1.7;
}

    .database-insights-content ul {
        padding-left: 22px;
    }

    .database-insights-content li {
        margin-bottom: 4px;
    }


/* =========================================================
   TRY ASKING
   ========================================================= */

.quick-prompts {
    gap: 9px;
    margin-bottom: 13px;
}

.quick-label {
    font-size: 13px;
    font-weight: 700;
}

.prompt-chip {
    padding: 9px 15px;
    border-radius: 22px;
    font-size: 12px;
    font-weight: 600;
}


/* =========================================================
   ASK CERETA CARD
   ========================================================= */

.ask-card {
    padding: 20px;
    border-radius: 16px;
}

.ask-card-header {
    margin-bottom: 14px;
}

.ask-card-title {
    gap: 11px;
}

.ask-ai-icon {
    width: 34px;
    height: 34px;
    font-size: 18px;
}

.ask-card-title h2 {
    font-size: 20px;
}

.ask-card-title .eyebrow {
    font-size: 10px;
}

.read-only-badge {
    padding: 6px 10px;
    font-size: 9px;
}

.question-input {
    min-height: 115px;
    padding: 15px;
    font-size: 15px;
    line-height: 1.65;
}

.ask-card-footer {
    margin-top: 13px;
}

.ask-security {
    font-size: 11px;
}

.ask-button {
    height: 43px;
    padding: 0 19px;
    font-size: 13px;
}


/* =========================================================
   TRY ASKING + ASK SPACING
   ========================================================= */

.quick-prompts + .ask-card {
    margin-top: 2px;
}


/* =========================================================
   EMPTY STATE
   ========================================================= */

.empty-state-card {
    padding: 34px;
}

.empty-state-icon {
    width: 44px;
    height: 44px;
    font-size: 20px;
}

.empty-state-card h3 {
    font-size: 19px;
}

.empty-state-card p {
    font-size: 13px;
    line-height: 1.7;
}


/* =========================================================
   QUESTION
   ========================================================= */

.question-bubble {
    padding: 13px 16px;
    font-size: 14px;
}


/* =========================================================
   ANSWER
   ========================================================= */

.answer-card {
    padding: 21px;
}

.result-label {
    margin-bottom: 12px;
    font-size: 11px;
}

.answer-card h2 {
    font-size: 19px;
}

.answer-card p {
    font-size: 13px;
    line-height: 1.6;
}

.metric-value {
    font-size: 46px;
}


/* =========================================================
   DATA TABLE
   ========================================================= */

.data-panel {
    padding: 17px;
}

.data-heading h3 {
    font-size: 15px;
}

.data-heading span {
    font-size: 11px;
}

.table-wrap table {
    font-size: 12px;
}

.table-wrap th,
.table-wrap td {
    padding: 9px 11px;
}


/* =========================================================
   RIGHT INSPECTOR
   ========================================================= */

.cereta-workspace {
    grid-template-columns: minmax(0, 1fr) 390px;
}

.inspector-card {
    padding: 18px;
    border-radius: 14px;
}

.inspector-header {
    margin-bottom: 15px;
}

.inspector-title {
    gap: 9px;
}

    .inspector-title h3 {
        font-size: 15px;
    }

.inspector-icon {
    font-size: 19px;
}

.execution-status {
    padding: 5px 9px;
    font-size: 9px;
}


/* =========================================================
   AI EXECUTION TIMELINE
   ========================================================= */

.execution-timeline li {
    min-height: 36px;
    gap: 10px;
    font-size: 13px;
}

.timeline-icon {
    width: 13px;
    font-size: 13px;
}

.execution-timeline li:not(:last-child)::after {
    left: 6px;
    top: 22px;
    height: 19px;
}

.execution-footer {
    margin-top: 13px;
    padding-top: 12px;
    font-size: 11px;
}

    .execution-footer strong {
        font-size: 11px;
    }


/* =========================================================
   SQL
   ========================================================= */

.read-only-small {
    padding: 5px 8px;
    font-size: 8px;
}

#sql-display {
    padding: 15px;
    max-height: 280px;
    font-size: 11.5px;
    line-height: 1.7;
}

.parameters {
    margin-top: 10px;
    font-size: 11px;
}

    .parameters h4 {
        font-size: 11px;
    }


/* =========================================================
   AI USAGE
   ========================================================= */

.provider-badge {
    font-size: 10px;
}

.usage-row {
    padding: 10px 0;
}

    .usage-row span {
        font-size: 12px;
    }

    .usage-row strong {
        font-size: 13px;
    }

.cost-row {
    padding: 10px;
}


/* =========================================================
   BUTTONS INSIDE RESULTS
   ========================================================= */

.answer-card button,
.data-panel button {
    min-height: 32px;
    padding: 0 13px;
    border: 0;
    border-radius: 7px;
    background: var(--cereta-purple);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
}


/* =========================================================
   ERROR
   ========================================================= */

.error {
    padding: 15px;
}

    .error strong {
        font-size: 13px;
    }

    .error p {
        font-size: 12px;
        line-height: 1.5;
    }


/* =========================================================
   CERETA - NEW DATABASE CONNECTION
   FORCE UI STYLING
   ========================================================= */

/* Main card */
#new-database-panel {
    display: block;
    position: relative;
    margin: 14px 0 16px;
    padding: 22px 24px;
    background: #ffffff !important;
    border: 1px solid #e2e6ef !important;
    border-radius: 16px !important;
    box-shadow: 0 4px 18px rgba(15, 23, 42, 0.05) !important;
    color: #172033;
    box-sizing: border-box;
}


    /* Header */
    #new-database-panel .new-database-header {
        display: flex !important;
        align-items: flex-start !important;
        justify-content: space-between !important;
        width: 100%;
        margin: 0 0 18px !important;
    }

        #new-database-panel .new-database-header h2 {
            margin: 4px 0 5px !important;
            color: #172033 !important;
            font-size: 20px !important;
            line-height: 1.3 !important;
            font-weight: 750 !important;
        }

        #new-database-panel .new-database-header p {
            margin: 0 !important;
            color: #697386 !important;
            font-size: 13px !important;
            line-height: 1.5 !important;
        }


    /* NEW DATABASE label */
    #new-database-panel .eyebrow {
        display: block;
        color: #5b5ce2 !important;
        font-size: 10px !important;
        line-height: 1.2 !important;
        font-weight: 800 !important;
        letter-spacing: 1.2px !important;
        text-transform: uppercase;
    }


    /* Close button */
    #new-database-panel #close-new-database {
        width: 34px !important;
        height: 34px !important;
        min-width: 34px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        margin-left: 20px;
        border: 1px solid #e0e4eb !important;
        border-radius: 8px !important;
        background: #ffffff !important;
        color: #667085 !important;
        font-size: 20px !important;
        line-height: 1 !important;
        cursor: pointer;
    }

        #new-database-panel #close-new-database:hover {
            background: #f5f6f9 !important;
            color: #1d2939 !important;
        }


    /* =========================================================
   INNER FORM
   ========================================================= */

    #new-database-panel .new-database-form {
        display: block !important;
        width: 100%;
        padding: 18px !important;
        box-sizing: border-box;
        background: #f8f9fc !important;
        border: 1px solid #e6e9f0 !important;
        border-radius: 12px !important;
    }


    /* Label */
    #new-database-panel .connection-field label {
        display: block !important;
        margin-bottom: 8px !important;
        color: #344054 !important;
        font-size: 12px !important;
        line-height: 1.4 !important;
        font-weight: 700 !important;
    }


    /* =========================================================
   CONNECTION STRING
   ========================================================= */

    #new-database-panel #connection-string {
        display: block !important;
        width: 100% !important;
        min-height: 95px !important;
        margin: 0 !important;
        padding: 13px 14px !important;
        box-sizing: border-box !important;
        border: 1px solid #cfd5df !important;
        border-radius: 9px !important;
        background: #ffffff !important;
        color: #263143 !important;
        font-family: Consolas, "SFMono-Regular", "Liberation Mono", monospace !important;
        font-size: 12px !important;
        line-height: 1.6 !important;
        outline: none !important;
        resize: vertical;
    }

        #new-database-panel #connection-string:focus {
            border-color: #6366f1 !important;
            box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.10) !important;
        }


        /* Placeholder */
        #new-database-panel #connection-string::placeholder {
            color: #98a2b3 !important;
        }


    /* =========================================================
   EXAMPLE / HELP
   ========================================================= */

    #new-database-panel .connection-help {
        margin-top: 8px !important;
        color: #667085 !important;
        font-size: 11px !important;
        line-height: 1.55 !important;
    }

        #new-database-panel .connection-help code {
            display: block !important;
            margin-top: 5px !important;
            padding: 8px 10px !important;
            overflow-x: auto;
            background: #f1f3f7 !important;
            border: 1px solid #e1e5eb !important;
            border-radius: 7px !important;
            color: #475467 !important;
            font-family: Consolas, "SFMono-Regular", monospace !important;
            font-size: 10px !important;
        }


    /* =========================================================
   BUTTON ROW
   ========================================================= */

    #new-database-panel .new-database-actions {
        display: flex !important;
        align-items: center !important;
        gap: 10px !important;
        margin-top: 16px !important;
    }


        /* Both buttons */
        #new-database-panel .new-database-actions button {
            display: inline-flex !important;
            align-items: center !important;
            justify-content: center !important;
            height: 40px !important;
            min-height: 40px !important;
            padding: 0 17px !important;
            border-radius: 8px !important;
            font-size: 12px !important;
            line-height: 1 !important;
            font-weight: 700 !important;
            cursor: pointer;
        }


    /* Test */
    #new-database-panel #test-connection {
        border: 1px solid #d0d5dd !important;
        background: #ffffff !important;
        color: #344054 !important;
    }

        #new-database-panel #test-connection:hover {
            background: #f5f6f8 !important;
        }


    /* Connect */
    #new-database-panel #connect-database {
        border: 0 !important;
        background: #5b5ce2 !important;
        color: #ffffff !important;
        box-shadow: 0 4px 10px rgba(91, 92, 226, 0.18) !important;
    }

        #new-database-panel #connect-database:hover {
            background: #4f50d4 !important;
        }


    /* =========================================================
   CONNECTION RESULT
   ========================================================= */

    #new-database-panel #connection-result {
        margin-top: 12px !important;
        padding: 11px 13px !important;
        border-radius: 8px !important;
        font-size: 12px !important;
        line-height: 1.5 !important;
    }


/* =========================================================
   ACTIVE DATABASE BUTTON
   ========================================================= */

#show-new-database {
    height: 34px !important;
    padding: 0 15px !important;
    border: 0 !important;
    border-radius: 18px !important;
    background: #16805f !important;
    color: #ffffff !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    cursor: pointer;
}

    #show-new-database:hover {
        background: #126d51 !important;
    }


/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 700px) {

    #new-database-panel {
        padding: 17px;
    }

        #new-database-panel .new-database-header h2 {
            font-size: 18px !important;
        }

        #new-database-panel .new-database-form {
            padding: 13px !important;
        }

        #new-database-panel .new-database-actions {
            flex-direction: column !important;
            align-items: stretch !important;
        }

            #new-database-panel .new-database-actions button {
                width: 100% !important;
            }
}

/* =========================================================
   VOICE INPUT
   ========================================================= */

.question-input-wrapper {
    position: relative;
}

    .question-input-wrapper .question-input {
        padding-right: 58px;
    }

.voice-button {
    position: absolute;
    right: 12px;
    bottom: 12px;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #dfe3eb;
    border-radius: 50%;
    background: #ffffff;
    color: #5b5ce2;
    font-size: 16px;
    cursor: pointer;
    box-shadow: 0 2px 7px rgba(15, 23, 42, .08);
    transition: background .15s ease, border-color .15s ease, transform .15s ease;
}

    .voice-button:hover:not(:disabled) {
        background: #f3f2ff;
        border-color: #c9c8f7;
        transform: scale(1.04);
    }

    .voice-button:disabled {
        opacity: .45;
        cursor: not-allowed;
    }


    /* Listening state */

    .voice-button.listening {
        background: #fff0f0;
        border-color: #ffb8b8;
        color: #dc3545;
        animation: voicePulse 1.2s infinite;
    }

@keyframes voicePulse {

    0% {
        box-shadow: 0 0 0 0 rgba(220, 53, 69, .25);
    }

    70% {
        box-shadow: 0 0 0 9px rgba(220, 53, 69, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(220, 53, 69, 0);
    }
}


/* Listening text */

.voice-status {
    position: absolute;
    right: 58px;
    bottom: 18px;
    color: #dc3545;
    font-size: 10px;
    font-weight: 700;
    pointer-events: none;
}


#new-database-panel {
    position: relative;
    margin: 14px 0 16px;
    padding: 22px 24px;
    background: #ffffff !important;
    border: 1px solid #e2e6ef !important;
    border-radius: 16px !important;
    box-shadow: 0 4px 18px rgba(15, 23, 42, 0.05) !important;
    color: #172033;
    box-sizing: border-box;
}


.voice-button.transcribing {
    opacity: .65;
    cursor: wait;
}

.voice-button.listening {
    background: #fff0f0;
    border-color: #ef4444;
    color: #ef4444;
    animation: ceretaVoicePulse 1.2s infinite;
}

@keyframes ceretaVoicePulse {

    0% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, .25);
    }

    70% {
        box-shadow: 0 0 0 9px rgba(239, 68, 68, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}
