/* Base styles */
.aim-window {
    display: flex;
    flex-direction: row;
    height: 100%;
    width: 100%;
    font-family: Arial, sans-serif;
    background: var(--window_main-background);
    color: var(--window_main-color);
}

.aim-room-list {
    width: 12.5rem;
    /* ~200px */
    min-width: 9.375rem;
    /* ~150px */
    border-right: 0.0625rem solid #d3d3d3;
    /* ~1px */
    background: var(--desktop_element-background);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.aim-room-list-header {
    padding: 0.625rem;
    /* ~10px */
    border-bottom: 0.0625rem solid #d3d3d3;
    /* ~1px */
}

.aim-room-list-header h3 {
    margin: 0;
    font-size: 1rem;
    /* ~16px */
    font-weight: 600;
}

.aim-room-list-items {
    margin-top: 0;
    padding-top: 0;
    list-style: none;
    /* Added for clarity */
}

.aim-room-list-item {
    display: flex;
    align-items: center;
    padding: 0.625rem 0.9375rem;
    /* ~10px 15px */
    cursor: pointer;
    font-size: 0.875rem;
    /* ~14px */
    transition: background 0.2s;
}

.aim-room-list-item-name {
    flex: 1;
    font-weight: 500;
}

.aim-room-list-item:hover {
    background: var(--desktop_element_hover-background);
}

.aim-room-list-item-score {
    margin: 0 0.625rem;
    /* ~10px */
    color: #6b7280;
    font-size: 0.75rem;
    /* ~12px */
    background: #e5e7eb;
    padding: 0.125rem 0.5rem;
    /* ~2px 8px */
    border-radius: 0.75rem;
    /* ~12px */
}

.aim-room-close-btn {
    display: none;
    /* Unchanged */
    font-size: 0.875rem;
    /* ~14px */
    cursor: pointer;
    padding: 0.125rem 0.5rem;
    /* ~2px 8px */
    border-radius: 0.25rem;
    /* ~4px */
}

.aim-room-close-btn:hover {
    background: #fee2e2;
}

.aim-room-list-item:hover .aim-room-close-btn {
    display: inline-block;
    /* Unchanged */
}

.aim-room-active {
    font-weight: bold;
    /* Unchanged */
}

.aim-room-active .aim-room-list-item-score {
    font-weight: 600;
    background: #bfdbfe;
    color: #1e40af;
}

.aim-room-list-footer {
    padding: 0.625rem;
    /* ~10px */
    border-top: 0.0625rem solid #d3d3d3;
    /* ~1px */
    display: flex;
    flex-direction: column;
}

/* Commented out unused rules */
/*
.aim-chat-area-context {
    display: none; 
    flex: 1;
    flex-direction: column;
}
.aim-chat-area-context.active {
    display: flex;
}
*/

.aim-chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
}

.aim-messages-header {
    position: absolute;
    top: 0;
    left: 0;
    background: var(--desktop_element-background);
    z-index: 10;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    /* ~10px, added for consistency */
}

.aim-close-chat-btn {
    position: absolute;
    right: 0.3125rem;
    /* ~5px */
}

.no-open-ponds {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
    /* ~18px */
    text-align: center;
    padding: 0.5rem;
    /* ~8px, added for spacing */
}

.aim-chat-area {
    flex: 1;
    overflow-y: auto;
    /* ~50px */
    padding: 0.5rem;
    /* ~8px, uncommented and adjusted */
}

.aim-typing {
    height: 1.25rem;
    /* ~20px */
    padding-left: 0.3125rem;
    /* ~5px */
}

.aim-no-messages {
    text-align: center;
    color: #808080;
    font-size: 0.875rem;
    /* ~14px, added for consistency */
}

.aim-messages {
    position: relative;
    top: 1.25rem;
    /* ~20px */
}

.aim-message-controls {
    padding: 0.5rem;
    /* ~8px left, right, bottom */
    border-top: 0.0625rem solid #d3d3d3;
    /* ~1px */
    box-sizing: border-box;
    background: var(--desktop_divider-background);
}

.aim-message-form {
    display: flex;
    align-items: flex-start;
    flex-direction: column;
}

