/* chat/assets/css/chat_style.css?v=0216a */

/* Reuse global reset and basic styles from assets/css/style.css via inheritance where possible,
   but define specific chat elements here. */

.chat-container {
    padding-bottom: calc(160px + env(safe-area-inset-bottom));
    /* Space for input bar + bottom nav + extra margin */
    display: flex;
    flex-direction: column;
}

/* Thread List Styles */
.thread-card {
    background: #fff;
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s;
    border-left: 5px solid #ccc;
    text-decoration: none;
    color: #333;
    display: block;
}

.thread-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.thread-title {
    font-size: 1.1em;
    font-weight: bold;
    margin-bottom: 5px;
    display: block;
}

.thread-meta {
    font-size: 0.8em;
    color: #888;
}

/* Thread Colors */
.thread-card.theme-black {
    border-left-color: #333;
}

.thread-card.theme-tsukasa {
    border-left-color: #005A5A;
}

.thread-card.theme-hayato {
    border-left-color: #006400;
}

.thread-card.theme-red {
    border-left-color: #e74c3c;
}

.thread-card.theme-yellow {
    border-left-color: #f1c40f;
}

.thread-card.theme-blue {
    border-left-color: #3498db;
}

.thread-card.theme-purple {
    border-left-color: #9b59b6;
}

.thread-card.theme-pink {
    border-left-color: #fd79a8;
}

/* Chat Room Styles */
.chat-messages {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 10px;
}

/* Bubble Container Layout */
.chat-bubble-container {
    display: flex;
    flex-direction: column;
    max-width: 80%;
    margin-bottom: 10px;
    /* Space between messages */
    position: relative;
    z-index: 1;
    /* Base z-index */
}

.chat-bubble-container.self {
    align-self: flex-end;
    align-items: flex-end;
    margin-left: auto;
    /* Push to right */
}

.chat-bubble-container.other {
    align-self: flex-start;
    align-items: flex-start;
    margin-right: auto;
    /* Push to left */
}

.chat-user-info {
    font-size: 0.75em;
    color: #888;
    margin-bottom: 4px;
    padding: 0 5px;
}

