.gapina-comments-container,
.gapina-comments-container *,
.gapina-modal-overlay,
.gapina-modal-overlay * {
    box-sizing: border-box;
}

.gapina-comments-container {
    --gapina-highlight-color: #B38308;
    --gapina-textarea-active-border: #B38308;
    --gapina-scroll-thumb: #B38308;
    --gapina-scroll-track: #000000;
    background-color: #1e1e1e;
    border: 1px solid #7A7A7A;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: auto;
    max-height: 700px;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    direction: rtl;
    position: relative;
}

.gapina-sticky-my-last {
    position: sticky;
    top: 0;
    z-index: 10;
    background-color: #1e1e1e;
    border-bottom: 1px solid #B38308;
    padding: 6px 12px;
    text-align: center;
    display: none;
}

.gapina-sticky-my-last button {
    background: #B38308;
    color: #fff;
    border: none;
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
}

.gapina-sticky-my-last button:hover {
    opacity: 0.9;
}

.gapina-floating-reply-btn {
    position: absolute;
    bottom: 75px;
    left: 15px;
    z-index: 20;
    background: #B38308;
    color: #fff;
    border: none;
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 11px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    gap: 6px;
}

.gapina-reply-badge {
    background: #ff3333;
    color: #fff;
    font-size: 10px;
    font-weight: bold;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.gapina-floating-scroll-bottom-btn {
    position: absolute;
    bottom: 90px;
    right: 15px;
    z-index: 20;
    background: #B38308;
    color: #ffffff;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.gapina-floating-scroll-bottom-btn:hover {
    background: #966d06;
    transform: scale(1.1);
}

.gapina-floating-scroll-bottom-btn svg {
    width: 18px;
    height: 18px;
}

.gapina-floating-scroll-top-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 20;
    background: #B38308;
    color: #ffffff;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    transition: top 0.2s, background-color 0.2s, transform 0.2s;
}

.gapina-floating-scroll-top-btn:hover {
    background: #966d06;
    transform: scale(1.1);
}

.gapina-floating-scroll-top-btn svg {
    width: 18px;
    height: 18px;
}

.gapina-has-sticky-header .gapina-floating-scroll-top-btn {
    top: 50px;
}

.gapina-chat-box {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    background-color: #000000;
    min-height: 80px;
    position: relative;
    scrollbar-width: thin;
    scrollbar-color: var(--gapina-scroll-thumb, #B38308) var(--gapina-scroll-track, #000000);
}

.gapina-empty-state {
    text-align: center;
    color: #888;
    padding: 30px 10px;
    font-size: 14px;
}

.gapina-center-loader {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.65);
    z-index: 25;
    display: none;
    align-items: center;
    justify-content: center;
    border-radius: inherit;
}

.gapina-lazy-loader {
    text-align: center;
    padding: 10px 0;
    display: none;
}

.gapina-loader-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #B38308;
    margin: 0 3px;
    animation: gapinaDotPulse 1.4s infinite ease-in-out both;
}

.gapina-loader-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.gapina-loader-dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes gapinaDotPulse {

    0%,
    80%,
    100% {
        transform: scale(0);
        opacity: 0.3;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }
}

.gapina-chat-box::-webkit-scrollbar {
    width: 6px;
}

.gapina-chat-box::-webkit-scrollbar-track {
    background: #000000;
}

.gapina-chat-box::-webkit-scrollbar-thumb {
    background: #B38308;
    border-radius: 3px;
}

.gapina-bubble-wrapper {
    display: flex;
    margin-bottom: 20px;
    align-items: flex-end;
    gap: 10px;
    position: relative;
}

.gapina-mine {
    justify-content: flex-start;
    flex-direction: row;
}

.gapina-other {
    justify-content: flex-start;
    flex-direction: row-reverse;
}

.gapina-textarea::-webkit-scrollbar {
    display: none;
}