.aim-input {
    flex-grow: 1;
    margin-right: 0.5rem;
    /* ~8px */
    padding: 0.25rem;
    /* ~4px */
    border: 0.0625rem solid #c0c0c0;
    /* ~1px */
    border-radius: 0.1875rem;
    /* ~3px */
    width: 100%;
}

.aim-send-btn {
    padding: 0.375rem 0.75rem;
    /* ~6px 12px */
    background-color: #0084ff;
    color: white;
    border: none;
    border-radius: 0.1875rem;
    /* ~3px */
    cursor: pointer;
    height: 2.5rem;
    /* ~40px */
    opacity: 0.5;
}

.aim-message-sender {
    display: flex;
    flex-direction: row;
    width: 100%;
}

.aim-send-btn:hover {
    background-color: #0056b3;
}

.aim-from,
.aim-to {
    display: none;
    /* Unchanged */
}

.aim-user-list-area {
    width: 12.5rem;
    /* ~200px */
    min-width: 9.375rem;
    /* ~150px */
    border-left: 0.0625rem solid #d3d3d3;
    /* ~1px */
    background: var(--desktop_element-background);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.aim-user-list-header {
    padding: 0.625rem;
    /* ~10px */
    border-bottom: 0.0625rem solid #d3d3d3;
    /* ~1px */
}

.aim-user-list-header h3 {
    margin: 0;
    font-size: 1rem;
    /* ~16px */
    font-weight: 600;
}

.aim-user-list-items {
    list-style: none;
    padding: 0;
    margin: 0;
}

.aim-user-item {
    display: flex;
    align-items: center;
    padding: 0.5rem 1.25rem;
    /* ~8px 20px */
    cursor: pointer;
}

.aim-profile-picture {
    width: 2rem;
    /* ~32px */
    height: 2rem;
    margin-right: 0.5rem;
    /* ~8px */
    display: flex;
    align-items: center;
    justify-content: center;
}

.aim-profile-picture svg {
    width: 100%;
    height: 100%;
}

.aim-user-item-text {
    font-size: 0.875rem;
    /* ~14px */
}

.aim-user-item:hover {
    background: var(--desktop_element_hover-background);
}

/* Additional base styles */
.purple {
    color: purple;
}

.datetime {
    font-style: italic;
    opacity: 0.77;
    font-size: clamp(0.5rem, 1vw, 1.125rem);
    /* ~8px to 18px */
    text-decoration: italic;
}

.aim-chat-controls {
    position: absolute;
    top: 0.3125rem;
    /* ~5px */
    right: 0.3125rem;
    /* ~5px */
    display: flex;
    gap: 0.625rem;
    /* ~10px */
}

.file-preview {
    position: relative;
    width: 100%;
}

.aim-chat-message {
    display: flex;
    padding: 0.5rem 1rem;
    /* ~8px 16px */
    position: relative;
    transition: background 0.2s;
}

.aim-chat-message-profile-picture-img {
    width: 2.5rem;
    /* ~40px */
    height: 2.5rem;
    border-radius: 50%;
    margin-right: 0.75rem;
    /* ~12px */
    background: #e5e7eb;
    object-fit: cover;
    flex-shrink: 0;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.1);
    /* ~2px 4px */
    user-select: none;
}

.aim-chat-message:hover {
    background: var(--desktop_element_hover-background);
}

.aim-profile-picture {
    cursor: pointer;
    user-select: none;
}

.aim-profile-picture svg {
    width: 2.5rem;
    /* ~40px */
    height: 2.5rem;
    border-radius: 50%;
    margin-right: 0.75rem;
    /* ~12px */
}

.aim-message-header {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    /* ~4px */
    margin-bottom: 0.125rem;
    /* ~2px */
}

.aim-message-flair span {
  cursor: pointer;
}

.aim-message-flair span:hover {
  transform: scale(1.2);
}

.aim-sender {
    font-weight: 600;
    font-size: 0.875rem;
    /* ~14px */
}

.aim-timestamp {
    color: #6b7280;
    font-size: 0.75rem;
    /* ~12px */
}

.aim-message-meta {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    /* ~4px */
}

.aim-hover-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 0;
    background: var(--desktop_element-background);
    border: 0.0625rem solid #e5e7eb;
    /* ~1px */
    border-radius: 0.25rem;
    /* ~4px */
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.1);
    /* ~2px 4px */
}

