/* ===============================================
   CHAT WIDGET - ACADEMIC THEME (CIRCULAR, PROFESSIONAL)
   =============================================== */

/* Chat Widget Styles */
.chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 10000;
    font-family: 'Source Sans 3', -apple-system, BlinkMacSystemFont, sans-serif;
}

.chat-toggle {
    width: 70px;
    height: 70px;
    background: #22C55E; /* Green */
    border: none;
    border-radius: 50%; /* Circular */
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2); /* Enhanced shadow */
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.25s ease;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 600;
    font-size: 0.75rem;
    line-height: 1;
}

.chat-toggle:hover {
    background: #16A34A; /* Darker green on hover */
    transform: none; /* Remove displacement */
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25); /* Stronger shadow on hover */
}

.chat-toggle i {
    font-size: 1.5rem;
    color: #FFFFFF;
    margin-bottom: 2px;
}

.chat-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #22C55E; /* Green accent */
    color: #FFFFFF;
    width: 22px;
    height: 22px;
    border: none;
    border-radius: 50%; /* Circular */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.chat-window {
    position: absolute;
    bottom: 90px;
    right: 0;
    width: 300px;
    height: 480px;
    background: #FFFFFF;
    border: none;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-weight: 500;
}

.chat-header {
    background: #22C55E;
    color: #FFFFFF;
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    position: relative;
    border-radius: 12px 12px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header::before {
    display: none;
}

.chat-header-content {
    flex: 1;
    padding-right: 10px;
}

.chat-header-content h4 {
    margin: 0;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #FFFFFF;
    line-height: 1.2;
}

.chat-header-content h4 i {
    font-size: 1rem;
}

.chat-header-content p {
    margin: 2px 0 0 0;
    font-size: 0.75rem;
    opacity: 0.9;
    font-weight: 500;
    color: #FFFFFF;
    line-height: 1.2;
}

.chat-close {
    background: none;
    border: none;
    color: #FFFFFF;
    font-size: 1.125rem;
    cursor: pointer;
    padding: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s ease;
    font-weight: 600;
    border-radius: 50%;
    flex-shrink: 0;
}

.chat-close:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #FFFFFF;
    transform: none;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    background: #F7F8FA;
}

.chat-messages::-webkit-scrollbar {
    width: 4px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #E5E7EB;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #2C5F8D;
    border-radius: 2px;
}

