/*list of variables*/
/*text input bg color: #151515*/
:root {
    --bg-color: #151515;
    --border-color: #313131;
}

* {
    padding: 0;
    margin: 0;
}

body {
    font-family: "poppins", sans-serif;
    background: #000000;
    color: #e7e7e7;
    margin: 0;
}

::-webkit-scrollbar {
    display: none;
}

a {
    text-decoration: none;
    color: inherit;
}

.theme-btn{
    border: none;
    padding: 0px;
}
.invert {
    filter: invert(1) hue-rotate(180deg);
}

/* Elements that should remain same in both themes */
.same.invert {
    filter: invert(1) hue-rotate(180deg);
}

button {
    cursor: pointer;
    padding: 7px 15px;
    border-radius: 3px;
    background-color: transparent;
    color: rgb(201, 201, 201);
    cursor: pointer;
    border: 1px solid var(--border-color);
}

main {
    padding-top: 50px;
}

.icon {
    height: 20px;
    margin: 0 5px 3px 0;
    vertical-align: middle;
}

.loading {
    filter: brightness(0) invert(1);
}

.header {
    position: fixed;
    top: 0;
    left: 0;
    background-color: #000000;
    border-bottom: 1px solid #3d3d3d;
    padding: 10px;
    width: calc(100% - 20px);
    z-index: 10;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.headerIcon {
    height: 17px;
    padding: 7px;
    cursor: pointer;
    border-radius: 5px;
    cursor: pointer;
    border: 1px solid var(--border-color);
}

#burger {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 9px 8px 4px 8px;
}

#burger span {
    width: 15px;
    height: 0.1px;
    background-color: #fff;
}

#loader {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgb(0, 0, 0);
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
}

#loader.visible {
    opacity: 1;
    visibility: visible;
}

.container {
    display: flex;
    height: calc(100vh - 70px);
    width: 100vw;
    overflow: hidden;
}

#config,
#ai {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    padding: 15px;
    border-color: #3d3d3d;
}

#config {
    width: 300px;
}

#ai {
    width: 300px;
    position: relative;
}

#ai-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

#ai input {
    width: calc(100% - 60px);
    padding-right: 50px;
    border: 1px solid var(--border-color);
}

#sendBtn {
    position: absolute;
    bottom: 19px;
    right: 18px;
}

#sendBtn:hover {
    background-color: #1f1f1f;
}

#ai h4,
#config h4 {
    margin-bottom: 10px;
}

#response-container {
    overflow-y: auto;
    padding: 10px;
    padding-bottom: 50px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    height: 100%;
    color: #cbcbcb;
    font-size: 14px;
    display: flex;
    flex-direction: column;
}

#response-container .ai-response,
#response-container .user-query {
    margin-bottom: 10px;
    padding: 5px 10px;
    border-radius: 5px;
    width: fit-content;
    max-width: 80%;
}

#response-container .user-query {
    align-self: flex-end;
    background-color: #1a1a1a;

}

#response-container .ai-response {
    align-self: flex-start;
    background-color: #0f0f0f;
}


#dashboard {
    position: relative;
    flex-grow: 1;
    padding: 10px;
    overflow-y: auto;
}

.divider {
    width: 2px;
    cursor: col-resize;
    background: #2e2e2e;
    transition: background 0.2s, box-shadow 0.2s;
}

.divider:hover {
    background: #5a5a5a;
    box-shadow: 0 0 0 1.5px #5a5a5a;
}



select {
    padding: 0 5px;
    height: 40px;
    border-radius: 2px;
    border: none;
    color: white;
    background-color: var(--bg-color);
    border-radius: 5px;
    border: 1px solid var(--border-color);
}

select:focus {
    background-color: var(--bg-color);
    outline: none;
}

option {
    background-color: #000000;
    color: white;
}

input[type="text"] {
    width: calc(100% - 20px);
    flex: 1;
    padding: 10px;
    margin-top: 10px;
    border: none;
    color: white;
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 15px;
    cursor: text;
}

input:focus {
    color: white;
    caret-color: white;
    outline: none;
    background-color: var(--bg-color);
}

input:-webkit-autofill {
    background-color: var(--bg-color) !important;
    -webkit-text-fill-color: #fff !important;
}

input:-internal-autofill-selected {
    background-color: var(--bg-color) !important;
    -webkit-text-fill-color: #fff !important;
}

/* For Firefox */
input:-moz-autofill {
    background-color: var(--bg-color) !important;
    -moz-text-fill-color: #fff !important;
}

#loadBtn {
    display: none;
    flex-direction: row;
    margin: 10px 0 10px auto;
    padding: 10px 25px;
    width: min-content;
    border-radius: 5px;
    color: white;
    cursor: pointer;
}

.details {
    margin-top: 10px;
    line-height: 23px;
}

