/* https://colorhunt.co/palette/0f0f0f232d3f005b41008170 */
/* roughly */

* {
  font-family: monospace;
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    width: 100vw;
    min-width: 0;
    min-height: 0;
    box-sizing: border-box;
}

body {
  color: white;
  background: #0F0F0F;
  min-height: 100vh;
  min-width: 320px;
  width: 100vw;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  padding-top: 0; /* Remove padding at the top */

  box-sizing: border-box;
}

.ͼ1 .cm-line {
  padding: 0 2px 0 10px;
}

.cm-syllableCounter {
  color: yellowgreen;
}

.ͼ1.cm-focused {
  outline: 0;
}

#word-count {
  padding-left: 5px;
  margin: 3px;
}

/*NAV BAR - START*/
.navbar {
  background-color: #333;
  border: 1px dashed #888;
  margin-bottom: 8px;
  max-height: 40px;
  align-items: center;
  display: flex;
  justify-content: space-between; /* Spread left and right */
  padding-left: 10px;
  padding-right: 10px;
}

.navbar ul {
  list-style-type: none;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between; /* Spread left and right */
  width: 100%;
  margin: 0;
  padding: 0;
}

.navbar li {
  display: flex;
  align-items: center;
  height: 100%;
  float: none;
}

.navbar li.checkbox-center {
  flex: 1;
  justify-content: center;
}

.navbar .right, .navbar-apikey-form {
  margin-left: auto;
  display: flex;
  align-items: center;
  height: 100%;
  position: static;
}

.navbar li a {
  display: block;
  color: white;
  text-align: left;
  margin: 2px;
  padding: 5px;
  text-decoration: none;
  border: 1px dashed #0F0F0F;
}

.navbar .right {
  float: right;
  position: absolute;
  right: 10px;
}

.navbar li a:hover {
  background-color: #111;
  border: 1px dashed #888;
}

li.dropdown {
  display: inline-block;
}

.dropdown-content {
  display: none;
  position: absolute;
  background-color: #333;
  border: 1px dashed #888;
  border-top: 0;
  z-index: 1;
}

.dropdown-content.show {
  display: block;
}

.dropdown-content a {
  color: black;
  padding: 12px 16px;
  text-decoration: none;
  display: block;
  text-align: left;
}

/* Center the checkboxes container specifically */
.navbar li.checkbox-center {
  display: flex;
  align-items: center;
  flex: 1;
}

.navbar li.checkbox-center label {
  margin: 4px 8px;
}

.navbar li.checkbox-center label:last-child {
  margin-right: 0;
}
/*NAV BAR - END*/

.app-container {
    width: subtract(100vw, 8px);
    height: 100vh;
    max-width: subtract(100vw, 8px);
    max-height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: #111;
    margin: 8px;
}

.main-container {
    display: flex;
    flex-direction: row;
    flex: 1 1 0;
    min-height: 0;
    min-width: 0;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    overflow: hidden;
    margin-right: 0;
}

.column {
    flex: 1 1 0;
    min-width: 0;
    min-height: 0;
    overflow: auto;
    display: flex;
    flex-direction: column;
}

#file-column {
    min-width: 120px;
    max-width: 360px;
    width: 220px;
    background: #181818;
    border: 1px dashed #888;
    flex: none;
    transition: width 0.1s;
}

#file-directory {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

#left-column {
    display: flex;
    flex-direction: column;
    min-width: 180px;
    max-width: 100vw;
    flex: 1 1 0;
    min-height: 0;
    height: 100%;
    box-sizing: border-box;
    overflow: auto;
}

#editor {
    flex: 1 1 50%;
    max-height: 70%;
    min-height: 0;
    overflow: auto;
    border: 1px dashed #888;
}

#rhymezone {
    flex: 1 1 50%;
    max-height: 50%;
    min-height: 0;
    border: 1px dashed #888;
    /* border-radius: 4px; */
    margin-top: 8px;
    background: #181818;
    color: #fff;
    overflow: auto;
    padding: 12px;
    font-family: monospace;
}