.chat-message {
    margin-bottom: 12px;
    animation: slideIn 0.3s ease;
    font-size: 0.75rem;
    line-height: 1.4;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.user-message {
    text-align: right;
}

.bot-message {
    text-align: left;
}

.message-content {
    display: inline-block;
    max-width: 75%;
    padding: 8px 10px;
    position: relative;
    font-weight: 500;
    word-wrap: break-word;
    border-radius: 12px;
    font-size: 0.7rem;
    line-height: 1.4;
}

.user-message .message-content {
    background: #2C5F8D;
    color: #FFFFFF;
    border: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.user-message .message-content::before {
    content: '';
    position: absolute;
    right: 10px;
    top: -6px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 6px solid #2C5F8D;
}

.bot-message .message-content {
    background: #FFFFFF;
    color: #1B1F24;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.bot-message .message-content::before {
    content: '';
    position: absolute;
    left: 10px;
    top: -6px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 6px solid #FFFFFF;
}

.message-time {
    font-size: 0.7rem;
    color: #6B7280;
    margin-top: 4px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.chat-input-container {
    display: flex;
    padding: 8px 12px;
    background: #FFFFFF;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    gap: 8px;
}

#chat-input {
    flex: 1;
    padding: 8px 10px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 8px;
    font-size: 0.7rem;
    font-weight: 500;
    outline: none;
    transition: all 0.25s ease;
    font-family: 'Source Sans 3', sans-serif;
    background: #FFFFFF;
}

#chat-input:focus {
    border-color: #2C5F8D;
    box-shadow: 0 0 0 3px rgba(44, 95, 141, 0.1);
    background: #FFFFFF;
}

.chat-send-btn {
    width: 36px;
    height: 36px;
    background: #22C55E;
    border: none;
    color: #FFFFFF;
    font-size: 0.8rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s ease;
    font-weight: 600;
    border-radius: 50%;
}

.chat-send-btn:hover {
    background: #16A34A;
    transform: none;
}

.chat-form {
    padding: 15px;
    background: #F7F8FA;
}

.chat-form h4 {
    margin-bottom: 15px;
    color: #1B1F24;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-form h4 i {
    font-size: 1rem;
}

.chat-form p {
    margin: 0 0 15px 0;
    color: #4B5563;
    font-size: 0.75rem;
    line-height: 1.4;
    font-weight: 500;
}

.chat-form input,
.chat-form textarea {
    width: 100%;
    padding: 8px 10px;
    margin-bottom: 12px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    font-size: 0.7rem;
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 500;
    transition: all 0.25s ease;
    box-sizing: border-box;
    border-radius: 8px;
    background: #FFFFFF;
}

.chat-form input:focus,
.chat-form textarea:focus {
    outline: none;
    border-color: #2C5F8D;
    box-shadow: 0 0 0 3px rgba(44, 95, 141, 0.1);
    background: #FFFFFF;
}

.chat-form textarea {
    resize: vertical;
    min-height: 60px;
}

.chat-start-btn {
    width: 100%;
    padding: 12px;
    background: #22C55E;
    color: #FFFFFF;
    border: none;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
    border-radius: 20px;
}

.chat-start-btn:hover {
    background: #16A34A;
    transform: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.chat-start-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.chat-start-btn:hover::before {
    left: 100%;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: #FFFFFF;
    border: 1px solid rgba(0, 0, 0, 0.08);
    margin-bottom: 12px;
    border-radius: 12px;
    max-width: 75%;
}

.typing-dots {
    display: flex;
    gap: 4px;
}

.typing-dots span {
    width: 6px;
    height: 6px;
    background: #2C5F8D;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-6px); }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .chat-widget {
        bottom: 15px;
        right: 15px;
    }

    .chat-toggle {
        width: 55px;
        height: 55px;
        font-size: 0.7rem;
    }

    .chat-toggle i {
        font-size: 1.3rem;
    }

    .chat-window {
        width: calc(100vw - 40px);
        height: 460px;
        position: fixed;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
        z-index: 10001;
    }

    .chat-header {
        padding: 10px 12px;
    }

    .chat-header-content h4 {
        font-size: 0.85rem;
    }

    .chat-header-content h4 i {
        font-size: 1rem;
    }

    .chat-header-content p {
        font-size: 0.75rem;
    }

    .chat-close {
        width: 28px;
        height: 28px;
        font-size: 1.125rem;
    }

    .chat-messages {
        padding: 15px;
    }

    .chat-message {
        font-size: 0.75rem;
        margin-bottom: 12px;
    }

    .message-content {
        padding: 8px 10px;
        font-size: 0.7rem;
    }

    .message-time {
        font-size: 0.7rem;
    }

    .chat-input-container {
        padding: 8px 12px;
        gap: 8px;
    }

    #chat-input {
        padding: 8px 10px;
        font-size: 0.7rem;
    }

    .chat-send-btn {
        width: 36px;
        height: 36px;
        font-size: 0.8rem;
    }

    .chat-form {
        padding: 15px;
    }

    .chat-form h4 {
        font-size: 0.85rem;
        margin-bottom: 15px;
    }

    .chat-form p {
        font-size: 0.75rem;
        margin-bottom: 15px;
    }

    .chat-form input,
    .chat-form textarea {
        padding: 8px 10px;
        font-size: 0.7rem;
        margin-bottom: 12px;
    }

    .chat-start-btn {
        padding: 12px;
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .chat-toggle {
        width: 50px;
        height: 50px;
        font-size: 0.65rem;
    }

    .chat-toggle i {
        font-size: 1.2rem;
    }

    .chat-window {
        width: calc(100vw - 30px);
        height: 440px;
        position: fixed;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
        z-index: 10001;
    }

    .chat-header {
        padding: 10px 12px;
    }

    .chat-header-content h4 {
        font-size: 0.85rem;
    }

    .chat-header-content h4 i {
        font-size: 1rem;
    }

    .chat-header-content p {
        font-size: 0.75rem;
    }

    .chat-close {
        width: 28px;
        height: 28px;
        font-size: 1.125rem;
    }

    .chat-messages {
        padding: 15px;
    }

    .chat-message {
        font-size: 0.75rem;
    }

    .message-content {
        padding: 8px 10px;
        font-size: 0.7rem;
    }

    .message-time {
        font-size: 0.7rem;
    }

    #chat-input {
        padding: 8px 10px;
        font-size: 0.7rem;
    }

    .chat-send-btn {
        width: 36px;
        height: 36px;
        font-size: 0.8rem;
    }

    .chat-form {
        padding: 15px;
    }

    .chat-form h4 {
        font-size: 0.85rem;
    }

    .chat-form p {
        font-size: 0.75rem;
    }

    .chat-form input,
    .chat-form textarea {
        padding: 8px 10px;
        font-size: 0.7rem;
        margin-bottom: 12px;
    }

    .chat-start-btn {
        padding: 12px;
        font-size: 0.8rem;
    }
}
