/**
 * Widget Styles - Neo-Brutalist Aesthetic
 *
 * @package Antek_Chat_Connector
 * @since 1.0.0
 */

/* Base Widget Container */
.antek-chat-widget {
    position: fixed;
    z-index: 999999;
    font-family: var(--antek-font);
}

/* Positioning */
.antek-chat-widget.antek-bottom-right {
    bottom: 20px;
    right: 20px;
}

.antek-chat-widget.antek-bottom-left {
    bottom: 20px;
    left: 20px;
}

.antek-chat-widget.antek-top-right {
    top: 20px;
    right: 20px;
}

.antek-chat-widget.antek-top-left {
    top: 20px;
    left: 20px;
}

/* Trigger Button */
.antek-chat-trigger {
    width: 60px;
    height: 60px;
    border-radius: var(--antek-radius);
    background-color: var(--antek-primary);
    color: white;
    border: 3px solid var(--antek-text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 4px 4px 0 var(--antek-text);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    overflow: hidden;
}

.antek-chat-trigger:hover {
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0 var(--antek-text);
}

.antek-chat-trigger:active {
    transform: translate(2px, 2px);
    box-shadow: 2px 2px 0 var(--antek-text);
}

.antek-chat-trigger svg {
    width: 28px;
    height: 28px;
}

/* Chat Window */
.antek-chat-window {
    position: absolute;
    width: 380px;
    height: 550px;
    background-color: var(--antek-background);
    border: 3px solid var(--antek-text);
    border-radius: var(--antek-radius);
    box-shadow: 6px 6px 0 var(--antek-text);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Position chat window based on widget position */
.antek-bottom-right .antek-chat-window,
.antek-top-right .antek-chat-window {
    right: 0;
}

.antek-bottom-left .antek-chat-window,
.antek-top-left .antek-chat-window {
    left: 0;
}

.antek-bottom-right .antek-chat-window,
.antek-bottom-left .antek-chat-window {
    bottom: 80px;
}

.antek-top-right .antek-chat-window,
.antek-top-left .antek-chat-window {
    top: 80px;
}

/* Size Variants */
.antek-size-small .antek-chat-window {
    width: 320px;
    height: 450px;
}

.antek-size-medium .antek-chat-window {
    width: 380px;
    height: 550px;
}

.antek-size-large .antek-chat-window {
    width: 440px;
    height: 650px;
}

/* Header */
.antek-chat-header {
    background-color: var(--antek-primary);
    color: white;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 3px solid var(--antek-text);
    flex-shrink: 0;
    gap: 12px;
}

.antek-chat-title {
    font-weight: 700;
    font-size: 16px;
    letter-spacing: -0.02em;
    flex: 0 0 auto;
}

.antek-chat-close {
    background: transparent;
    border: 2px solid white;
    border-radius: calc(var(--antek-radius) / 2);
    color: white;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
    padding: 0;
    flex: 0 0 auto;
}

.antek-chat-close:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

/* Mode Toggle */
.antek-mode-toggle {
    display: flex;
    gap: 4px;
    background: rgba(255, 255, 255, 0.2);
    padding: 4px;
    border-radius: calc(var(--antek-radius) / 2);
    flex: 1 1 auto;
    justify-content: center;
    max-width: 140px;
}

.antek-mode-btn {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    min-width: 60px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    border-radius: calc(var(--antek-radius) / 3);
    transition: all 0.2s ease;
    padding: 0 8px;
    opacity: 0.7;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.antek-mode-btn:hover {
    opacity: 0.9;
    background: rgba(255, 255, 255, 0.1);
}

.antek-mode-btn.active {
    background: white;
    color: var(--antek-primary);
    opacity: 1;
}

.antek-mode-btn svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.mode-label {
    font-size: 10px;
}

/* Messages Container */
.antek-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: #f9f9f9;
}

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

.antek-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.antek-chat-messages::-webkit-scrollbar-thumb {
    background: var(--antek-text);
    border-radius: 4px;
}

/* Welcome Message */
.antek-chat-welcome {
    background-color: var(--antek-secondary);
    color: white;
    padding: 12px 16px;
    border-radius: calc(var(--antek-radius) / 2);
    border: 2px solid var(--antek-text);
    font-size: 14px;
    line-height: 1.5;
    max-width: 80%;
    align-self: flex-start;
}

/* Message Bubbles */
.antek-chat-message {
    padding: 10px 14px;
    border-radius: 18px;
    max-width: 75%;
    word-wrap: break-word;
    font-size: 14px;
    line-height: 1.4;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    animation: messageSlideIn 0.3s ease;
}

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

/* User messages - right-aligned with primary color background */
.antek-chat-message-user {
    align-self: flex-end;
    background: var(--antek-primary, #FF6B4A);
    color: white;
    border-radius: 18px 18px 4px 18px;
    margin-left: auto;
}

/* Bot/Agent messages - left-aligned with light background and border */
.antek-chat-message-bot {
    align-self: flex-start;
    background: white;
    color: var(--antek-text, #2C2C2C);
    border: 2px solid var(--antek-primary, #FF6B4A);
    border-radius: 18px 18px 18px 4px;
    margin-right: auto;
}

/* Sender label for bot messages */
.antek-chat-message-bot::before {
    content: 'Agent';
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--antek-primary, #FF6B4A);
    margin-bottom: 4px;
    text-transform: uppercase;
}

/* Input Wrapper - Better spacing and layout */
.antek-chat-input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 16px;
    background-color: white;
    border-top: 1px solid #e0e0e0;
    flex-shrink: 0;
    position: relative;
}

/* Input Modes */
.antek-input-mode {
    display: none;
    gap: 8px;
    align-items: center;
}

.antek-input-mode.active {
    display: flex;
}

/* Text Mode */
.antek-text-mode {
    width: 100%;
}

/* Voice Mode - Modern gradient background */
.antek-voice-mode {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-around;
    padding: 30px 20px;
    gap: 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 300px;
    position: relative;
    overflow: hidden;
}

.antek-voice-mode::before {
    content: '';
    position: absolute;
    width: 300px;
    height: 300px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    top: -150px;
    right: -150px;
}

/* Voice Status Container */
.antek-voice-status-container {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    z-index: 1;
}

/* Animated pulse background */
.antek-voice-animation {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,255,255,0.3) 0%, transparent 70%);
    position: absolute;
    animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% {
        transform: scale(1);
        opacity: 0.5;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.2;
    }
}

.antek-voice-instructions {
    color: white;
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    z-index: 2;
}

/* Status text - white on gradient */
.antek-voice-status-text {
    color: white;
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    z-index: 2;
}

/* MICROPHONE BUTTON - IMPOSSIBLE TO MISS */
.antek-voice-button {
    position: relative;
    width: 140px;
    height: 140px;
    border-radius: 50%;
    border: 5px solid white;
    background: linear-gradient(135deg, #FF6B6B 0%, #FF8E53 100%);
    color: white;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    box-shadow:
        0 20px 40px rgba(0, 0, 0, 0.3),
        0 10px 20px rgba(255, 107, 107, 0.4),
        inset 0 -5px 20px rgba(0, 0, 0, 0.2),
        inset 0 5px 20px rgba(255, 255, 255, 0.3);
    display: flex !important;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

/* Pulsing ring around button */
.antek-voice-button::before {
    content: '';
    position: absolute;
    top: -15px;
    left: -15px;
    right: -15px;
    bottom: -15px;
    border-radius: 50%;
    border: 4px solid rgba(255, 255, 255, 0.5);
    animation: pulse-ring 2s ease-out infinite;
}

@keyframes pulse-ring {
    0% {
        transform: scale(0.95);
        opacity: 1;
    }
    100% {
        transform: scale(1.1);
        opacity: 0;
    }
}

/* Glowing effect */
.antek-voice-button::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255,255,255,0.3) 0%, transparent 70%);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: glow-pulse 2s ease-in-out infinite alternate;
}

@keyframes glow-pulse {
    from {
        transform: translate(-50%, -50%) scale(0.9);
        opacity: 0.5;
    }
    to {
        transform: translate(-50%, -50%) scale(1.1);
        opacity: 1;
    }
}

.antek-voice-button:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow:
        0 25px 50px rgba(0, 0, 0, 0.4),
        0 15px 30px rgba(255, 107, 107, 0.5),
        inset 0 -5px 20px rgba(0, 0, 0, 0.3),
        inset 0 5px 20px rgba(255, 255, 255, 0.4);
}

