body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        Helvetica, Arial, sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    background-color: #f4f7f6;
    color: #333;
}

header {
    background-color: #2c3e50;
    color: #ecf0f1;
    padding: 15px 25px;
    display: flex;
    align-items: center;
    border-bottom: 3px solid #3498db;
    position: relative; /* For potential absolute positioning of menu or burger */
}

#logo {
    height: 40px;
    margin-right: 15px;
    cursor: pointer; /* Added for better UX as it's clickable */
}

header h1 {
    margin: 0;
    font-size: 1.5em;
}

main {
    max-width: 1200px; /* Increased max-width to accommodate menu */
    margin: 20px auto;
    padding: 20px;
    background-color: #fff;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    display: flex;
    gap: 20px;
}

#channel-menu {
    width: 200px;
    flex-shrink: 0;
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
    height: fit-content;
    max-height: calc(100vh - 150px);
    overflow-y: auto;
}

#channel-menu h3 {
    margin-top: 0;
    font-size: 1.1em;
    color: #333;
    border-bottom: 1px solid #ddd;
    padding-bottom: 10px;
    margin-bottom: 10px;
}

#channel-menu button {
    display: block;
    width: 100%;
    padding: 10px;
    margin-bottom: 8px;
    text-align: left;
    background-color: #e9ecef;
    color: #343a40;
    border: 1px solid #ced4da;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background-color 0.2s ease, color 0.2s ease;
}

#channel-menu button:hover {
    background-color: #dee2e6;
    border-color: #adb5bd;
}

#channel-menu button.active-channel {
    background-color: #3498db;
    color: white;
    border-color: #2980b9;
    font-weight: bold;
}

#main-content {
    flex-grow: 1;
    min-width: 0;
}

.controls {
    margin-bottom: 20px;
    display: flex; /* Added */
    justify-content: space-between; /* Added */
    align-items: center; /* Added */
}

#refresh-button {
    background: transparent;
    border: none;
    color: #ecf0f1;
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    margin-right: 10px;
    transition: background-color 0.2s ease;
}

#refresh-button:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

#refresh-button svg {
    width: 20px;
    height: 20px;
}

#refresh-button.loading svg {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

#comments-container {
    margin-top: 20px;
}

.loading-message,
.error-message,
.no-comments-message {
    text-align: center;
    font-style: italic;
    color: #7f8c8d;
    padding: 20px;
}

.comment {
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 12px 15px;
    margin-bottom: 12px;
    background-color: #fdfdfd;
    transition: box-shadow 0.2s ease-in-out;
    position: relative; /* For absolute positioning of children */
    padding-bottom: 40px; /* Add space at the bottom for icons/links */
}

.comment:hover {
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
}

.comment-header {
    font-size: 0.85em;
    color: #555;
    margin-bottom: 8px;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
}

.comment-header strong {
    color: #2c3e50;
}

.comment-header-info-left {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
}

.comment-header-info-left .author {
    margin-right: 12px;
    white-space: nowrap;
    margin-bottom: 4px;
}

.comment-header-info-left .author {
    display: flex;
    align-items: center;
}

.comment-header .date {
    white-space: nowrap;
    margin-left: 15px;
    margin-bottom: 4px;
}

.comment-content {
    margin-top: 5px;
    margin-bottom: 10px;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.comment-children {
    margin-top: 10px;
    padding-left: 20px;
    border-left: 2px solid #e0e0e0;
}

.toggle-replies {
    background-color: transparent;
    color: #3498db;
    border: none;
    padding: 4px 0; /* Remove side padding */
    font-size: 0.75em; /* Smaller font */
    cursor: pointer;
    margin-top: 5px;
    transition: color 0.2s;
}

.toggle-replies:hover {
    color: #2980b9; /* Darken color on hover */
    text-decoration: underline;
}

.toggle-content-button {
    background-color: transparent;
    color: #3498db;
    border: none;
    padding: 4px 0;
    font-size: 0.8em;
    cursor: pointer;
    margin-top: 5px;
    display: block;
    transition: color 0.2s;
}

.toggle-content-button:hover {
    color: #2980b9;
    text-decoration: underline;
}

a {
    color: #2980b9;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.hidden {
    display: none !important;
}

.author-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    margin-right: 8px;
    flex-shrink: 0;
    background-size: cover;
    background-position: center;
    border: 1px solid #ccc;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%237f8c8d'%3E%3Cpath d='M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z'/%3E%3C/svg%3E");
}

.author-details {
    display: flex;
    flex-direction: column;
    justify-content: center;
    line-height: 1.3;
}

