html {
    height: 100%;
    overflow-x: hidden;
}

body {
    font-family: 'Reddit Sans', Arial, sans-serif;
    margin: 0;
    padding: 0;
    min-height: 100%;
    overflow-x: hidden;
}

a:link {
    color: #139963;
    text-decoration-line: none;
    font-weight: bold;
}

a:visited {
    color: #139963;
    text-decoration-line: none;
    font-weight: bold;
}

a:hover {
    color: #17B978;
    cursor: pointer;
    text-decoration-line: none;
    font-weight: bold;
}

/* Chat Bubble Button */
#chatBubble {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 65px;
    height: 65px;
    background: #17B978;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 0 1px 1px rgba(23, 185, 120, 0.4);
    transition: transform 0.2s, box-shadow 0.2s;
    z-index: 1000;
}

#chatBubble:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(23, 185, 120, 0.5);
    animation: none;
}

#chatBubble .material-symbols-outlined {
    color: white;
    font-size: 36px;
}

/* Chat Window */
#chatbox {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 400px;
    height: 600px;
    border: none;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    background: #fff;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    overflow: hidden;
}

/* Chat Header */
#chatHeader {
    background: #17B978;
    color: white;
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#chatTitle {
    display: flex;
    align-items: center;
    font-weight: 600;
    font-size: 16px;
}

#chatControls {
    display: flex;
    gap: 8px;
}

.chat-control {
    cursor: pointer;
    font-size: 20px;
    padding: 4px;
    border-radius: 4px;
    transition: background 0.2s;
}

.chat-control:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Messages Area */
#messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    font-size: 14px;
    background: #f9f9f9;
}

#messages::-webkit-scrollbar {
    width: 6px;
}

#messages::-webkit-scrollbar-track {
    background: transparent;
}

#messages::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.msg {
    margin: 12px 0;
    padding: 10px 14px;
    border-radius: 12px;
    max-width: 80%;
    width: fit-content;
    word-wrap: break-word;
    line-height: 1.4;
}

.user {
    background: #17B978;
    color: white;
    margin-left: auto;
    text-align: right;
    border-bottom-right-radius: 4px;
}

.bot {
    background: white;
    color: #333;
    margin-right: auto;
    text-align: left;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Input Area */
#input {
    display: flex;
    gap: 8px;
    padding: 16px;
    padding-bottom: 12px;
    background: white;
    border-top: 1px solid #e5e5e5;
}

#input input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #e5e5e5;
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

#input input:focus {
    border-color: #17B978;
}

#input input::placeholder {
    color: #999;
}

#sendButton {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, transform 0.1s;
    flex-shrink: 0;
}

#sendButton .material-symbols-outlined {
    font-size: 24px;
    color: #999;
    transition: color 0.2s;
}

#sendButton:not(:disabled) {
    cursor: pointer;
}

#sendButton:not(:disabled) .material-symbols-outlined {
    color: #17B978;
}

#sendButton:not(:disabled):hover {
    background-color: rgba(23, 185, 120, 0.1);
}

#sendButton:not(:disabled):active {
    transform: scale(0.95);
}

#sendButton:disabled {
    cursor: not-allowed;
}

/* Privacy Notice */
#privacyNotice {
    padding: 8px 16px;
    padding-top: 0;
    background: white;
    font-size: 11px;
    color: #666;
    text-align: center;
    line-height: 1.4;
}

#privacyNotice a {
    color: #139963;
    text-decoration: underline;
}

#privacyNotice a:hover {
    color: #17B978;
}

/* Conversation ID Display */
#conversationIdDisplay {
    padding: 6px 16px 10px 16px;
    background: white;
    font-size: 10px;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border-top: 1px solid #f0f0f0;
}

#conversationIdLabel {
    font-weight: 600;
    color: #999;
}

#conversationIdValue {
    font-family: monospace;
    color: #666;
    font-size: 9px;
}

#copyIdButton {
    border: none;
    background: #f0f0f0;
    border-radius: 4px;
    padding: 3px 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.1s;
}

#copyIdButton .material-symbols-outlined {
    font-size: 14px;
    color: #666;
}

#copyIdButton:hover {
    background: #e0e0e0;
}

#copyIdButton:active {
    transform: scale(0.95);
}

/* Confirmation Modal */
#confirmModal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1001;
}

#confirmContent {
    background: white;
    padding: 24px;
    border-radius: 12px;
    text-align: center;
    max-width: 300px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

#confirmContent p {
    margin: 0 0 20px 0;
    font-size: 16px;
    color: #333;
}

#confirmButtons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

#confirmButtons button {
    padding: 10px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

#confirmButtons button:first-child {
    background: #17B978;
    color: white;
}