.aim-chat-message:hover .aim-hover-menu {
    display: flex;
}

.aim-hover-menu button {
    padding: 0.375rem 0.75rem;
    /* ~6px 12px */
    border: none;
    cursor: pointer;
    font-size: 1.1875rem;
    /* ~19px */
}

.aim-hover-menu button:hover {
    background: var(--desktop_element_hover-background);
}

.aim-message-content {
    font-size: 0.875rem;
    /* ~14px */
    line-height: 1.4;
    word-break: break-word;
}

.aim-context-menu {
    position: absolute;
    background: var(--desktop_element-background);
    border: 0.0625rem solid #e5e7eb;
    /* ~1px */
    border-radius: 0.25rem;
    /* ~4px */
    box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.15);
    /* ~4px 8px */
    z-index: 1000;
    min-width: 11.25rem;
    /* ~180px */
    font-size: 0.8125rem;
    /* ~13px */
}

.aim-context-menu-item {
    padding: 0.5rem 1rem;
    /* ~8px 16px */
    cursor: pointer;
    display: flex;
    align-items: center;
}

.aim-context-menu-item:hover {
    background: var(--desktop_element_hover-background);
}

.aim-editable-container {
    position: relative;
    padding: 0.5rem;
    /* ~8px */
    border: 0.0625rem solid #e5e7eb;
    /* ~1px */
    border-radius: 0.25rem;
    /* ~4px */
    background: var(--desktop_element-background);
    margin: 0.25rem 0;
    /* ~4px */
    width: 100%;
}

.aim-message-content[data-editing="true"] {
    outline: none;
    min-height: 1.4em;
}

.aim-edit-hint {
    font-size: 0.75rem;
    /* ~12px */
    color: #6b7280;
    margin-top: 0.25rem;
    /* ~4px */
    display: flex;
    align-items: center;
    gap: 0.5rem;
    /* ~8px */
}

.aim-edit-hint-action {
    color: #3b82f6;
    cursor: pointer;
    text-decoration: underline;
}

.aim-edit-hint-action:hover {
    color: #1d4ed8;
}

.aim-reply-box {
    display: flex;
    align-items: center;
    padding: 0.5rem;
    border-left: 0.25rem solid #3b82f6;
    border-radius: 0.25rem;
    margin-bottom: 0.5rem;
    font-size: 0.8125rem;
}

.aim-reply-header {
    font-weight: 600;
    margin-right: 0.5rem;
    /* ~8px */
}

.aim-reply-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.aim-reply-cancel {
    padding: 0.25rem 0.5rem;
    /* ~4px 8px */
    background: none;
    border: none;
    color: #6b7280;
    cursor: pointer;
    font-size: 0.75rem;
    /* ~12px */
}

.aim-reply-cancel:hover {
    color: #dc2626;
}

.aim-reply-indicator {
    display: flex;
    align-items: center;
    padding: 0.25rem 0.5rem;
    /* ~4px 8px */
    background: var(--desktop_element-background);
    border-left: 0.125rem solid #3b82f6;
    /* ~2px */
    border-radius: 0.25rem;
    /* ~4px */
    margin-bottom: 0.25rem;
    /* ~4px */
    font-size: 0.75rem;
    /* ~12px */
    max-width: 18.75rem;
    /* ~300px */
}

.aim-reply-sender {
    font-weight: 600;
    color: #3b82f6;
    cursor: pointer;
    margin-right: 0.5rem;
    /* ~8px */
}

.aim-reply-sender:hover {
    text-decoration: underline;
}