.author-link {
    font-size: 1.1em;
    font-weight: 600;
    color: #2c3e50;
}

.author-details .app {
    font-size: 0.85em;
    color: #6c757d;
    margin-top: 1px;
}

.comment-channel-display {
    font-size: 0.8em;
    color: #6c757d;
    margin-top: 10px;
    padding-top: 5px;
}

/* Like Section Styles */
.like-section {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    font-size: 0.9em;
    position: absolute; /* Position relative to the comment card */
    bottom: 10px;
    left: 15px;
}

.like-count {
    color: #555;
    display: flex;
    align-items: center;
    gap: 5px;
}

.like-icon {
    width: 16px;
    height: 16px;
    vertical-align: middle;
}

.action-button {
    background-color: #f0f0f0;
    border: 1px solid #ccc;
    color: #333;
    padding: 4px 10px;
    border-radius: 15px; /* Pill shape */
    cursor: pointer;
    font-size: 0.85em;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.action-button:hover {
    background-color: #e0e0e0;
    border-color: #bbb;
}

.action-button:disabled {
    background-color: #e9ecef;
    color: #6c757d;
    cursor: not-allowed;
    border-color: #ced4da;
}

.tx-link-icon {
    position: absolute;
    bottom: 12px;
    right: 15px;
    color: #95a5a6; /* A subtle color */
    line-height: 1; /* To prevent extra space */
}

.tx-link-icon svg {
    width: 16px;
    height: 16px;
    vertical-align: middle;
    transition: transform 0.2s ease;
}

.tx-link-icon:hover {
    color: #3498db; /* A brighter hover color */
    text-decoration: none;
}

.tx-link-icon:hover svg {
    transform: scale(1.1);
}

/* Profile View Header Styles */
#profile-view-header {
    display: flex;
    align-items: flex-start;
    padding: 15px;
    margin-bottom: 20px;
    background-color: #fdfdfd;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
}

#profile-view-header .author-avatar {
    width: 64px;
    height: 64px;
    margin-right: 15px;
}

.profile-view-details {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

#profile-view-stats {
    display: flex;
    gap: 15px;
    margin-top: 5px;
}

#profile-view-stats span {
    font-size: 0.95em;
    color: #555;
}

#profile-follow-state {
    font-size: 0.8em;
    font-weight: 600;
    color: #27ae60; /* Green for positive state */
    background-color: #eafaf1;
    padding: 2px 8px;
    border-radius: 12px;
    border: 1px solid #a3e9c3;
    margin-left: 5px; /* Space from other stats */
    align-self: center; /* Vertically align with other stats */
}

#profile-view-header h2 {
    margin: 0;
    font-size: 1.8em;
    color: #2c3e50;
    font-weight: 600;
}

/* --- Add the following styles --- */
.mention-link {
    color: #3498db; /* Use a theme color */
    font-weight: 500;
    cursor: pointer;
}
.mention-link:hover {
    text-decoration: underline;
}

#profile-view-tabs {
    display: flex;
    border-bottom: 1px solid #e0e0e0;
    margin-bottom: 20px;
}

.profile-tab {
    padding: 10px 15px;
    cursor: pointer;
    border: none;
    background-color: transparent;
    font-size: 1em;
    color: #555;
    border-bottom: 3px solid transparent;
    margin-bottom: -1px; /* Align with the container's border */
    transition: color 0.2s, border-bottom-color 0.2s;
}

.profile-tab:hover {
    color: #2c3e50;
}

.profile-tab.active {
    border-bottom-color: #3498db;
    color: #2c3e50;
    font-weight: 600;
}
/* --- End of new styles --- */

#profile-view-description {
    font-size: 0.95em;
    color: #555;
    margin-top: 8px;
    max-width: 600px;
}

#profile-view-socials {
    display: flex;
    gap: 15px;
    margin-top: 10px;
}

#profile-view-socials a {
    color: #7f8c8d;
    transition: color 0.2s ease;
}

#profile-view-socials a:hover {
    color: #2c3e50;
}

#profile-view-socials svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
}

.profile-view-actions {
    margin-left: auto;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
}

#follow-button {
    background-color: #3498db;
    color: white;
    border: 1px solid #2980b9;
    padding: 8px 16px;
    font-size: 0.9em;
    font-weight: 600;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

#follow-button:hover {
    background-color: #2980b9;
}

#back-to-comments-button {
    background-color: transparent;
    color: #6c757d;
    border: none;
    padding: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

#back-to-comments-button:hover {
    background-color: #e9ecef;
}

#back-to-comments-button svg {
    width: 20px;
    height: 20px;
}