.antek-voice-button:active {
    transform: scale(0.95);
}

/* When call is active - green gradient */
.antek-voice-button.active {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    border-color: #38ef7d;
    animation: pulse-active 1s ease-in-out infinite;
}

@keyframes pulse-active {
    0%, 100% {
        box-shadow:
            0 20px 40px rgba(0, 0, 0, 0.3),
            0 10px 20px rgba(56, 239, 125, 0.4);
    }
    50% {
        box-shadow:
            0 25px 50px rgba(0, 0, 0, 0.4),
            0 15px 30px rgba(56, 239, 125, 0.6);
    }
}

/* Microphone icon - BOLD and VISIBLE */
.antek-voice-button svg {
    width: 70px;
    height: 70px;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
    z-index: 3;
    position: relative;
}

.voice-icon {
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}

/* Input Field - Textarea with auto-resize */
.antek-chat-input {
    flex: 1;
    min-height: 44px;
    max-height: 120px;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 22px;
    background-color: var(--antek-background);
    color: var(--antek-text);
    font-size: 14px;
    font-family: var(--antek-font);
    line-height: 1.4;
    resize: none;
    overflow-y: auto;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

.antek-chat-input:focus {
    border-color: var(--antek-primary);
    box-shadow: 0 0 0 3px rgba(255, 107, 74, 0.1);
}

.antek-chat-input::placeholder {
    color: #999;
}

/* Send Button - Larger and more prominent */
.antek-chat-send {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background-color: var(--antek-primary);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
    padding: 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.antek-chat-send:hover {
    background-color: var(--antek-secondary);
    transform: scale(1.05);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.15);
}

.antek-chat-send:active {
    transform: scale(0.95);
}

.antek-chat-send svg {
    width: 20px;
    height: 20px;
}

/* Loading State */
.antek-chat-loading {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
}

.antek-chat-loading span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--antek-text);
    animation: bounce 1.4s ease-in-out infinite;
}