.aim-reply-content {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.aim-room-close-btn {
    display: none;
    /* Unchanged */
    margin-left: 0.5rem;
    /* ~8px */
    padding: 0.125rem 0.375rem;
    /* ~2px 6px */
    /* ~3px */
    cursor: pointer;
    font-size: 0.75rem;
    /* ~12px */
}

.aim-room-close-btn:hover {
    background-color: #d9363e;
}

.aim-room-item:hover .aim-room-close-btn {
    display: inline-block;
    /* Unchanged */
}

.emoji-only {
    font-size: 2.5rem;
    /* Unchanged */
    line-height: 1.2;
    text-align: left;
}

.big-emoji {
    display: inline-block;
    margin: 0 0.125rem;
    /* ~2px */
}

.ui-widget-content {
    background: var(--desktop_element-background) !important;
}

.cardContainer {
    max-width: 50rem;
    /* ~800px */
}

.toggle-room-list {
    display: none;
    /* Unchanged */
}

.toggle-user-list {
    display: none;
    /* Unchanged */
}

.aim-chat-title {
    padding-left: 0.5rem;
}

.aim-hover-menu-svg-icon {
    width: 24px;
    height: 24px;
}

.aim-message-reactions {
  /* display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  */
  gap: 0.25rem;
}

.aim-message-reaction {
    background: var(--desktop_element-background);
    border: 0.0625rem solid #e5e7eb;
    /* ~1px */
    border-radius: 0.25rem;
    /* ~4px */
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.1);
    /* ~2px 4px */
    padding: 0.25rem 0.5rem;
    /* ~4px 8px */
    font-size: 1rem;
    /* ~12px */
    white-space: nowrap;
    z-index: 10;
    cursor: pointer;
}

/* Mobile media query */
@media (max-width: 767px) and (pointer: coarse) and (hover: none) {
    html {
        font-size: 16px;
        /* Base font size */
    }

    .aim-window {
        flex-direction: row;
        width: 100%;
        /* Changed from 300% to fix gaps */
        height: 100%;
        position: relative;
        overflow: hidden;
        display: flex;
        transition: none;
        /* Remove transform for wrapper */
    }

    .aim-room-list {
        position: absolute;
        top: 0;
        left: 0;
        width: 80%;
        /* ~300px on 375px viewport */
        height: 100%;
        transform: translateX(-100%);
        /* Off-screen left */
        transition: transform 0.3s ease;
        border-right: none;
        border-bottom: 0.0625rem solid #d3d3d3;
        /* ~1px */
        padding: 0;
        /* Remove padding to reduce gaps */
        background: var(--desktop_element-background);
        z-index: 10;
    }

    .aim-chat-container {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        /* Full viewport width */
        height: 100%;
        transform: translateX(0);
        /* Center by default */
        transition: transform 0.3s ease;
        padding: 0;
        /* Remove padding to reduce gaps */
        z-index: 5;
    }

    .aim-user-list-area {
        position: absolute;
        top: 0;
        right: 0;
        width: 80%;
        /* ~300px on 375px viewport */
        height: 100%;
        transform: translateX(100%);
        /* Off-screen right */
        transition: transform 0.3s ease;
        border-left: none;
        border-top: 0.0625rem solid #d3d3d3;
        /* ~1px */
        padding: 0;
        /* Remove padding to reduce gaps */
        background: var(--desktop_element-background);
        z-index: 10;
    }

    .pond-button-bar {
        background-color: var(--desktop_element-background);
        position: fixed;
        top: 53px;
        width: 100%;
        height: 35px;
        z-index: 99999;
    }

    /* Show room list when active */
    .aim-window.show-room-list .aim-room-list {
        transform: translateX(0);
    }

    .aim-window.show-room-list .aim-chat-container {
        transform: translateX(80%);
    }

    .aim-window.show-room-list .aim-user-list-area {
        transform: translateX(100%);
    }

    /* Show user list when active */
    .aim-window.show-user-list .aim-room-list {
        transform: translateX(-100%);
    }

    .aim-window.show-user-list .aim-chat-container {
        transform: translateX(-80%);
    }

    .aim-window.show-user-list .aim-user-list-area {
        transform: translateX(0);
    }

    /* Touch-friendly sizes */
    .joinPond {
        font-size: 0.875rem;
        /* ~14px */
        padding: 0.625rem;
        /* ~10px, ~36px tap target */
        width: 100%;
    }

    .customPondName {
        font-size: 0.875rem;
        /* ~14px */
        padding: 0.625rem;
        /* ~10px */
        width: 100%;
    }

    .aim-send-btn {
        font-size: 0.875rem;
        /* ~14px */
        padding: 0.625rem;
        /* ~10px, ~36px tap target */
        width: 4.5rem;
        /* ~40px */
        height: 3rem;
    }

    .aim-close-chat-btn {
        font-size: 0.875rem;
        /* ~14px */
        padding: 0.625rem;
        /* ~10px, ~36px tap target */
    }

    .aim-chat-title {
        font-size: 1rem;
        /* ~16px, reduced */
    }

    .aim-no-messages,
    .aim-messages p {
        font-size: 0.75rem;
        /* ~12px, reduced */
        padding: 0.375rem;
        /* ~6px */
    }
    .no-open-ponds {
        padding-top: 50px;
        
    }

    .no-open-ponds p {
        font-size: 1.4rem;
    }

    /* Ensure no extra margins/padding */
    .aim-room-list-header,
    .aim-user-list-header,
    .aim-message-controls {
        padding: 0;
        /* ~8px, reduced */
    }

 
    .aim-room-list-item,
    .aim-user-item {
        padding: 0.375rem 0.75rem;
        /* ~6px 12px, reduced */
    }

    .aim-close-chat-btn {
        position: fixed;
        right: calc(50% - 3.25rem);
        display: none;
        /* ~5px */
    }

    .aim-close-pond-chat-btn {
        display: flex !important;
        position: fixed;
        right: calc(50% - 3.25rem);
        height: 35px;
        /* ~5px */
        top: 52px !important;
        justify-content: center;
        align-items: center;
        z-index: 999999;

        /* ~10px */
    }

    .toggle-room-list {
        display: flex;
        position: fixed;
        top: 50px;
        left: 0;
        z-index: 999999;
        /* 

        toggleRoomListBtn.style.position = 'fixed';
        toggleRoomListBtn.style.top = '4rem';
        toggleRoomListBtn.style.left = '0.5rem';
        toggleRoomListBtn.style.padding = '0.5rem';
        toggleRoomListBtn.style.zIndex = '15000';
        */


    }

    .toggle-user-list {
        display: flex;
        position: fixed;
        top: 50px;
        right: 0;
        z-index: 999999;
        /* 
        
                toggleUserListBtn.style.position = 'fixed';
        toggleUserListBtn.style.top = '4rem';
        toggleUserListBtn.style.right = '0.5rem';
        toggleUserListBtn.style.padding = '0.5rem';
        toggleUserListBtn.style.zIndex = '15000';

        
        */
    }

    .aim-messages-header {
        top: 25px;
    }

    .aim-reply-sender {
        font-size: 0.875rem;
        /* ~14px, reduced */
    }

    .aim-reply-content {
        font-size: 0.75rem;
        /* ~12px, reduced */
        max-width: calc(100% - 3rem);
        /* ~48px for padding */
    }

    .aim-hover-menu-item > i {
        font-size: 1.125rem;
        /* ~18px, reduced */
    }

    .aim-reply-header {
        font-size: 0.875rem;
    }


}