/* Add styles for the advanced rhyme zone UI in #rhymezone */
#rhymezone .rz-adv-search-bar {
    display: flex;
    flex-direction: column;
    gap: 8px;
    /* align-items: center; */
    margin-bottom: 12px;
    background: #181818;
    padding-bottom: 8px;
    border-bottom: 1px dashed #888;
}
#rhymezone .rz-adv-search-bar input,
#rhymezone .rz-adv-search-bar select {
    background: #0f0f0f;
    color: #fff;
    border: 1px solid #888;
    border-radius: 3px;
    padding: 6px 10px;
    font-size: 1em;
}
#rhymezone .rz-adv-search-bar button {
    background: #005b41;
    color: #fff;
    border: 1px solid #81c784;
    border-radius: 3px;
    padding: 6px 16px;
    font-family: monospace;
    font-size: 1em;
    cursor: pointer;
    transition: background 0.2s;
}
#rhymezone .rz-adv-search-bar button:hover {
    background: #008170;
}
#rhymezone .rz-adv-message {
    color: #81c784;
    font-size: 1em;
    margin: 8px 0;
}
#rhymezone .rz-adv-message.error {
    color: #ff6961;
}
#rhymezone .rz-adv-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}
#rhymezone .rz-adv-word {
    background: #232d3f;
    color: #fff;
    border: 1px dashed #888;
    border-radius: 3px;
    padding: 4px 10px;
    font-size: 1em;
    margin-bottom: 4px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}
#rhymezone .rz-adv-word:hover {
    background: #81c784;
    color: #232d3f;
}

#right-column {
    min-width: 200px;
    max-width: 100%;
    flex: 1 1 0;
    box-sizing: border-box;
    overflow: auto;
}

#dragbar {
    width: 6px;
    min-width: 6px;
    max-width: 12px;
    cursor: ew-resize;
    z-index: 10;
    /* background: #232d3f; */
    /* border-left: 1px solid #888; */
    /* border-right: 1px solid #888; */
    flex-shrink: 0;
}

.dragbar {
    width: 6px;
    min-width: 6px;
    max-width: 12px;
    cursor: ew-resize;
    z-index: 10;
    background: none !important;
    flex-shrink: 0;
    transition: background 0.2s;
    border: none;
}
.dragbar:hover {
    background: none !important;
}

#chat-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #141414;
    border: 1px dashed #888;
    font-family: monospace;
    color: white;
    max-width: 100%;
    box-sizing: border-box;
}

#chat-messages {
    flex: 1;
    overflow-y: auto;
    /* padding: 4px; */
    font-size: 1em;
}

.chat-message {
    background: #0f0f0f;
    border: 1px solid #888;
    border-radius: 3px;
    padding: 6px 10px;
    word-break: break-word;
    color: #fff;
    font-family: monospace;
    max-width: 80%;
    width: fit-content;
    box-sizing: border-box;
    display: block;
    margin-left: 8px;
}

/* Remove extra margin/padding from markdown elements inside chat bubbles */
.chat-message p {
    margin-top: 0;
    margin-bottom: 0;
    padding: 4px;
}

/* .chat-message ul,
.chat-message ol {
    margin: 0 0 0 1.2em;
    padding: 0;
} */

.chat-message pre {
    margin: 4px 0;
    padding: 6px 10px;
    background: #232d3f;
    border-radius: 3px;
    font-size: 0.98em;
    overflow-x: auto;
}

.chat-message code {
    background: #232d3f;
    border-radius: 2px;
    padding: 2px 4px;
    font-size: 0.98em;
}

.chat-message.bot {
    align-self: flex-start;
    margin-right: auto;
    margin-top: 8px;
    margin-bottom: 32px;
    text-align: left;
}

.chat-message.user {
    align-self: flex-end;
    margin-top: 8px;
    margin-left: auto;
    margin-right: 8px;
    /* text-align: right; */
}

#chat-form {
    display: flex;
    border-top: 1px dashed #888;
    /* background: #232d3f; */
    padding: 6px;
}

#apikey-form {
    display: flex;
    /* border-bottom: 1px dashed #888; */
    align-items: center;
    padding: 6px;
}

#chat-input {
    flex: 1;
    background: #0f0f0f;
    border: 1px solid #888;
    color: #fff;
    font-family: monospace;
    font-size: 1em;
    padding: 6px 10px;
    border-radius: 3px;
    outline: none;
}

#chat-input:focus {
    border-color: #81c784;
}

