:root {
    --bg-body: #f8f9fa;
    --bg-sidebar: #f1f3f5;
    --border-subtle: rgba(0, 0, 0, 0.08);
    --bg-chat-surface: #ffffff;
    --bg-bubble-user: #f1f3f5;
    --text-bubble-user: #212529;
    --bg-bubble-ai: transparent;
    --text-bubble-ai: #212529;
    --bg-input: #ffffff;
}

.app-shell {
    min-height: 100vh;
    background: var(--bg-body);
}

.sidebar {
    width: 240px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    align-self: flex-start;
    height: 100vh;
    max-height: 100vh;
    overflow: hidden;
    padding: 0 12px;
    z-index: 20;
}

.sidebar-header {
    padding: 12px 0;
    border-bottom: 1px solid var(--border-subtle);
    background: transparent;
    flex-shrink: 0;

    margin: 0 -12px;
    padding-left: 12px;
    padding-right: 12px;
}

.sidebar-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.sidebar-collapsed .sidebar {
    display: none;
}

.sidebar-collapsed .chat-shell {
    margin-left: 0;
}

.sidebar-section-title {
    font-size: 0.8rem;
    text-transform: uppercase;
    color: var(--text-secondary-color);
    margin-top: 8px;
    margin-bottom: 4px;
}

.sidebar-footer {
    padding: 8px 0 12px;
    border-top: 1px solid var(--border-subtle);
    background: transparent;
    flex-shrink: 0;
    position: sticky;
    bottom: 0;
}

.sidebar-footer-inner {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--text-secondary-color);
}

.brand-area {
    gap: 8px;

    flex-grow: 1;
}

.brand-logo {
    height: 32px;

    text-align: center;
    width: 100%;
}

.modified-btn {
    border: none;
    font-size: 18px;
    --bs-btn-padding-y: 0.15rem;
    --bs-btn-padding-x: 0.4rem;
}

.modified-btn:hover,
.modified-btn:focus,
.modified-btn.show,
.modified-btn:active,
.modified-btn:first-child:active{
    background-color: rgba(108, 117, 125, .15);
    color: inherit;
}

.modified-btn:focus-visible{
    color: inherit;
    background-color: rgba(108, 117, 125, .15);;
    border-color: var(--bs-btn-hover-border-color);
    outline: 0;
    box-shadow: var(--bs-btn-focus-box-shadow);
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 0px;
    margin-top: 4px;
    padding-bottom: 4px;
}

.history-item {
    background: transparent;
    border: none;
    color: var(--text-main);
    text-align: left;
    width: 100%;
    padding: 0.4rem 0.5rem;
    border-radius: 0.5rem;
    font-size: 0.8rem;
    transition: background 0.15s ease;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.history-item:hover,
.history-item.active {
    background: rgba(25, 135, 84, .09);
}

body.theme-dark .history-item:hover,
body.theme-dark .history-item.active {
    background: rgba(73, 90, 254, 0.2);
}

.user-dropdown-toggle {
    background: transparent;
    border-radius: 0.75rem;
    padding: 6px 10px;
    font-size: 0.85rem;
}

.user-dropdown-toggle:focus {
    box-shadow: none;
    border:none;
}

.user-avatar-placeholder {
    width: 24px;
    height: 24px;
    border-radius: 999px;
    background: #dedede;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-dropdown-arrow {
    font-size: 0.9rem;
    opacity: 0.8;
}

.dropdown-menu {
    font-size: 0.85rem;
    border-radius: .7rem;
    padding: 4px;
    transform-origin: top;
    opacity: 0;
    transform: scale(0.98) translateY(-2px);
    transition: opacity 0.12s ease-out, transform 0.12s ease-out;
    min-width: -webkit-fill-available;;
    max-width: 260px;
    box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.175);
}

.dropdown-menu.show {
    opacity: 1;
    transform: scale(1) translateY(0);
}

.dropdown-item {
    border-radius: 0.4rem;
    padding: 0.35rem 0.6rem;
    white-space: nowrap;
}

.dropdown-item i {
    font-size: 0.9rem;
}

.dropdown-item.active{
    background: rgba(25, 135, 84, .09);
    color:var(--text-bubble-user);
}

.dropdown-item:focus {
    background: rgba(25, 135, 84, .09);
    color: var(--text-main);
}

.dropdown-modified-btn{
    font-size: 12px;
}

.dropdown-modified-btn:hover,
.dropdown-modified-btn:focus{
    background-color: rgba(108, 117, 125, .15);
    color: inherit;
}

.model-toggle {
    background: transparent;
    border: none;
    padding: 0;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-main);
    display: inline-flex;
    align-items: flex-end;
    gap: 4px;
}

.model-toggle:focus,
.model-toggle:active {
    outline: none;
    box-shadow: none;
}

.model-toggle-arrow {
    font-size: 0.9rem;
    opacity: 0.7;
}

.chat-shell {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-chat);
    height: 100vh;    
    overflow: hidden; 
}

.chat-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    position: sticky;
    top: 0;
    z-index: 10;
}

.chat-topbar-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-topbar-toggle-btn {
    display: none;
}

.chat-scroll {
    flex: 1;
    padding: 16px 16px 16px;
    overflow-y: auto;
}