#common-followers-section {
    margin-top: 20px;
    padding: 15px;
    background-color: #fdfdfd;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
}

#common-followers-section h3 {
    margin-top: 0;
    font-size: 1.1em;
    color: #333;
    border-bottom: 1px solid #ddd;
    padding-bottom: 10px;
    margin-bottom: 10px;
}

#common-followers-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.common-follower-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9em;
}

.common-follower-item .author-avatar {
    width: 28px;
    height: 28px;
}

/* Profile Section Styles */
#user-profile {
    display: flex;
    align-items: center;
    cursor: pointer;
    position: relative;
    padding: 4px 8px;
    border-radius: 20px;
    transition: background-color 0.2s ease;
}

#user-profile:hover {
    background-color: #3e5167; /* Slightly darker than header */
}

#user-profile .author-avatar {
    width: 32px;
    height: 32px;
    margin-right: 10px;
}

#profile-name {
    color: #ecf0f1;
    font-weight: 500;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#logout-popup {
    position: absolute;
    top: 110%;
    right: 0;
    background-color: white;
    border-radius: 6px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    z-index: 1010;
    overflow: hidden;
    width: 150px;
}

#logout-popup button {
    display: block;
    width: 100%;
    padding: 12px 15px;
    background: none;
    border: none;
    color: #333;
    text-align: left;
    font-size: 0.95em;
    cursor: pointer;
}

#logout-popup button:hover {
    background-color: #f4f7f6;
}

/* --- Add all the following styles --- */

.like-tooltip-container {
    position: relative;
    display: inline-block;
    cursor: default; /* So it doesn't show a text selection cursor */
}

.like-tooltip {
    display: none; /* Hidden by default */
    position: absolute;
    bottom: 120%; /* Position above the like count */
    left: 50%;
    transform: translateX(-50%);
    background-color: #2c3e50; /* Dark background */
    color: #ecf0f1; /* Light text */
    padding: 8px 12px;
    border-radius: 6px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    z-index: 10;
    width: 220px; /* Fixed width */
    font-size: 0.9em;
    text-align: left;

    /* Scrollability for more than 5 items */
    max-height: 150px; /* Approx 5 items + padding */
    overflow-y: auto;

    /* Hide scrollbar but keep functionality */
    -ms-overflow-style: none; /* IE and Edge */
    scrollbar-width: none; /* Firefox */
}

/* Hide scrollbar for Chrome, Safari and Opera */
.like-tooltip::-webkit-scrollbar {
    display: none;
}

/* Show tooltip on hover */
.like-tooltip-container:hover .like-tooltip {
    display: block;
}

/* Arrow pointing down */
.like-tooltip::after {
    content: "";
    position: absolute;
    top: 100%; /* At the bottom of the tooltip */
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #2c3e50 transparent transparent transparent;
}

.tooltip-liker {
    padding: 4px 0;
    border-bottom: 1px solid #3e5167; /* Separator line */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tooltip-liker:last-child {
    border-bottom: none;
}

/* --- End of new styles --- */

/* Burger Menu Button Styles */
#burger-menu-button {
    display: none; /* Hidden by default, shown in media query */
    background: none;
    border: none;
    padding: 10px; /* Padding provides clickable area */
    cursor: pointer;
    z-index: 1001; /* Ensure it's above other elements if menu overlays */
}

#burger-menu-button span {
    display: block;
    width: 22px;
    height: 3px;
    background-color: #333; /* Dark color for light background */
    margin: 4px 0;
    transition: all 0.3s ease-in-out;
}

/* Styles for when the menu is open (X icon) */
#burger-menu-button.open span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
#burger-menu-button.open span:nth-child(2) {
    opacity: 0;
}
#burger-menu-button.open span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* Wallet and New Comment Form Styles */
#connect-wallet-button {
    padding: 8px 12px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
    /* Added for better text handling */
    max-width: 200px; /* Adjust as needed */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center; /* If text is shorter than max-width */
}
#connect-wallet-button:disabled {
    background-color: #95a5a6;
    cursor: default;
    /* Ensure text color remains readable when disabled and potentially long */
    color: #e0e0e0;
}
/* Removed #wallet-status rule */

#new-comment-area {
    background-color: #fdfdfd; /* Slightly off-white */
    padding: 20px;
    border-radius: 6px;
    margin-bottom: 25px;
    border: 1px solid #e0e0e0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}