#chat-form button {
    background: #0f0f0f;
    color: #fff;
    border: 1px solid #888;
    border-radius: 3px;
    margin-left: 8px;
    padding: 6px 16px;
    font-family: monospace;
    font-size: 1em;
    cursor: pointer;
    transition: background 0.2s;
}

#chat-form button:hover {
    background: #005b41;
    border-color: #81c784;
}

.cm-content .rhyme-highlight {
  font-weight: bold;
  color: #222;
}

.rz-adv-search-bar > div {
    flex: 1 1 0;
    display: flex;
    gap: 8px;
    min-width: 0;
}
.rz-adv-search-bar {
    width: 100%;
    margin: 0 auto 12px auto;
    box-sizing: border-box;
    align-items: stretch;
}
.rz-adv-search-bar > div,
.rz-adv-checkboxes {
    width: 100%;
    display: flex;
    gap: 16px;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}
.rz-adv-checkboxes {
    margin-top: 8px;
    margin-bottom: 0;
    padding: 0 0 0 0;
}
.rz-adv-table {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin: 0 auto 0 auto;
    border-collapse: collapse;
    background: #181818;
    color: #fff;
    font-family: monospace;
    font-size: 1em;
    table-layout: auto;
}
.rz-adv-results {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    box-sizing: border-box;
    overflow-x: auto;
}
.rz-adv-table th, .rz-adv-table td {
    border: 1px solid #888;
    padding: 6px 10px;
    text-align: left;
    word-break: break-word;
}
.rz-adv-table th {
    background: #232d3f;
    font-weight: bold;
}
.rz-adv-table tr:nth-child(even) {
    background: #202020;
}
.rz-adv-table tr:hover {
    background: #333;
}
.rz-adv-checkboxes label {
    font-size: 1em;
    color: #fff;
    font-family: monospace;
    margin-right: 12px;
    cursor: pointer;
}
.rz-adv-checkboxes input[type="checkbox"] {
    accent-color: #81c784;
    margin-right: 4px;
}
/* .rz-adv-table th:first-child, */
.rz-adv-table td:first-child {
    padding: 0 !important;
    color: #232d3f;      /* Dark by default */
    /* font-weight: bold; */
    letter-spacing: 0.5px;
    /* Add any other styles you want */
}

.rz-word-copy {
    color: white;
    font-size: 1.11em;
    /* font-weight: bold; */
    letter-spacing: 0.5px;
    border: 1.5px dashed #81c784;
    border-radius: 4px;
    padding: 4px 8px;
    margin: 4px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
    display: block;
    /* width: 100%; */
    box-sizing: border-box;
    user-select: none;
    text-align: left;
}
.rz-word-copy:hover, .rz-word-copy.copied {
    background: #81c784; /* Green on hover/copy */
    color: #181818;
    border-color: #005b41;
}

.rz-word-copy.copied {
    background: #62b8c0; /* Green when copied */
    color: #181818;
    border-color: #234244;
}

@media (max-width: 900px) {
    .main-container {
        flex-direction: column;
        gap: 4px;
    }
    .dragbar {
        display: none;
    }
    #file-column, #left-column, #right-column {
        min-width: 0 !important;
        max-width: 100vw !important;
        width: 100% !important;
        border-right: none;
        border-bottom: 1px solid #222;
        flex: none;
    }
    #file-directory {
        padding: 8px 4px;
    }
    #chat-container form#apikey-form {
        flex-direction: column;
        gap: 4px;
        align-items: stretch;
    }
    #apikey-form > * {
        width: 100%;
        margin-bottom: 4px;
    }
    .navbar, .navbar ul {
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        gap: 4px;
        padding-left: 4px;
        padding-right: 4px;
    }
    .navbar-apikey-form {
        margin-left: 0;
        width: 100%;
        justify-content: flex-end;
    }
}

@media (max-width: 600px) {
    .navbar ul {
        flex-direction: column;
        height: auto;
    }
    .main-container {
        flex-direction: column;
        height: auto;
        min-height: 0;
    }
    #left-column, #right-column {
        min-width: 0;
        max-width: 100vw;
        width: 100vw;
        flex: 1 1 0;
    }
    #dragbar {
        display: none;
    }
    .chat-message {
        max-width: 98vw;
        font-size: 0.95em;
    }
}