/**
 * Gemini Chat - Complete Redesign
 * Clean, minimal, professional like real Google Gemini
 */

/* ========================================
   RESET & BASE
   ======================================== */
.brxe-montor-gemini-chat,
.brxe-montor-gemini-chat * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

.brxe-montor-gemini-chat {
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
}

.gemini-chat-wrapper {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    padding: 40px 20px 20px;
    font-family: 'Google Sans', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.gemini-chat-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 140px);
    max-height: 800px;
    min-height: 500px;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    overflow: hidden;
    border: 1px solid #e8eaed;
    padding-top: 120px;
    padding-left: 10%;
    padding-right: 10%;
}

/* ========================================
   HEADER - Minimal & Clean
   ======================================== */
.gemini-chat-header {
    padding: 16px 24px;
    background: #ffffff;
    border-bottom: 1px solid #e8eaed;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.gemini-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.gemini-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.gemini-chat-title {
    font-size: 16px;
    font-weight: 500;
    color: #202124;
    letter-spacing: -0.01em;
}

.gemini-chat-title::before {
    content: '✨';
    margin-right: 8px;
    font-size: 18px;
}

.gemini-chat-subtitle {
    font-size: 13px;
    color: #5f6368;
    font-weight: 400;
}

.gemini-clear-btn,
.gemini-qr-btn {
    background: #ffffff;
    border: 2px solid #1a73e8;
    padding: 8px;
    border-radius: 50%;
    cursor: pointer;
    color: #1a73e8;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 4px rgba(26, 115, 232, 0.15);
}

.gemini-clear-btn:hover,
.gemini-qr-btn:hover {
    background: #1a73e8;
    color: #ffffff;
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(26, 115, 232, 0.3);
}

.gemini-clear-btn svg,
.gemini-qr-btn svg {
    width: 20px;
    height: 20px;
}

.gemini-qr-btn:active {
    transform: scale(0.95);
}

/* ========================================
   MESSAGES AREA - Like Real Gemini
   ======================================== */
.gemini-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    background: #ffffff;
    scroll-behavior: smooth;
}

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

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

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

.gemini-chat-messages::-webkit-scrollbar-thumb:hover {
    background: #bdc1c6;
}

/* Message Structure */
.gemini-message {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    animation: messageSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* Avatar */
.gemini-message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 16px;
    background: #f1f3f4;
}

.gemini-message.ai .gemini-message-avatar {
    background: linear-gradient(135deg, #4285f4 0%, #34a853 50%, #fbbc04 75%, #ea4335 100%);
    color: #ffffff;
}

.gemini-message.user .gemini-message-avatar {
    background: #1a73e8;
    color: #ffffff;
    order: 2;
}

.gemini-message.user {
    flex-direction: row-reverse;
}

/* Message Content */
.gemini-message-content {
    flex: 1;
    max-width: calc(100% - 44px);
}

.gemini-message.user .gemini-message-content {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.gemini-message-text {
    padding: 0;
    border-radius: 0;
    line-height: 1.6;
    color: #202124;
    font-size: 14px;
    word-wrap: break-word;
    white-space: pre-wrap;
    background: transparent;
    border: none;
}

.gemini-message.user .gemini-message-text {
    background: #e3f2fd;
    padding: 10px 16px;
    border-radius: 18px;
    color: #001d35;
}

/* Message Footer (Time + Speaker) */
.gemini-message-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
}

.gemini-message-time {
    font-size: 11px;
    color: #5f6368;
}

/* Speaker Button */
.gemini-speaker-btn {
    background: transparent;
    border: none;
    padding: 4px;
    border-radius: 50%;
    cursor: pointer;
    color: #5f6368;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
}

.gemini-speaker-btn:hover {
    background: #f1f3f4;
    color: #1a73e8;
}

.gemini-speaker-btn.speaking {
    color: #1a73e8;
    background: #e8f0fe;
}

.gemini-speaker-btn.speaking .speaker-playing {
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.gemini-message-image {
    max-width: 300px;
    margin-bottom: 8px;
    border-radius: 12px;
    overflow: hidden;
}

.gemini-message-image img {
    width: 100%;
    height: auto;
    display: block;
}

/* Welcome Message */
.gemini-welcome-message .gemini-message-text {
    color: #5f6368;
    font-size: 14px;
}

/* Typing Indicator */
.gemini-typing-indicator {
    display: flex;
    gap: 4px;
    padding: 8px 0;
}

.gemini-typing-dot {
    width: 8px;
    height: 8px;
    background: #5f6368;
    border-radius: 50%;
    animation: typingAnimation 1.4s ease-in-out infinite;
}

.gemini-typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.gemini-typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

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

/* Error Message */
.gemini-error-message {
    background: #fce8e6;
    color: #c5221f;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 13px;
    margin: 16px 0;
    border-left: 3px solid #ea4335;
}

/* ========================================
   INPUT AREA - Clean & Functional
   ======================================== */
.gemini-chat-input-area {
    padding: 16px 24px 20px;
    background: #ffffff;
    border-top: 1px solid #e8eaed;
    flex-shrink: 0;
}

.gemini-image-preview {
    margin-bottom: 12px;
    display: inline-block;
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e8eaed;
}

.gemini-preview-img {
    max-width: 200px;
    max-height: 200px;
    display: block;
}

.gemini-remove-image {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.gemini-remove-image:hover {
    background: rgba(0, 0, 0, 0.9);
}

.gemini-chat-form {
    width: 100%;
}

.gemini-input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    background: #ffffff;
    border-radius: 24px;
    padding: 4px 4px 4px 16px;
    transition: all 0.2s ease;
    border: 2px solid #e0e4e8;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.gemini-input-wrapper:focus-within {
    background: #ffffff;
    border-color: #1a73e8;
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.1), 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Action Buttons */
.gemini-action-buttons {
    display: flex;
    gap: 4px;
    align-items: center;
}

.gemini-action-btn {
    background: #ffffff;
    border: 2px solid #1a73e8;
    padding: 8px;
    border-radius: 50%;
    cursor: pointer;
    color: #1a73e8;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    box-shadow: 0 1px 4px rgba(26, 115, 232, 0.15);
}

.gemini-action-btn:hover {
    background: #1a73e8;
    color: #ffffff;
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(26, 115, 232, 0.3);
}

.gemini-action-btn:active {
    transform: scale(0.95);
}

.gemini-action-btn:disabled {
    background: #f1f3f4;
    border-color: #dadce0;
    color: #9aa0a6;
    cursor: not-allowed;
    opacity: 0.6;
}

.gemini-action-btn:disabled:hover {
    transform: none;
    box-shadow: 0 1px 4px rgba(26, 115, 232, 0.15);
}

.gemini-action-btn svg {
    width: 20px;
    height: 20px;
}

/* Voice Button Recording State */
.gemini-voice-btn.recording {
    background: #ea4335;
    color: #ffffff;
    animation: recordingPulse 1.5s ease-in-out infinite;
}

@keyframes recordingPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(234, 67, 53, 0.7);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 0 8px rgba(234, 67, 53, 0);
    }
}

