/**
 * Ryerson Brothers Excavating Chat Widget Styles
 * Brand colors: primary blue #24408f, accent gold #ffaf00, dark #1d252c
 */

/* Widget Container */
#ryerson-chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 10000;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.4;
}

/* Chat Button */
.ryerson-chat-button {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #24408f 0%, #1d252c 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(36, 64, 143, 0.3);
    transition: all 0.3s ease;
    color: white;
    border: none;
    outline: none;
    position: relative;
}

.ryerson-chat-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(36, 64, 143, 0.4);
    background: linear-gradient(135deg, #2b4ba0 0%, #242b35 100%);
}

.ryerson-chat-button.ryerson-chat-active {
    background: linear-gradient(135deg, #ffaf00 0%, #e69900 100%);
}

.ryerson-chat-button svg {
    width: 24px;
    height: 24px;
    transition: transform 0.3s ease;
}

.ryerson-chat-button.ryerson-chat-active svg {
    transform: rotate(180deg);
}

/* Tooltip */
.ryerson-chat-tooltip {
    position: absolute;
    right: 70px;
    top: 50%;
    transform: translateY(-50%);
    background: #1d252c;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.ryerson-chat-tooltip::after {
    content: '';
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    border: 6px solid transparent;
    border-left-color: #1d252c;
}

.ryerson-chat-button:hover .ryerson-chat-tooltip {
    opacity: 1;
}

/* Chat Panel */
.ryerson-chat-panel {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 350px;
    height: 500px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(20px) scale(0.95);
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: all;
}

.ryerson-chat-panel:not(.ryerson-chat-hidden) {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.ryerson-chat-hidden {
    pointer-events: none;
}

/* Chat Header */
.ryerson-chat-header {
    background: linear-gradient(135deg, #24408f 0%, #1d252c 100%);
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ryerson-chat-header-content h3 {
    margin: 0 0 4px 0;
    font-size: 16px;
    font-weight: 600;
}

.ryerson-chat-header-content p {
    margin: 0;
    font-size: 13px;
    opacity: 0.9;
}

.ryerson-chat-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
}

.ryerson-chat-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Messages Container */
.ryerson-chat-messages {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

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

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

.ryerson-chat-messages::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

/* Chat Messages */
.ryerson-chat-message {
    display: flex;
    flex-direction: column;
    max-width: 85%;
}

.ryerson-chat-message-user {
    align-self: flex-end;
    align-items: flex-end;
}

.ryerson-chat-message-bot {
    align-self: flex-start;
    align-items: flex-start;
}

.ryerson-chat-message-content {
    padding: 10px 14px;
    border-radius: 12px;
    word-wrap: break-word;
    line-height: 1.4;
}

.ryerson-chat-message-user .ryerson-chat-message-content {
    background: linear-gradient(135deg, #24408f 0%, #2b4ba0 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.ryerson-chat-message-bot .ryerson-chat-message-content {
    background: #f8f9fa;
    color: #333333;
    border: 1px solid #e9ecef;
    border-bottom-left-radius: 4px;
}

.ryerson-chat-message-time {
    font-size: 11px;
    color: #999;
    margin-top: 4px;
    padding: 0 4px;
}

/* Loading Animation */
.ryerson-chat-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 16px;
}

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

.ryerson-chat-dots div {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #24408f;
    animation: ryerson-chat-bounce 1.4s infinite ease-in-out both;
}

.ryerson-chat-dots div:nth-child(1) { animation-delay: -0.32s; }
.ryerson-chat-dots div:nth-child(2) { animation-delay: -0.16s; }
.ryerson-chat-dots div:nth-child(3) { animation-delay: 0s; }

@keyframes ryerson-chat-bounce {
    0%, 80%, 100% {
        transform: scale(0);
    } 40% {
        transform: scale(1);
    }
}

/* Input Container */
.ryerson-chat-input-container {
    border-top: 1px solid #e9ecef;
    padding: 16px;
}

.ryerson-chat-input-wrapper {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    transition: opacity 0.3s ease;
}

.ryerson-chat-input-wrapper input {
    flex: 1;
    border: 2px solid #e9ecef;
    border-radius: 20px;
    padding: 10px 16px;
    font-size: 14px;
    outline: none;
    resize: none;
    transition: border-color 0.2s ease;
    background: white;
}

.ryerson-chat-input-wrapper input:focus {
    border-color: #24408f;
}

.ryerson-chat-input-wrapper input:disabled {
    background: #f8f9fa;
    cursor: not-allowed;
}

.ryerson-chat-send-button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #24408f 0%, #1d252c 100%);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.ryerson-chat-send-button:hover:not(:disabled) {
    background: linear-gradient(135deg, #2b4ba0 0%, #242b35 100%);
    transform: scale(1.05);
}

.ryerson-chat-send-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.ryerson-chat-send-button svg {
    width: 18px;
    height: 18px;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    #ryerson-chat-widget {
        bottom: 15px;
        right: 15px;
        left: 15px;
    }
    
    .ryerson-chat-panel {
        width: 100%;
        height: 70vh;
        max-height: 500px;
        bottom: 80px;
        left: 0;
        right: 0;
    }
    
    .ryerson-chat-button {
        width: 55px;
        height: 55px;
        position: absolute;
        right: 0;
        bottom: 0;
    }
    
    .ryerson-chat-tooltip {
        display: none;
    }
}

@media (max-width: 350px) {
    .ryerson-chat-messages {
        padding: 12px;
    }
    
    .ryerson-chat-input-container {
        padding: 12px;
    }
    
    .ryerson-chat-header {
        padding: 12px 16px;
    }
}