.slicer {
    display: flex;
    gap: 8px;
    margin: 10px 0;
}

.slicer input[type="radio"] {
    display: none;
    /* hide default dots */
}

.slicer label {
    padding: 6px 14px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    background: var(--bg-color);
    color: #eee;
    border: 1px solid var(--border-color);
}

.slicer label:hover {
    background: #2a2a2a;
}

.slicer input[type="radio"]:checked+label {
    background: rgb(0, 31, 31);
    /* highlight color */
    border-color: rgb(1, 185, 185);
    color: rgb(1, 185, 185);
}

#chartsContainer {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    /* fills all available space */
    gap: 10px;
    width: 100%;
    box-sizing: border-box;
    justify-content: stretch;
    /* ensures full width usage */
    align-items: start;
}

.chart-block {
    padding: 5px;
    width: 100%;
    /* fill grid cell */
    display: flex;
    flex-direction: column;
    align-items: stretch;
    border: 1px solid #1a1a1a;
    border-radius: 7px;
    box-sizing: border-box;
    cursor: pointer;
}

.chart-block h3 {
    text-align: center;
    margin-bottom: 10px;
    font-size: 1rem;
}

/* Keep charts proportional without stretching */
.chart-block canvas {
    width: 100% !important;
    height: 200px !important;
    object-fit: contain;
}


.copy-btn {
    background-color: #1b1b1b;
    border: 1px solid var(--border-color);
    cursor: pointer;
    position: absolute;
    left: 0px;
    padding: 1px 2px;
    display: none;
}

.copy-btn img {
    height: 12px;
    vertical-align: middle;
    filter: brightness(0) invert(1);
}

.table-wrapper {
    width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 18px;
    font-size: 13px;
    border-radius: 7px;
    min-width: 600px;
}

th,
td {
    border: 1px solid #1b1b1b;
    padding: 8px;
    text-align: center;
    white-space: nowrap;
}

th {
    background: #1b1b1b;
}

tr:nth-child(even) {
    background: #0f0f0f;
}

tr:hover {
    background: rgb(25, 21, 0);
    color: rgb(255, 214, 0);
}

tr:hover .copy-btn {
    display: inline-block;
}

#logSection {
    position: relative;
    max-width: calc(100vw - 590px);
    overflow-x: scroll;
    display: none;
    margin: 20px 0;
    border-radius: 5px;
    background-color: #0f0f0f;
    padding: 0 10px;
}

#logSection summary {
    padding: 10px;
    cursor: pointer;
    user-select: none;
}

#chName {
    font-size: 30px;
    font-weight: bold;
}

#msg-container {
    height: auto;
    pointer-events: none;
    display: flex;
    flex-direction: column-reverse;
}

.msg {
    visibility: hidden;
    margin-top: 5px;
    z-index: 5;
    opacity: 0;
    padding: 5px;
    width: calc(100% - 12px);
    max-width: calc(100vw - 40px);
    border-radius: 5px;
    background-color: #0f0b00;
    border: 1px solid #9b6d00;
    color: #eda600;
    transition: visibility 0.3s, opacity 0.3s linear, transform 0.3s ease-out;
}

footer {
    border-top: 1px solid #3d3d3d;
    color: #777;
    font-size: 12px;
    line-height: 14px;
    padding: 2px;
    display: flex;
    justify-content: space-between;
}

/* Modal overlay */
.chart-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    backdrop-filter: blur(10px);
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    filter: blur(10px);
    pointer-events: none;
    transition: opacity 0.5s ease-in-out, filter 0.5s ease-in-out;
}

/* Show modal */
.chart-modal.active {
    opacity: 1;
    pointer-events: all;
    filter: blur(0);
}

/* Modal content box */
.chart-modal-content {
    position: relative;
    width: 95%;
    max-width: 900px;
    box-shadow: 0 0 25px rgba(0, 0, 0, 0.4);
}

/* Close button */
.chart-modal-close {
    position: absolute;
    top: 0px;
    right: 0px;
    color: #fff;
    font-size: 22px;
    font-weight: bold;
    cursor: pointer;
    z-index: 10;
}

/* Canvas inside modal */
.chart-modal canvas {
    width: 100% !important;
    height: 70vh !important;
    cursor: crosshair;
}


@media screen and (max-width: 900px) {

    #config,
    #ai,
    #dashboard {
        width: calc(100vw - 30px);
    }

    .container {
        flex-direction: column;
        position: relative;
        height: auto;
        width: calc(100vw);
    }

    .chart-block {
        width: calc(100vw - 30px) !important;
    }

    #logSection {
        max-width: calc(100vw - 30px);
    }

    #msg-container {
        width: calc(100vw - 30px);
        position: absolute;
        justify-content: center;
        align-items: center;
    }

    .msg {
        width: 100%;
    }
}