/* Input Field */
.gemini-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    outline: none;
    padding: 10px 8px;
    line-height: 1.5;
    max-height: 120px;
    min-height: 20px;
    color: #202124;
}

.gemini-input::placeholder {
    color: #5f6368;
}

/* Send Button */
.gemini-send-btn {
    background: #1a73e8;
    border: 2px solid #1a73e8;
    color: #ffffff;
    cursor: pointer;
    padding: 10px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(26, 115, 232, 0.3);
}

.gemini-send-btn:hover:not(:disabled) {
    background: #1557b0;
    border-color: #1557b0;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(26, 115, 232, 0.4);
}

.gemini-send-btn:active:not(:disabled) {
    transform: scale(0.95);
}

.gemini-send-btn:disabled {
    background: #f1f3f4;
    border-color: #dadce0;
    color: #9aa0a6;
    cursor: not-allowed;
    opacity: 0.6;
    box-shadow: none;
}

.gemini-send-btn svg {
    width: 20px;
    height: 20px;
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 768px) {
    .gemini-chat-wrapper {
        padding: 20px 12px 12px;
    }

    .gemini-chat-container {
        height: calc(100vh - 100px);
        border-radius: 12px;
    }

    .gemini-chat-header {
        padding: 12px 16px;
    }

    .gemini-chat-messages {
        padding: 16px;
    }

    .gemini-message {
        gap: 10px;
        margin-bottom: 20px;
    }

    .gemini-message-avatar {
        width: 28px;
        height: 28px;
        font-size: 14px;
    }

    .gemini-message-text {
        font-size: 13px;
    }

    .gemini-chat-input-area {
        padding: 12px 16px 16px;
    }

    .gemini-input {
        font-size: 16px; /* Prevent zoom on iOS */
    }
}

@media (max-width: 480px) {
    .gemini-chat-wrapper {
        padding: 16px 8px 8px;
    }

    .gemini-chat-container {
        border-radius: 8px;
    }

    .gemini-message-content {
        max-width: calc(100% - 38px);
    }

    .gemini-action-btn {
        width: 32px;
        height: 32px;
        padding: 6px;
    }

    .gemini-send-btn {
        width: 36px;
        height: 36px;
        padding: 8px;
    }
}

/* ========================================
   ACCESSIBILITY
   ======================================== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus Styles */
.gemini-input:focus,
.gemini-send-btn:focus,
.gemini-action-btn:focus,
.gemini-clear-btn:focus {
    outline: 2px solid #1a73e8;
    outline-offset: 2px;
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .gemini-chat-container {
        border: 2px solid #000;
    }

    .gemini-message.user .gemini-message-text {
        border: 1px solid #000;
    }
}

/* ========================================
   QR CODE MODAL
   ======================================== */
.gemini-qr-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 999999;
    animation: fadeIn 0.2s ease;
}

.gemini-qr-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.gemini-qr-modal-content {
    background: #ffffff;
    border-radius: 16px;
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

.gemini-qr-modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e8eaed;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.gemini-qr-modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 500;
    color: #202124;
}

.gemini-qr-close {
    background: transparent;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #5f6368;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    line-height: 1;
}

.gemini-qr-close:hover {
    background: #f1f3f4;
    color: #202124;
    transform: rotate(90deg);
}

.gemini-qr-modal-body {
    flex: 1;
    overflow: hidden;
    border-radius: 0 0 16px 16px;
}

.gemini-qr-modal-body iframe {
    display: block;
}

/* QR Modal Responsive */
@media (max-width: 768px) {
    .gemini-qr-modal-content {
        width: 95%;
        max-height: 95vh;
    }
    
    .gemini-qr-modal-header {
        padding: 16px 20px;
    }
    
    .gemini-qr-modal-header h3 {
        font-size: 16px;
    }
    
    .gemini-qr-modal-body iframe {
        height: 600px !important;
    }
}

@media (max-width: 480px) {
    .gemini-qr-modal-body iframe {
        height: 500px !important;
    }
}

