/**
 * TAMER Chatbot Public Styles - Rebranded
 * Dark Green & Orange Professional Theme
 * Version: 2.0.0
 *
 * @since      1.0.0
 * @package    Tamer_Chatbot
 * @subpackage Tamer_Chatbot/public/css
 */

/* Import Brand Colors */
@import url('../../shared-branding/color-palette.css');

/* ==========================================================================
   CSS Variables & Root
   ========================================================================== */

:root {
    --tamer-primary-color: var(--am-primary-700);
    --tamer-primary-hover: var(--am-primary-800);
    --tamer-primary-light: var(--am-primary-100);
    --tamer-accent-color: var(--am-accent-600);
    --tamer-accent-hover: var(--am-accent-700);
    --tamer-text-dark: var(--am-gray-800);
    --tamer-text-light: var(--am-gray-600);
    --tamer-border-color: var(--am-gray-200);
    --tamer-bg-light: var(--am-gray-50);
    --tamer-shadow: var(--am-shadow-lg);
    --tamer-radius: 12px;
    --tamer-transition: all 0.3s ease;
}

/* ==========================================================================
   Container & Wrapper
   ========================================================================== */

.tamer-chatbot-wrapper {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--tamer-text-dark);
    position: fixed;
    z-index: 999999;
}

.tamer-chatbot-wrapper * {
    box-sizing: border-box;
}

/* Position Variants */
.tamer-chatbot-wrapper.tamer-position-bottom-right {
    bottom: 20px;
    right: 20px;
}

.tamer-chatbot-wrapper.tamer-position-bottom-left {
    bottom: 20px;
    left: 20px;
}

.tamer-chatbot-wrapper.tamer-position-top-right {
    top: 20px;
    right: 20px;
}

.tamer-chatbot-wrapper.tamer-position-top-left {
    top: 20px;
    left: 20px;
}

/* Inline Mode */
.tamer-chatbot-wrapper.tamer-inline {
    position: relative;
    width: 100%;
    height: 100%;
}

/* ==========================================================================
   Chat Trigger Button
   ========================================================================== */

.tamer-chat-trigger {
    width: 70px;
    height: 70px;
    background: var(--tamer-primary-color);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(34, 105, 61, 0.3);
    transition: var(--tamer-transition);
    position: relative;
    overflow: visible;
    padding: 0;
}

.tamer-chat-trigger:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 25px rgba(34, 105, 61, 0.4);
    background: var(--tamer-primary-hover);
}

.tamer-chat-trigger:active {
    transform: scale(0.95);
}

.tamer-trigger-content {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.tamer-trigger-avatar {
    width: 80%;
    height: 80%;
    object-fit: cover;
    border-radius: 50%;
    background: white;
    padding: 5px;
}

.tamer-lion-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Notification Badge */
.tamer-trigger-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--am-accent-600);
    color: var(--am-text-on-accent);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    box-shadow: var(--am-shadow-sm);
    animation: tamer-badge-pulse 2s infinite;
}

@keyframes tamer-badge-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(234, 88, 12, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(234, 88, 12, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(234, 88, 12, 0);
    }
}

/* Trigger Tooltip */
.tamer-trigger-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--am-gray-800);
    color: var(--am-text-on-primary);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    margin-bottom: 10px;
    box-shadow: var(--am-shadow-md);
}

.tamer-trigger-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--am-gray-800);
}

.tamer-chat-trigger:hover .tamer-trigger-tooltip {
    opacity: 1;
}

/* ==========================================================================
   Chat Window
   ========================================================================== */

.tamer-chat-window {
    width: 400px;
    height: 600px;
    background: #fff;
    border-radius: var(--tamer-radius);
    box-shadow: var(--tamer-shadow);
    display: none;
    flex-direction: column;
    overflow: hidden;
    position: absolute;
    bottom: 90px;
    right: 0;
    animation: tamer-slideUp 0.3s ease;
}

/* Position adjustments based on trigger position */
.tamer-position-bottom-left .tamer-chat-window {
    right: auto;
    left: 0;
}

.tamer-position-top-right .tamer-chat-window,
.tamer-position-top-left .tamer-chat-window {
    bottom: auto;
    top: 90px;
}

/* Inline window */
.tamer-inline-window {
    position: relative;
    width: 100%;
    height: 100%;
    bottom: auto;
    right: auto;
    top: auto;
    left: auto;
}

@keyframes tamer-slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Chat Header */
.tamer-chat-header {
    background: linear-gradient(135deg, var(--tamer-primary-color) 0%, var(--tamer-primary-hover) 100%);
    color: white;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.tamer-header-left {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
}

.tamer-header-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: white;
    padding: 3px;
    flex-shrink: 0;
}

.tamer-header-info {
    flex: 1;
}

.tamer-header-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    line-height: 1.2;
}

