/* Modern Frontend Design for AskMe Extended */

.ask_me {
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.ask_me:hover {
    transform: scale(1.05);
}

#askmeStatus {
    display: none;
    max-height: 120px;
    overflow-y: auto;
    padding: 15px;
    background: rgba(248, 250, 252, 0.8);
    border-radius: 12px;
    margin-bottom: 20px;
    font-size: 0.875rem;
    line-height: 1.5;
    border: 1px solid rgba(226, 232, 240, 0.8);
}

.askme_buttons {
    display: none;
    gap: 12px;
    margin-bottom: 20px;
}

.askme_container {
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    position: relative;
    background: #ffffff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.askme-extended-wrapper h2 {
    text-align: center;
    margin-bottom: 15px;
    font-size: 1.5rem;
    font-weight: 600;
    color: #1f2937;
    padding: 0 20px;
}

p.askme-chat-description {
    text-align: center;
    color: #6b7280;
    margin-bottom: 20px;
    padding: 0 20px;
    line-height: 1.6;
}

#askmeMediaElement {
    width: 100%;
    height: auto;
    max-height: 500px;
    display: block;
    background: #000;
    border-radius: 12px;
    margin: 0 20px 20px 20px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.askme_inputs {
    z-index: 999;
    left: 0;
    width: 100%;
    background: #f8fafc;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    box-sizing: border-box;
    border-top: 1px solid #e5e7eb;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

#askmeTaskInput {
    margin: 0;
    width: auto;
    height: 44px;
    border: 2px solid #e5e7eb;
    background-color: white;
    padding: 0.75rem 1rem;
    border-radius: 22px;
    flex-grow: 1;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    font-family: inherit;
    letter-spacing: 0.025em;
    font-size: 0.875rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

#askmeTaskInput:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

button#askmeVoiceBtn {
    all: unset;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin-bottom: 0;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    padding: 0;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

button#askmeVoiceBtn:hover {
    background: #2563eb;
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

button#askmeVoiceBtn svg {
    width: 20px;
    height: 20px;
    stroke-width: 2;
}

button#askmeVoiceBtn.disabled {
    cursor: not-allowed;
    opacity: 0.5;
    background: #9ca3af;
    transform: none;
    box-shadow: none;
}

button#askmeVoiceBtn.listening {
    background-color: #dc2626;
    animation: pulse 2s infinite;
    box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.2);
}

/* Auto-restart indicator */
button#askmeVoiceBtn.auto-restart-enabled {
    position: relative;
}

button#askmeVoiceBtn.auto-restart-enabled::after {
    content: "🔄";
    position: absolute;
    top: -5px;
    right: -5px;
    font-size: 10px;
    background: #10b981;
    color: white;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.2);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(220, 38, 38, 0.1);
    }
}

#askmeSendBtn {
    height: 44px;
    flex-shrink: 0;
    background: #10b981;
    color: white;
    border: none;
    border-radius: 22px;
    padding: 0 20px;
    font-weight: 500;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#askmeSendBtn:hover:not(:disabled) {
    background: #059669;
    transform: scale(1.02);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

#askmeSendBtn:disabled {
    background: #9ca3af;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Modern button styling */
.askme_buttons button {
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 500;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    cursor: pointer;
    font-size: 0.875rem;
}

.askme_buttons button.button-primary {
    background: #3b82f6;
    color: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.askme_buttons button.button-primary:hover:not(:disabled) {
    background: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.askme_buttons button.button {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
}

.askme_buttons button.button:hover:not(:disabled) {
    background: #e5e7eb;
    transform: translateY(-1px);
}

.askme_buttons button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

#askmeSpinner {
    position: absolute;
    top: 40%;
    left: 50%;
    border: 3px solid #f3f4f6;
    border-top: 3px solid #3b82f6;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: askmeSpinAnimation 1s linear infinite;
    transform: translate(-50%, -50%);
    z-index: 10;
}

@keyframes askmeSpinAnimation {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

#askmeUnmuteButton {
    width: 56px;
    height: 56px;
    position: absolute;
    z-index: 99;
    left: 50%;
    top: 25%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    border: none;
    border-radius: 50%;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    padding: 12px;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

#askmeUnmuteButton:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: translate(-50%, -50%) scale(1.1);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.4);
}

#askmeUnmuteButton svg {
    height: 24px;
    width: 24px;
}