.chat-inner {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-messages {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.chat-input-shell {
    padding: 8px 16px 16px;
    margin-top: auto;
    background: linear-gradient(
        to top,
        var(--bg-chat-surface),
        rgba(0, 0, 0, 0)
    );
    z-index: 5;
    padding-bottom: 24px;
}

.chat-input-inner {
    max-width: 900px;
    margin: 0 auto;
    background: var(--bg-chat-surface);
    border-radius: 1rem;
    padding: 10px 10px;
    border: 1px solid var(--border-subtle);
    transition: height 0.15s ease;
}

.prompt-input {
    background: var(--bg-input);
    border: none;
    color: var(--text-main);
    font-size: 0.9rem;
    width: 100%;
    padding: 0.6rem .75rem;
    resize: none;                     
    overflow-y: hidden;           
    line-height: 1.45;
    max-height: 180px;            
    transition: height 0.15s ease;
}

.prompt-input.expanded {
    overflow-y: auto;               
}
.prompt-input:focus {
    box-shadow: none;
    border-color: #495afe;
}

.small-hint {
    font-size: 0.75rem;
    color: var(--text-secondary-color);
}

.bubble {
    padding: 0.75rem 0.9rem;
    border-radius: 0.75rem;
    max-width: 60%;
    font-size: 0.9rem;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.bubble-user {
    align-self: flex-end;
    background: var(--bg-bubble-user);
    color: var(--text-bubble-user);
    border-bottom-right-radius: 0.2rem;
}

.bubble-ai {
    align-self: flex-start;
    background: var(--bg-bubble-ai);
    color: var(--text-bubble-ai);
    border-bottom-left-radius: 0.2rem;
    border: 1px solid var(--border-subtle);
}

.image-reply-preview {
    border-radius: 0.75rem;
    overflow: hidden;
    border: 1px dashed var(--border-subtle);
    margin-top: 0.75rem;
    min-height: 140px;
    max-width: 260px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff10;
}

.image-reply-preview img {
    width: 100%;
    height: auto;
    display: block;
}

#newChatBtn {
    font-size: 14px;
}

.grouping-image {
    position: relative;
    width: max-content; 
    display: block;
}

.grouping-image a {
    position: absolute;
    bottom: 5px;
    right: 5px;
    color: #fff;
}

a.logo-url {
    text-decoration: none;
}

#emptyState{
    transition: transform 0.18s ease-out, opacity 0.18s ease-out;
}

#emptyState h1{
    margin-top: 180px;
    font-size: 1.5rem !important;
}

#card-currency .card-header {
    background-color: #85d996;
}

.template-preview-card {
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    border: 1px solid #dee2e6;
}

.template-preview-card:hover {
    border-color: #85d996;
    box-shadow: 0 0 0.5rem rgba(133, 217, 150, 0.5) !important;
}

.currency-radio-input:checked + .template-preview-card {
    border-color: #198754; 
    background-color: #e2f9e6;
    box-shadow: 0 0 0.2rem rgba(25, 135, 84, 0.5);
}

.padding-currency {
    padding: var(--bs-card-cap-padding-y) var(--bs-card-cap-padding-x);
}

.badge-aspect-ratio {
    top: 5px;
    left: 5px;
}

.modal-body .badge-aspect-ratio {
    margin: var(--bs-modal-padding);
}

.loading-spinner-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px;
    background-color: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 5px;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    animation: rotate 2s linear infinite;
}

.loading-spinner .path {
    stroke: #85d996;
    stroke-linecap: round;

    stroke-dasharray: 1, 150; 
    stroke-dashoffset: 0;
    animation: dash 1.5s ease-in-out infinite;
}

@keyframes rotate {
    100% {
        transform: rotate(360deg);
    }
}

@keyframes dash {
    0% {
        stroke-dasharray: 1, 150;
        stroke-dashoffset: 0;
    }
    50% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -35;
    }
    100% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -124;
    }
}

@keyframes animate8345 {
  0%,100% {
    filter: hue-rotate(0deg);
  }

  50% {
    filter: hue-rotate(360deg);
  }
}

.loader {
  color: rgb(0, 0, 0);
  background: linear-gradient(to right, #2d60ec, #85d996);
  font-size: 15px;
  -webkit-text-fill-color: transparent;
  -webkit-background-clip: text;
  animation: animate8345 9s linear infinite;
  font-weight: bold;
}

.nav-link-admin {
    font-size: 14px;
    padding: 0.5rem;
}

.nav-link-admin:not(.active) {
    color: rgba(var(--bs-success-rgb)) !important;
}

.email-search-popup {
    position: absolute;
    z-index: 1050;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    max-height: 300px;
    overflow-y: auto;
}
.email-item:hover {
    background-color: #f8f9fa;
    cursor: pointer;
}
.email-item:selected {
    background-color: #0d6efd;
    color: white;
}

.htmx-indicator {
    display: none;
}
.htmx-request .htmx-indicator {
    display: inline-block;
}
.htmx-request .search-icon {
    display: none;
}

@media (max-width: 991.98px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100vh;
        z-index: 30;
        box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
        transform: translateX(-100%);
        opacity: 0;
        pointer-events: none;
        transition: transform 0.18s ease-out, opacity 0.18s ease-out;
    }
    .sidebar.sidebar-mobile-open {
        transform: translateX(0);
        opacity: 1;
        pointer-events: auto;
    }
    .chat-topbar-toggle-btn {
        display: inline-flex;
    }
    .bubble {
        max-width: 80%;
    }
}
@media (max-width: 991.98px) {
    .chat-inner {
        max-width: 100%;
    }
}