/* Bubble Styling */
.chat-bubble {
    padding: 10px 15px;
    border-radius: 18px;
    position: relative;
    word-wrap: break-word;
    overflow-wrap: anywhere;
    word-break: break-word;
    white-space: pre-wrap;
    /* Preserve newlines */
    font-size: 0.95em;
    line-height: 1.4;
    cursor: pointer;
    user-select: none;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    /* Subtle shadow for depth */
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.chat-bubble-container.self .chat-bubble {
    background: #005A5A;
    /* Tsukasa Base */
    color: white;
    border-bottom-right-radius: 4px;
    /* Messenger style */
}

.chat-bubble-container.other .chat-bubble {
    background: #e4e6eb;
    color: #050505;
    border-bottom-left-radius: 4px;
    /* Messenger style */
}

/* Chat Image Container within Bubble */
.chat-image-container {
    max-width: 100%;
    margin: -5px -10px 5px -10px;
    /* Pull image to edges of padding */
    border-radius: 12px 12px 0 0;
    /* Rounded top only initially */
    overflow: hidden;
}

/* Adjust radius based on position (if text follows or not) - handled by JS or generic styles */
/* But simpler: make image fit nicely inside current padding */
.chat-image-container {
    margin: 0;
    margin-bottom: 5px;
    border-radius: 8px;
}

.chat-image-thumb {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
    object-fit: cover;
    display: block;
}

/* Likes Badge */
.like-badge {
    font-size: 0.75em;
    background: #fff;
    color: #ff3b30;
    padding: 2px 6px;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    margin-top: -12px;
    /* Pull up to overlap bubble */
    z-index: 2;
    /* Sit on top of bubble */
    display: none;
    border: 1px solid #eee;
}

.like-badge.show {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.chat-bubble-container.self .like-badge {
    margin-right: -5px;
    /* Stick out a bit */
    align-self: flex-end;
}

.chat-bubble-container.other .like-badge {
    margin-left: -5px;
    /* Stick out a bit */
    align-self: flex-start;
}

/* Reply Context Box */
.reply-context {
    background: #f0f0f0;
    border-left: 3px solid #ccc;
    padding: 5px 10px;
    font-size: 0.8em;
    color: #555;
    margin-bottom: 5px;
    border-radius: 4px;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0.8;
}

.chat-bubble-container.self .reply-context {
    align-self: flex-end;
    text-align: right;
    border-left: none;
    border-right: 3px solid #005A5A;
}

/* Input Bar */
.chat-input-bar {
    box-sizing: border-box;
    position: fixed;
    bottom: 70px;
    bottom: calc(70px + constant(safe-area-inset-bottom));
    bottom: calc(70px + env(safe-area-inset-bottom));
    /* Above bottom nav */
    left: 0;
    right: 0;
    max-width: 460px;
    /* Ensure it doesn't span full width on desktop if container is constrained */
    margin: 0 auto;
    /* Center it */
    width: 100%;
    background: #fff;
    border-top: 1px solid #eee;
    padding: 10px;
    display: flex;
    flex-direction: column;
    /* Changed to allow stacking */
    gap: 10px;
    align-items: stretch;
    /* Stretch content */
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
    z-index: 100;
}

/* The row containing input and buttons */
.chat-input-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-input-bar textarea {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 10px 15px;
    height: 40px;
    line-height: 1.2;
    resize: none;
    font-family: inherit;
    outline: none;
    background: #f9f9f9;
}

.chat-input-bar textarea:focus {
    background: #fff;
    border-color: #005A5A;
}

.chat-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(to right, #006400, #005A5A);
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    transition: transform 0.1s;
    flex-shrink: 0;
    /* Prevent shrinking */
}

.chat-attach-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: transparent;
    color: #666;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
    flex-shrink: 0;
    /* Prevent shrinking */
}

.chat-attach-btn:hover {
    background: #f0f0f0;
}

.chat-send-btn:active {
    transform: scale(0.95);
}

.chat-options-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-preview-area {
    position: relative;
    margin-top: 5px;
    width: fit-content;
    display: none;
}

.chat-preview-img {
    max-height: 80px;
    border: 1px solid #ddd;
    border-radius: 8px;
    object-fit: cover;
}

.chat-preview-close {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 20px;
    height: 20px;
    background: #e74c3c;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}


/* Action Menu (Report/Reply) */
.bubble-actions {
    position: absolute;
    bottom: -30px;
    background: #333;
    color: white;
    border-radius: 8px;
    padding: 5px;
    font-size: 0.8em;
    display: none;
    z-index: 10;
    white-space: nowrap;
}

.bubble-actions span {
    padding: 5px 10px;
    cursor: pointer;
}

/* Header Gradient */
.header-gradient {
    background: linear-gradient(to right, #006400, #005A5A);
    color: white;
    padding: 15px;
    text-align: center;
    font-weight: bold;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* Ensure content is not hidden behind headers/footers */
.app-content {
    padding-top: 10px;
    -ms-overflow-style: none;
    /* IE and Edge */
    scrollbar-width: none;
    /* Firefox */
}

.app-content::-webkit-scrollbar {
    display: none;
    /* Chrome, Safari and Opera */
}

body {
    -ms-overflow-style: none;
    /* IE and Edge */
    scrollbar-width: none;
    /* Firefox */
}

body::-webkit-scrollbar {
    display: none;
    /* Chrome, Safari and Opera */
}

/* Switch Style Checkbox */
.switch-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
    padding: 10px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.switch-label {
    font-weight: 500;
    font-size: 1rem;
    color: #333;
}

.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    -webkit-transition: .4s;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    -webkit-transition: .4s;
    transition: .4s;
}

input:checked+.slider {
    background-color: #005A5A;
}

input:focus+.slider {
    box-shadow: 0 0 1px #005A5A;
}

input:checked+.slider:before {
    -webkit-transform: translateX(22px);
    -ms-transform: translateX(22px);
    transform: translateX(22px);
}

/* Rounded sliders */
.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

/* Modal Improvements */
.custom-modal-header .close {
    font-size: 1.5rem;
    padding: 0;
    margin: 0;
    color: white;
    opacity: 0.8;
    width: auto;
    /* Fix for global button width: 100% */
    background: transparent;
    /* Fix for global button background */
    box-shadow: none;
    /* Fix for global button shadow */
}

.custom-modal-header .close:hover {
    opacity: 1;
}

.btn-gradient-fj {
    background: linear-gradient(to right, #006400, #005A5A);
    color: white;
    border: none;
}

.btn-gradient-fj:hover {
    background: linear-gradient(to right, #004d00, #004d4d);
    color: white;
}

/* Participant List Styles */
.participant-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
}

.participant-item:last-child {
    border-bottom: none;
}

.participant-info {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.participant-name {
    font-weight: bold;
    font-size: 0.95em;
    color: #333;
}

.participant-id {
    font-size: 0.8em;
    color: #888;
}

.participant-actions {
    margin-left: 10px;
}

.btn-block-user,
.btn-unblock-user {
    border: none;
    border-radius: 50px;
    padding: 5px 12px;
    font-size: 0.8em;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
}

.btn-block-user {
    background: #ffebee;
    color: #e74c3c;
}

.btn-block-user:hover {
    background: #ffcdd2;
}

.btn-unblock-user {
    background: #eceff1;
    color: #607d8b;
}

.btn-unblock-user:hover {
    background: #cfd8dc;
}

/* Reply Preview specific styles */
.chat-reply-preview {
    box-sizing: border-box;
    position: fixed;
    /* Bottom: InputBar Bottom (70px + safe-area) + InputBar Height (~62px) */
    bottom: 150px;
    bottom: calc(150px + constant(safe-area-inset-bottom));
    bottom: calc(150px + env(safe-area-inset-bottom));
    left: 0;
    right: 0;
    margin: 0 auto;
    width: 100%;
    /* Match input bar constraints */
    max-width: 460px;
    background: rgba(255, 255, 255, 0.95);
    padding: 10px;
    z-index: 90;
    /* Just below input bar (100) but above everything else */
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
    border: 1px solid #eee;
    border-bottom: none;
    backdrop-filter: blur(5px);
}

/* Mention Suggestions */
.chat-mention-suggestions {
    box-sizing: border-box;
    position: fixed;
    bottom: 170px;
    bottom: calc(170px + constant(safe-area-inset-bottom));
    bottom: calc(170px + env(safe-area-inset-bottom));
    left: 0;
    right: 0;
    margin: 0 auto;
    width: 100%;
    max-width: 460px;
    background: white;
    border: 1px solid #ccc;
    border-radius: 5px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 200;
    box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.1);
}

#msgInput {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

/* Chat Tabs */
.chat-tabs {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
    gap: 10px;
}

.chat-tab {
    padding: 10px 20px;
    border: 1px solid #ddd;
    border-radius: 20px;
    background: #f9f9f9;
    cursor: pointer;
    font-weight: bold;
    color: #666;
    transition: all 0.2s;
    flex: 1;
    /* Make tabs distribute evenly */
    text-align: center;
    max-width: 150px;
}

.chat-tab.active {
    background: linear-gradient(to right, #006400, #005A5A);
    color: white;
    border-color: transparent;
}

/* Unread Dot */
.unread-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    background-color: #e74c3c;
    border-radius: 50%;
    margin-left: 8px;
    vertical-align: middle;
}

/* iframe (Floating Window) Fixes */
html.is-iframe .chat-input-bar {
    bottom: 0 !important;
}

html.is-iframe .chat-container {
    padding-bottom: 120px !important;
}

html.is-iframe .chat-reply-preview {
    bottom: 80px !important;
}

html.is-iframe .chat-mention-suggestions {
    bottom: 100px !important;
}

html.is-iframe .header-gradient {
    padding: 10px 15px !important;
}

html.is-iframe .app-content {
    padding-top: 5px !important;
}