.tamer-header-status {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
    font-size: 13px;
    opacity: 0.9;
}

.tamer-status-indicator {
    width: 8px;
    height: 8px;
    background: var(--am-success);
    border-radius: 50%;
    animation: tamer-pulse 2s infinite;
}

@keyframes tamer-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
    }
    70% {
        box-shadow: 0 0 0 8px rgba(34, 197, 94, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
    }
}

/* Header Actions */
.tamer-header-actions {
    display: flex;
    gap: 8px;
}

.tamer-header-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--tamer-transition);
    padding: 0;
}

.tamer-header-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.tamer-header-btn .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

/* ==========================================================================
   Emotion Bar
   ========================================================================== */

.tamer-emotion-bar {
    background: var(--tamer-bg-light);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--tamer-border-color);
    animation: tamer-fadeIn 0.3s ease;
}

.tamer-emotion-icon {
    font-size: 20px;
}

.tamer-emotion-text {
    font-size: 13px;
    color: var(--tamer-text-light);
    font-weight: 500;
}

/* ==========================================================================
   Quick Actions
   ========================================================================== */

.tamer-quick-actions {
    padding: 15px;
    display: flex;
    gap: 8px;
    background: var(--tamer-bg-light);
    border-bottom: 1px solid var(--tamer-border-color);
    overflow-x: auto;
    flex-shrink: 0;
    -webkit-overflow-scrolling: touch;
}

.tamer-quick-action {
    background: white;
    border: 1px solid var(--tamer-border-color);
    border-radius: 20px;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: var(--tamer-transition);
    white-space: nowrap;
    font-size: 13px;
    color: var(--tamer-text-dark);
}

.tamer-quick-action:hover {
    background: var(--tamer-primary-color);
    color: white;
    border-color: var(--tamer-primary-color);
}

.tamer-quick-action .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

/* ==========================================================================
   Messages Container
   ========================================================================== */

.tamer-messages-container {
    flex: 1;
    overflow-y: auto;
    background: #fff;
    position: relative;
}

.tamer-messages-inner {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Message Styles */
.tamer-message {
    display: flex;
    gap: 12px;
    animation: tamer-fadeIn 0.3s ease;
}

.tamer-message-bot {
    align-items: flex-start;
}

.tamer-message-user {
    align-items: flex-start;
    flex-direction: row-reverse;
}

.tamer-message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    flex-shrink: 0;
}

.tamer-message-content {
    max-width: 75%;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tamer-message-bubble {
    padding: 12px 16px;
    border-radius: 18px;
    word-wrap: break-word;
    line-height: 1.5;
}

.tamer-message-bot .tamer-message-bubble {
    background: var(--tamer-bg-light);
    color: var(--tamer-text-dark);
    border-bottom-left-radius: 4px;
}

.tamer-message-user .tamer-message-bubble {
    background: var(--tamer-primary-color);
    color: white;
    border-bottom-right-radius: 4px;
}

.tamer-message-time {
    font-size: 11px;
    color: var(--tamer-text-light);
    padding: 0 4px;
}

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

/* Message Content Formatting */
.tamer-message-bubble strong {
    font-weight: 600;
}

.tamer-message-bubble em {
    font-style: italic;
}

.tamer-message-bubble a {
    color: inherit;
    text-decoration: underline;
}

.tamer-message-bot .tamer-message-bubble a {
    color: var(--tamer-primary-color);
}

.tamer-message-user .tamer-message-bubble a {
    color: white;
    opacity: 0.9;
}

/* Typing Indicator */
.tamer-typing-indicator {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 20px 20px;
    animation: tamer-fadeIn 0.3s ease;
}

.tamer-typing-dots {
    background: var(--tamer-bg-light);
    padding: 12px 16px;
    border-radius: 18px;
    display: flex;
    gap: 4px;
}

.tamer-typing-dots span {
    width: 8px;
    height: 8px;
    background: var(--tamer-text-light);
    border-radius: 50%;
    animation: tamer-typing 1.4s infinite;
}

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

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

@keyframes tamer-typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* ==========================================================================
   Input Area
   ========================================================================== */

.tamer-input-area {
    background: #fff;
    border-top: 1px solid var(--tamer-border-color);
    padding: 15px;
    flex-shrink: 0;
}

.tamer-input-form {
    margin: 0;
}

.tamer-input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    background: var(--tamer-bg-light);
    border-radius: 25px;
    padding: 5px 5px 5px 15px;
}

.tamer-input-field {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    resize: none;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
    padding: 8px 0;
    max-height: 100px;
    overflow-y: auto;
}

.tamer-input-field::placeholder {
    color: var(--tamer-text-light);
}

.tamer-input-actions {
    display: flex;
    gap: 5px;
}