#new-comment-area h3 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.2em;
    color: #2c3e50;
}
#new-comment-area textarea,
#new-comment-area input[type="text"] {
    width: calc(100% - 22px); /* Account for padding/border */
    padding: 10px;
    margin-bottom: 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-family: inherit;
    font-size: 1em;
    box-sizing: border-box;
}
#new-comment-area button {
    background-color: #2ecc71;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.2s ease;
}
#new-comment-area button:hover {
    background-color: #27ae60;
}
#new-comment-area button:disabled {
    background-color: #95a5a6;
    cursor: not-allowed;
}
.status-message {
    /* General class for status messages */
    margin-top: 10px;
    font-size: 0.9em;
    padding: 8px;
    border-radius: 4px;
    display: none; /* Hidden by default, shown by JS */
}

/* Reply Button and Form Styles */
.reply-form button {
    font-size: 0.85em;
    padding: 4px 10px;
    margin-right: 8px;
    border-radius: 4px; /* Make form buttons rectangular */
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}
.reply-form {
    margin-top: 8px;
    padding: 10px;
    background-color: #f9f9f9;
    border: 1px solid #e9ecef;
    border-radius: 4px;
}
.reply-form textarea {
    width: calc(100% - 12px); /* Adjust for padding */
    padding: 8px;
    margin-bottom: 8px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 0.95em;
    box-sizing: border-box;
    min-height: 50px;
}
.reply-form .submit-reply-button {
    background-color: #3498db;
    color: white;
    border: 1px solid #2980b9;
}
.reply-form .submit-reply-button:hover {
    background-color: #2980b9;
}
.reply-form .submit-reply-button:disabled,
.reply-form .cancel-reply-button:disabled {
    background-color: #95a5a6;
    cursor: not-allowed;
    border-color: #7f8c8d;
}
.reply-form .cancel-reply-button {
    background-color: #ecf0f1;
    color: #34495e;
    border: 1px solid #bdc3c7;
}
.reply-form .cancel-reply-button:hover {
    background-color: #dadedf;
}
.reply-status-message {
    font-size: 0.85em !important;
    margin-top: 8px !important;
    padding: 5px !important;
}

/* Media Query for Mobile View */
@media (max-width: 768px) {
    header {
        /* position: relative; already set above */
    }

    #burger-menu-button {
        display: block; /* Show burger button on mobile */
    }

    #burger-menu-button.open {
        position: fixed;
        top: 15px;
        left: 15px;
    }

    main {
        flex-direction: column;
    }

    #channel-menu {
        position: fixed;
        left: 0;
        top: 0;
        width: 250px;
        height: 100vh;
        background-color: #f8f9fa;
        z-index: 1000;
        transform: translateX(-100%);
        transition: transform 0.3s ease-in-out;
        box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
        padding: 60px 15px 15px 15px;
        overflow-y: auto;
        max-height: 100vh;
        border-right: 1px solid #ccc;
        box-sizing: border-box;
    }

    #channel-menu.open {
        transform: translateX(0); /* Slide in */
    }

    #main-content {
        width: 100%;
        margin-left: 0;
    }

    body.menu-open-overlay::after {
        content: "";
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 999;
    }

    #connect-wallet-button {
        max-width: 150px; /* More aggressive max-width for mobile */
        /* font-size: 0.8em; /* Optionally reduce font size */
        /* padding: 6px 10px; /* Optionally reduce padding */
    }
}

.embedded-image {
    max-width: 100%;
    max-height: 400px; /* Optional: prevent very tall images */
    border-radius: 8px;
    margin-top: 10px;
    border: 1px solid #ddd;
    display: block; /* Ensures margin-top works correctly */
}

/* CAIP-19 Token Embed Styles */
.caip19-embed {
    display: inline-flex;
    align-items: center;
    background-color: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    padding: 4px 10px 4px 4px;
    margin: 2px;
    text-decoration: none;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
    max-width: 100%;
}

.caip19-embed:hover {
    background-color: #e9ecef;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    text-decoration: none;
}

.caip19-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    margin-right: 8px;
    background-color: #ced4da; /* Placeholder color */
    flex-shrink: 0;
    background-size: cover;
    background-position: center;
}

.caip19-info {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    overflow: hidden;
}

.caip19-name {
    font-weight: 600;
    color: #2c3e50;
    font-size: 0.9em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.caip19-symbol {
    font-size: 0.8em;
    color: #6c757d;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* CoinGecko Chart Tooltip Styles */
.coingecko-chart-tooltip {
    display: none; /* Hidden by default */
    position: fixed; /* Position relative to the viewport */
    z-index: 1020;
    background-color: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
    transition: opacity 0.15s ease-in-out;
    box-sizing: border-box;
    width: 500px; /* Set the desired width */
}

.coingecko-chart-tooltip .loading-message {
    font-size: 0.9em;
    color: #555;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}