#confirmButtons button:first-child:hover {
    background: #149963;
}

#confirmButtons button:last-child {
    background: #f0f0f0;
    color: #333;
}

#confirmButtons button:last-child:hover {
    background: #e0e0e0;
}

#confirmButtons button:active {
    transform: scale(0.98);
}

/* Typing indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px !important;
}

.typing-indicator .dot {
    width: 8px;
    height: 8px;
    background: #999;
    border-radius: 50%;
    animation: typing-dot 1.4s infinite;
}

.typing-indicator .dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator .dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing-dot {
    0%, 60%, 100% {
        opacity: 0.3;
        transform: translateY(0);
    }
    30% {
        opacity: 1;
        transform: translateY(-8px);
    }
}

/* Pulse animation */
.pulse {
  animation: pulse-animation 2s infinite;
}

@keyframes pulse-animation {
  0% {
    box-shadow: 0 0 0 0px rgba(23, 185, 120, 0.4);
  }
  100% {
    box-shadow: 0 0 0 12px rgba(23, 185, 120, 0);
  }
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
    /* Scale down chat bubble for mobile */
    #chatBubble {
        width: 58px;
        height: 58px;
        bottom: 10px;
        right: 10px;
    }

    #chatBubble .material-symbols-outlined {
        font-size: 30px;
    }

    /* Adjust chat window for mobile - leave some margin */
    #chatbox {
        bottom: 10px;
        right: 10px;
        left: 10px;
        top: 10px;
        width: calc(100% - 20px);
        height: calc(100% - 20px);
        border-radius: 16px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
        max-width: calc(100vw - 20px);
        max-height: calc(100vh - 20px);
    }

    /* Adjust header padding for mobile */
    #chatHeader {
        padding: 12px 14px;
        border-radius: 12px 12px 0 0;
    }

    #chatTitle {
        font-size: 14px;
    }

    .chat-control {
        font-size: 18px;
    }

    /* Adjust messages padding for mobile */
    #messages {
        padding: 12px;
        font-size: 13px;
    }

    .msg {
        max-width: 85%;
        font-size: 13px;
        padding: 9px 12px;
        margin: 10px 0;
    }

    /* Adjust input area for mobile */
    #input {
        padding: 10px;
        padding-bottom: 8px;
    }

    #input input {
        padding: 9px 12px;
        font-size: 13px;
    }

    #sendButton {
        width: 36px;
        height: 36px;
    }

    #sendButton .material-symbols-outlined {
        font-size: 20px;
    }

    /* Privacy notice for mobile */
    #privacyNotice {
        font-size: 10px;
        padding: 6px 10px;
        padding-top: 0;
    }

    /* Conversation ID for mobile */
    #conversationIdDisplay {
        padding: 5px 10px 8px 10px;
        font-size: 9px;
        gap: 4px;
    }

    #conversationIdValue {
        font-size: 8px;
    }

    #copyIdButton {
        padding: 2px 4px;
    }

    #copyIdButton .material-symbols-outlined {
        font-size: 12px;
    }

    /* Adjust modal for mobile */
    #confirmContent {
        max-width: 260px;
        padding: 18px;
        margin: 0 12px;
    }

    #confirmContent p {
        font-size: 14px;
        margin: 0 0 16px 0;
    }

    #confirmButtons button {
        padding: 8px 20px;
        font-size: 13px;
    }
}

/* Extra small devices (phones in portrait, less than 375px) */
@media (max-width: 374px) {
    #chatBubble {
        width: 58px;
        height: 58px;
        bottom: 10px;
        right: 10px;
    }

    #chatBubble .material-symbols-outlined {
        font-size: 30px;
    }

    #chatbox {
        border-radius: 10px;
    }

    #chatHeader {
        padding: 10px 12px;
        border-radius: 10px 10px 0 0;
    }

    #chatTitle {
        font-size: 13px;
    }

    #messages {
        padding: 10px;
        font-size: 12px;
    }

    .msg {
        font-size: 12px;
        padding: 8px 10px;
    }

    #input {
        padding: 8px;
        padding-bottom: 6px;
    }

    #input input {
        padding: 8px 10px;
        font-size: 12px;
    }

    #sendButton {
        width: 32px;
        height: 32px;
    }

    #sendButton .material-symbols-outlined {
        font-size: 18px;
    }

    #privacyNotice {
        font-size: 9px;
        padding: 5px 8px;
        padding-top: 0;
    }

    /* Conversation ID for extra small mobile */
    #conversationIdDisplay {
        padding: 4px 8px 6px 8px;
        font-size: 8px;
    }

    #conversationIdValue {
        font-size: 7px;
    }
}