/* custom decorations for text */

/* Colors */
.message-decoration-color-red { color: red; }
.message-decoration-color-blue { color: blue; }
.message-decoration-color-green { color: green; }
.message-decoration-color-yellow { color: yellow; }
.message-decoration-color-purple { color: purple; }
.message-decoration-color-orange { color: orange; }
.message-decoration-color-black { color: black; }
.message-decoration-color-white { color: white; }
.message-decoration-color-gray { color: gray; }
.message-decoration-color-cyan { color: cyan; }
.message-decoration-color-magenta { color: magenta; }
.message-decoration-color-pink { color: pink; }

/* Font styles */
.message-decoration-bold { font-weight: bold; }
.message-decoration-italic { font-style: italic; }
.message-decoration-underline { text-decoration: underline; }
.message-decoration-strike { text-decoration: line-through; }

/* Blink effect */
@keyframes message-decoration-blink-keyframes {
  50% { visibility: hidden; }
}
.message-decoration-blink {
  animation: message-decoration-blink-keyframes 1s step-start infinite;
}

/* Hidden (reveal on hover) */
.message-decoration-hidden { visibility: hidden; }
.message-decoration-hidden:hover { visibility: visible; }

/* Dim effect */
.message-decoration-dim { opacity: 0.5; }

/* Rainbow letters */
.message-decoration-rainbow {
  display: inline-block;
  background: linear-gradient(
    90deg,
    red,
    orange,
    yellow,
    green,
    cyan,
    blue,
    violet,
    red
  );
  background-size: 400%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: rainbow-shift 8s linear infinite;
}

@keyframes rainbow-shift {
  0%   { background-position: 0% 50%; }
  100% { background-position: 100% 50%; }
}