.antek-chat-loading span:nth-child(2) {
    animation-delay: 0.2s;
}

.antek-chat-loading span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes bounce {
    0%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
}

/* Responsive Design */
@media screen and (max-width: 480px) {
    .antek-chat-window {
        width: calc(100vw - 40px) !important;
        height: calc(100vh - 100px) !important;
        max-width: 380px;
    }

    .antek-chat-trigger {
        width: 56px;
        height: 56px;
    }

    .antek-chat-trigger svg {
        width: 24px;
        height: 24px;
    }

    .antek-chat-widget {
        bottom: 16px !important;
        right: 16px !important;
        left: 16px !important;
    }

    .antek-chat-widget.antek-bottom-left,
    .antek-chat-widget.antek-bottom-right {
        left: 16px !important;
        right: 16px !important;
    }

    .antek-bottom-right .antek-chat-window,
    .antek-bottom-left .antek-chat-window {
        left: 0 !important;
        right: 0 !important;
    }
}

/* Accessibility */
.antek-chat-trigger:focus,
.antek-chat-close:focus,
.antek-voice-button:focus,
.antek-chat-send:focus {
    outline: 2px solid var(--antek-primary);
    outline-offset: 2px;
}

/* Hide Widget Initially */
.antek-chat-widget {
    display: none;
}

.antek-chat-widget.antek-initialized {
    display: block;
}