.tamer-input-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--tamer-text-light);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--tamer-transition);
    padding: 0;
}

.tamer-input-btn:hover {
    background: rgba(0, 0, 0, 0.05);
}

.tamer-send-btn {
    background: var(--tamer-primary-color);
    color: white;
}

.tamer-send-btn:hover {
    background: var(--tamer-primary-hover);
}

.tamer-send-btn:disabled {
    background: var(--tamer-border-color);
    cursor: not-allowed;
}

.tamer-input-btn .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
}

/* Input Footer */
.tamer-input-footer {
    padding: 5px 15px 0;
    display: flex;
    justify-content: flex-end;
}

.tamer-char-counter {
    font-size: 11px;
    color: var(--tamer-text-light);
}

/* ==========================================================================
   Minimized State
   ========================================================================== */

.tamer-minimized {
    background: var(--tamer-primary-color);
    color: var(--am-text-on-primary);
    padding: 10px 15px;
    border-radius: 25px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(34, 105, 61, 0.3);
    animation: tamer-slideUp 0.3s ease;
}

.tamer-minimized-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: white;
    padding: 2px;
    flex-shrink: 0;
}

.tamer-minimized-text {
    font-size: 14px;
    font-weight: 500;
}

.tamer-restore-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--tamer-transition);
    padding: 0;
}

.tamer-restore-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ==========================================================================
   Theme Variations
   ========================================================================== */

/* Professional Green Theme (Default) */
.tamer-theme-professional {
    --tamer-primary-color: var(--am-primary-700);
    --tamer-primary-hover: var(--am-primary-800);
}

/* Accent Orange Theme */
.tamer-theme-accent {
    --tamer-primary-color: var(--am-accent-600);
    --tamer-primary-hover: var(--am-accent-700);
}

.tamer-theme-accent .tamer-chat-header {
    background: linear-gradient(135deg, var(--am-accent-600) 0%, var(--am-accent-700) 100%);
}

.tamer-theme-accent .tamer-quick-action:hover {
    background: var(--am-accent-600);
}

/* Minimal Theme */
.tamer-theme-minimal {
    --tamer-primary-color: var(--am-gray-700);
    --tamer-primary-hover: var(--am-gray-800);
}

.tamer-theme-minimal .tamer-chat-header {
    background: var(--am-gray-700);
}

.tamer-theme-minimal .tamer-quick-action:hover {
    background: var(--am-gray-700);
}

.tamer-theme-minimal .tamer-chat-window {
    border: 1px solid var(--tamer-border-color);
}

/* ==========================================================================
   Mobile Responsive
   ========================================================================== */

@media (max-width: 480px) {
    .tamer-chat-window {
        width: 100vw;
        height: 100vh;
        bottom: 0;
        right: 0;
        top: 0;
        left: 0;
        border-radius: 0;
        position: fixed;
    }
    
    .tamer-chatbot-wrapper {
        bottom: 10px;
        right: 10px;
    }
    
    .tamer-chat-trigger {
        width: 60px;
        height: 60px;
    }
    
    .tamer-quick-actions {
        flex-wrap: wrap;
    }
    
    .tamer-quick-action {
        font-size: 12px;
        padding: 6px 12px;
    }
    
    .tamer-message-content {
        max-width: 85%;
    }
}

@media (max-width: 360px) {
    .tamer-header-title {
        font-size: 16px;
    }
    
    .tamer-header-status {
        font-size: 12px;
    }
    
    .tamer-message-bubble {
        padding: 10px 12px;
        font-size: 13px;
    }
    
    .tamer-input-field {
        font-size: 13px;
    }
}

/* ==========================================================================
   Animations
   ========================================================================== */

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

/* Lion mascot wobble animation */
@keyframes tamer-wobble {
    0% { transform: rotate(0deg); }
    25% { transform: rotate(5deg); }
    75% { transform: rotate(-5deg); }
    100% { transform: rotate(0deg); }
}

.tamer-chat-trigger:hover .tamer-lion-canvas {
    animation: tamer-wobble 0.5s ease-in-out;
}

/* ==========================================================================
   Accessibility
   ========================================================================== */

.tamer-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus indicators */
.tamer-chat-trigger:focus,
.tamer-header-btn:focus,
.tamer-input-btn:focus,
.tamer-quick-action:focus {
    outline: 3px solid var(--tamer-primary-color);
    outline-offset: 2px;
}

.tamer-input-field:focus {
    box-shadow: 0 0 0 2px var(--tamer-primary-color);
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .tamer-chat-window {
        border: 2px solid;
    }
    
    .tamer-message-bubble {
        border: 1px solid;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .tamer-chatbot-wrapper *,
    .tamer-chatbot-wrapper *::before,
    .tamer-chatbot-wrapper *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .tamer-chatbot-wrapper {
        display: none !important;
    }
}