.askme_buttons_right {
    position: absolute;
    right: 20px;
    top: 33%; 
    background: rgba(59, 130, 246, 0.9);
    border-radius: 16px;
    z-index: 99;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

.askme_buttons_right a {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.2);
    padding: 10px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    box-sizing: border-box;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.askme_buttons_right a:hover {
    background-color: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.askme_buttons_right a svg {
    width: 20px;
    height: 20px;
    stroke-width: 2;
}

img.popup_tessa {
    width: 100px;
    position: absolute;
    right: 0;
    top: 41px;
    z-index: 99999;
    display: none;
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

img.popup_tessa:hover {
    transform: scale(1.05);
}

.chat_text {
    color: #000 !important;
}

button.chat_btn {
    color: #000 !important;
    border-color: #000 !important;
}

.chat_name {
    color: #000 !important;
}

/* Status message styling */
#askmeStatus.askme-status--active {
    display: block;
    animation: slideInDown 0.3s ease-out;
}

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

.status-message {
    display: block;
    margin-bottom: 4px;
    padding: 4px 0;
    font-size: 0.75rem;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
}

.status-message.status-error {
    color: #dc2626;
    background: rgba(220, 38, 38, 0.1);
    padding: 4px 8px;
    border-radius: 4px;
    border-left: 3px solid #dc2626;
}

.status-message.status-warn {
    color: #d97706;
    background: rgba(217, 119, 6, 0.1);
    padding: 4px 8px;
    border-radius: 4px;
    border-left: 3px solid #d97706;
}

.status-message.status-success {
    color: #059669;
    background: rgba(5, 150, 105, 0.1);
    padding: 4px 8px;
    border-radius: 4px;
    border-left: 3px solid #059669;
}

.status-message.status-info {
    color: #3b82f6;
    background: rgba(59, 130, 246, 0.1);
    padding: 4px 8px;
    border-radius: 4px;
    border-left: 3px solid #3b82f6;
}

/* Spinner helper text styling */
#askmeSpinnerHelperText {
    text-align: center;
    display: none;
    color: #6b7280;
    font-size: 0.875rem;
    margin-top: 10px;
    padding: 12px;
    background: rgba(248, 250, 252, 0.8);
    border-radius: 8px;
    border: 1px solid rgba(226, 232, 240, 0.8);
}

/* Responsive design improvements */
@media screen and (max-width: 910px) {
    .askme_buttons_right {
        flex-direction: row;
        justify-content: center;
        bottom: -60px;
        top: unset; 
        left: 20px;
        right: 20px;
        width: calc(100% - 40px);
        background: rgba(59, 130, 246, 0.95);
        border-radius: 12px;
    }
    
    .askme_inputs {
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        border-radius: 0;
    }
    
    #askmeTaskInput {
        font-size: 16px; /* Prevent zoom on iOS */
    }
}

@media screen and (max-width: 600px) { 
    .askme-extended-wrapper h2 {
        font-size: 1.25rem;
        padding: 0 15px;
    }
    
    #askmeMediaElement {
        max-height: 300px;
        margin: 0 15px 15px 15px;
    }
    
    .askme_inputs {
        padding: 10px 15px;
    }
    
    #askmeTaskInput {
        font-size: 16px;
        height: 40px;
    }
    
    button#askmeVoiceBtn,
    #askmeSendBtn {
        height: 40px;
        width: 40px;
    }
    
    .askme_buttons_right {
        bottom: -50px;
        left: 15px;
        right: 15px;
        width: calc(100% - 30px);
        padding: 8px;
        gap: 6px;
    }
    
    .askme_buttons_right a {
        width: 40px;
        height: 40px;
        padding: 8px;
    }
    
    .askme_buttons_right a svg {
        width: 18px;
        height: 18px;
    }
}