.gapina-textarea {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.gapina-avatar {
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    min-height: 40px !important;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background: #1e1e1e;
}

.gapina-avatar img,
.gapina-avatar svg {
    width: 40px !important;
    height: 40px !important;
    object-fit: cover;
    display: block;
}

.gapina-bubble {
    max-width: 80%;
    padding: 10px 15px;
    border-radius: 15px;
    position: relative;
    font-size: 14px;
    line-height: 1.6;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
}

.gapina-other .gapina-bubble {
    background-color: #1e1e1e;
    color: #fff;
    border-bottom-left-radius: 2px;
}

.gapina-mine .gapina-bubble {
    background-color: #B38308;
    color: #fff;
    border-bottom-right-radius: 2px;
}

.gapina-author-name {
    font-size: 12px;
    font-weight: bold;
    margin-bottom: 5px;
    color: #e0e0e0;
}

.gapina-mine .gapina-author-name {
    color: #ffeab3;
}

.gapina-bubble-text {
    white-space: pre-wrap;
    word-break: break-word;
}

.gapina-meta {
    font-size: 10px;
    text-align: left;
    margin-top: 8px;
    opacity: 0.7;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.gapina-pending-notice {
    color: #ff4d4d;
    font-style: italic;
    font-size: 11px;
    margin-right: auto;
    padding-left: 10px;
}

.gapina-mine .gapina-pending-notice {
    color: #ffcccc;
}

.gapina-replied-to-box {
    background: rgba(0, 0, 0, 0.3);
    border-right: 3px solid #fff;
    padding: 5px 10px;
    border-radius: 5px;
    margin-bottom: 8px;
    font-size: 0.85em;
    cursor: pointer;
    transition: background 0.2s;
}

.gapina-mine .gapina-replied-to-box {
    border-right-color: #ffeab3;
}

.gapina-other .gapina-replied-to-box {
    border-right-color: #B38308;
}

.gapina-replied-to-box:hover {
    background: rgba(0, 0, 0, 0.5);
}

.gapina-replied-author {
    font-weight: bold;
    margin-bottom: 3px;
}

.gapina-replied-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 250px;
}

.gapina-reply-btn {
    background: none;
    border: none;
    color: #666666;
    cursor: pointer;
    font-size: 18px;
    padding: 5px;
    transition: color 0.2s;
    flex-shrink: 0;
}

.gapina-reply-btn:hover {
    color: #B38308;
}

.gapina-highlight-msg .gapina-bubble {
    animation: gapinaHighlight 2s ease-out;
}

@keyframes gapinaHighlight {
    0% {
        box-shadow: 0 0 0 0 var(--gapina-highlight-color, #B38308);
    }

    50% {
        box-shadow: 0 0 15px 8px var(--gapina-highlight-color, #B38308);
    }

    100% {
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
    }
}

.gapina-input-area {
    background-color: #1e1e1e;
    padding: 15px;
    border-top: 1px solid #303030;
}

.gapina-reply-preview {
    display: none;
    background: #252525;
    border-right: 3px solid #B38308;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 10px;
    color: #fff;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
}

#gapina-reply-name {
    color: #B38308;
}

.gapina-cancel-reply {
    background: none;
    border: none;
    color: #ff5555;
    cursor: pointer;
    font-size: 16px;
}

.gapina-input-wrapper {
    display: flex;
    gap: 10px;
}

.gapina-textarea {
    flex: 1;
    background: #000000;
    border: 1px solid #444444;
    border-radius: 20px;
    padding: 12px 15px;
    color: #fff;
    resize: none;
    height: 50px;
    transition: border-color 0.2s;
}

.gapina-textarea:focus {
    outline: none;
    border-color: var(--gapina-textarea-active-border, #B38308) !important;
}

.gapina-submit-btn {
    background: #B38308;
    color: #ffffff;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, background 0.2s;
    flex-shrink: 0;
}

.gapina-submit-btn:hover {
    background: #966d06;
    transform: scale(1.05);
}

.gapina-submit-btn svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.gapina-guest-login-notice {
    text-align: center;
    padding: 10px;
}

.gapina-closed-notice {
    text-align: center;
    padding: 12px;
    color: #ff5555;
    font-size: 13px;
    font-weight: bold;
    background: rgba(255, 85, 85, 0.1);
    border-radius: 8px;
}

.gapina-login-btn {
    background: #B38308;
    color: #fff;
    text-decoration: none;
    padding: 10px 20px;
    border-radius: 20px;
    display: inline-block;
    font-weight: bold;
    margin-top: 5px;
    transition: all 0.2s;
}

.gapina-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 99999;
    align-items: center;
    justify-content: center;
    direction: rtl;
}

.gapina-modal {
    background: #1e1e1e;
    padding: 30px;
    border-radius: 15px;
    border: 1px solid #B38308;
    width: 90%;
    max-width: 400px;
    color: #fff;
    text-align: center;
}

.gapina-modal input {
    width: 100%;
    background: #000000;
    border: 1px solid #444;
    color: #fff;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 15px;
    text-align: center;
}

.gapina-modal input[type="number"]::-webkit-outer-spin-button,
.gapina-modal input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.gapina-modal input[type="number"] {
    -moz-appearance: textfield;
}

.gapina-modal button {
    background: #B38308;
    color: #fff;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    width: 100%;
    font-weight: bold;
}

.gapina-math-question {
    font-size: 16px;
    margin-bottom: 15px;
    color: #B38308;
}

@container (max-width: 420px) {
    .gapina-bubble {
        max-width: 72% !important;
    }
}

@container (max-width: 340px) {
    .gapina-avatar {
        display: none !important;
    }

    .gapina-bubble {
        max-width: 88% !important;
    }
}

@media (max-width: 480px) {
    .gapina-comments-container {
        margin: 0 auto;
        width: 100%;
        max-height: 80vh;
        border-radius: 8px;
    }

    .gapina-chat-box {
        padding: 12px;
    }

    .gapina-bubble {
        max-width: 75% !important;
        font-size: 13px;
        padding: 8px 12px;
    }

    .gapina-avatar {
        width: 32px !important;
        height: 32px !important;
        min-width: 32px !important;
        min-height: 32px !important;
    }

    .gapina-avatar img,
    .gapina-avatar svg {
        width: 32px !important;
        height: 32px !important;
    }

    .gapina-input-area {
        padding: 10px;
    }

    .gapina-textarea {
        height: 44px;
        padding: 10px 12px;
        font-size: 13px;
    }

    .gapina-submit-btn {
        width: 44px;
        height: 44px;
    }

    .gapina-floating-reply-btn {
        bottom: 65px;
        left: 10px;
        font-size: 10px;
        padding: 5px 10px;
    }

    .gapina-floating-scroll-bottom-btn {
        bottom: 80px;
        right: 10px;
        width: 32px;
        height: 32px;
    }

    .gapina-floating-scroll-top-btn {
        top: 10px;
        right: 10px;
        width: 32px;
        height: 32px;
    }

    .gapina-has-sticky-header .gapina-floating-scroll-top-btn {
        top: 45px;
    }
}

@media (max-width: 360px) {
    .gapina-avatar {
        display: none !important;
    }

    .gapina-bubble {
        max-width: 88% !important;
    }
}