/* WhatsApp Chat Bot Prototype Styles */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #e5ddd5;
    height: 100vh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Allow text selection in input and message areas */
.message-text,
.message-input input {
    -webkit-user-select: text;
    -khtml-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

.whatsapp-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-width: 800px;
    margin: 0 auto;
    background: #fff;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
}

/* Header Styles */
.chat-header {
    background: #075e54;
    color: white;
    padding: 10px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

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

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #25d366;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.contact-info h3 {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 2px;
}

.status {
    font-size: 12px;
    color: #a7a7a7;
}

.header-actions {
    display: flex;
    gap: 8px;
}

.action-btn {
    background: none;
    border: none;
    color: white;
    font-size: 18px;
    padding: 8px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Chat Messages Area */
.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #e5ddd5;
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="1" fill="%23ffffff" opacity="0.1"/><circle cx="75" cy="75" r="1" fill="%23ffffff" opacity="0.1"/><circle cx="50" cy="10" r="0.5" fill="%23ffffff" opacity="0.1"/><circle cx="10" cy="60" r="0.5" fill="%23ffffff" opacity="0.1"/><circle cx="90" cy="40" r="0.5" fill="%23ffffff" opacity="0.1"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    will-change: scroll-position;
}

.message {
    margin-bottom: 10px;
    display: flex;
    animation: messageSlide 0.3s ease-out;
}

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

.bot-message {
    justify-content: flex-start;
}

.user-message {
    justify-content: flex-end;
}

.message-content {
    max-width: 70%;
    padding: 6px 7px 8px 9px;
    border-radius: 7.5px;
    position: relative;
    word-wrap: break-word;
    display: flex;
    flex-direction: column;
}

.bot-message .message-content {
    background: #ffffff;
    border-bottom-left-radius: 0;
    box-shadow: 0 1px 0.5px rgba(0, 0, 0, 0.13);
}

.user-message .message-content {
    background: #dcf8c6;
    border-bottom-right-radius: 0;
    box-shadow: 0 1px 0.5px rgba(0, 0, 0, 0.13);
}

.message-text {
    font-size: 14.2px;
    line-height: 19px;
    color: #303030;
    margin: 0;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.user-message .message-text {
    color: #303030;
}

.message-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    margin-top: 2px;
    gap: 4px;
}

.message-time {
    font-size: 11px;
    color: #667781;
    margin: 0;
    line-height: 15px;
    font-weight: 400;
}

.message-status {
    font-size: 11px;
    color: #667781;
    margin: 0;
    line-height: 15px;
}

.message-status.read {
    color: #4fc3f7;
}

/* Markdown styling within messages */
.message-text strong {
    font-weight: 600;
}

.message-text em {
    font-style: italic;
}

.message-text del {
    text-decoration: line-through;
}

.message-text code {
    background: rgba(0, 0, 0, 0.1);
    padding: 1px 3px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
}

.message-text a {
    color: #0084ff;
    text-decoration: none;
}

.message-text a:hover {
    text-decoration: underline;
}

/* Message Input Area */
.message-input-container {
    background: #f0f0f0;
    padding: 10px 16px;
    border-top: 1px solid #e0e0e0;
}

.input-wrapper {
    display: flex;
    align-items: flex-end;
    background: white;
    border-radius: 21px;
    padding: 9px 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    min-height: 42px;
}

.attachment-btn,
.emoji-btn {
    background: none;
    border: none;
    color: #8696a0;
    font-size: 24px;
    padding: 8px;
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.attachment-btn:hover,
.emoji-btn:hover {
    background: #f5f5f5;
}

.message-input {
    flex: 1;
    margin: 0 8px;
    min-height: 20px;
    max-height: 100px;
    overflow-y: auto;
}

.message-input input {
    width: 100%;
    border: none;
    outline: none;
    font-size: 15px;
    padding: 0;
    background: transparent;
    line-height: 20px;
    font-family: inherit;
    resize: none;
}

.message-input input::placeholder {
    color: #8696a0;
}

.send-btn {
    background: #25d366;
    border: none;
    color: white;
    font-size: 16px;
    padding: 8px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin-left: 4px;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.send-btn:hover {
    background: #20ba5a;
}

.send-btn:disabled {
    background: #8696a0;
    cursor: not-allowed;
}

/* Emoji picker styles */
.emoji-picker {
    position: absolute;
    bottom: 70px;
    right: 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 12px;
    display: none;
    z-index: 1000;
    max-width: 300px;
}

.emoji-picker.show {
    display: block;
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 4px;
    max-height: 200px;
    overflow-y: auto;
}

.emoji-item {
    padding: 8px;
    cursor: pointer;
    border-radius: 4px;
    text-align: center;
    font-size: 18px;
    transition: background-color 0.2s;
}

.emoji-item:hover {
    background: #f0f0f0;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    background: white;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    max-width: 60px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    margin-bottom: 10px;
}

.typing-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #999;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) {
    animation-delay: -0.32s;
}

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

@keyframes typing {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Mobile-First Responsive Design */

/* Large Mobile Devices (480px - 768px) */
@media (max-width: 768px) {
    .whatsapp-container {
        height: 100vh;
        max-width: 100%;
        border-radius: 0;
        box-shadow: none;
    }
    
    .chat-header {
        padding: 12px 16px;
        position: sticky;
        top: 0;
        z-index: 100;
    }
    
    .header-info h3 {
        font-size: 18px;
    }
    
    .header-info .status {
        font-size: 13px;
    }
    
    .chat-messages {
        padding: 12px 16px;
        padding-bottom: 20px;
    }
    
    .message {
        margin-bottom: 12px;
    }
    
    .message-content {
        max-width: 90%;
        padding: 8px 10px 10px 12px;
    }
    
    .message-text {
        font-size: 15px;
        line-height: 20px;
    }
    
    .message-footer {
        margin-top: 4px;
        gap: 6px;
    }
    
    .message-time {
        font-size: 12px;
    }
    
    .message-input-container {
        padding: 12px 16px;
        position: sticky;
        bottom: 0;
        background: #f0f0f0;
        border-top: 1px solid #e0e0e0;
    }
    
    .input-wrapper {
        padding: 8px 12px;
        min-height: 44px;
    }
    
    .attachment-btn,
    .emoji-btn,
    .send-btn {
        width: 44px;
        height: 44px;
        font-size: 20px;
    }
    
    .message-input input {
        font-size: 16px; /* Prevents zoom on iOS */
        line-height: 22px;
    }
    
    .emoji-picker {
        right: 16px;
        left: 16px;
        max-width: none;
        bottom: 80px;
        padding: 16px;
    }
    
    .emoji-grid {
        grid-template-columns: repeat(8, 1fr);
        gap: 6px;
        max-height: 240px;
    }
    
    .emoji-item {
        padding: 12px;
        font-size: 20px;
    }
    
    .typing-indicator {
        max-width: 70px;
        padding: 10px 14px;
    }
    
    .typing-dot {
        width: 7px;
        height: 7px;
    }
}

/* Small Mobile Devices (320px - 480px) */
@media (max-width: 480px) {
    .chat-header {
        padding: 10px 12px;
    }
    
    .header-info h3 {
        font-size: 16px;
    }
    
    .avatar {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
    
    .chat-messages {
        padding: 10px 12px;
        padding-bottom: 18px;
    }
    
    .message-content {
        max-width: 95%;
        padding: 7px 9px 9px 11px;
    }
    
    .message-text {
        font-size: 14px;
        line-height: 19px;
    }
    
    .message-input-container {
        padding: 10px 12px;
    }
    
    .input-wrapper {
        padding: 6px 10px;
        min-height: 42px;
    }
    
    .attachment-btn,
    .emoji-btn,
    .send-btn {
        width: 42px;
        height: 42px;
        font-size: 18px;
    }
    
    .message-input input {
        font-size: 16px;
        line-height: 20px;
    }
    
    .emoji-picker {
        right: 12px;
        left: 12px;
        bottom: 75px;
        padding: 12px;
    }
    
    .emoji-grid {
        grid-template-columns: repeat(7, 1fr);
        gap: 4px;
        max-height: 200px;
    }
    
    .emoji-item {
        padding: 10px;
        font-size: 18px;
    }
}

/* Extra Small Devices (up to 320px) */
@media (max-width: 320px) {
    .chat-header {
        padding: 8px 10px;
    }
    
    .header-info h3 {
        font-size: 15px;
    }
    
    .avatar {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
    
    .chat-messages {
        padding: 8px 10px;
        padding-bottom: 16px;
    }
    
    .message-content {
        max-width: 98%;
        padding: 6px 8px 8px 10px;
    }
    
    .message-text {
        font-size: 13px;
        line-height: 18px;
    }
    
    .message-input-container {
        padding: 8px 10px;
    }
    
    .input-wrapper {
        padding: 5px 8px;
        min-height: 40px;
    }
    
    .attachment-btn,
    .emoji-btn,
    .send-btn {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    
    .emoji-grid {
        grid-template-columns: repeat(6, 1fr);
        gap: 3px;
        max-height: 180px;
    }
    
    .emoji-item {
        padding: 8px;
        font-size: 16px;
    }
}

/* Landscape Mobile Orientation */
@media (max-width: 768px) and (orientation: landscape) {
    .chat-messages {
        padding: 8px 16px;
    }
    
    .message-content {
        max-width: 80%;
    }
    
    .message-input-container {
        padding: 8px 16px;
    }
    
    .input-wrapper {
        min-height: 40px;
    }
    
    .emoji-picker {
        bottom: 60px;
        max-height: 150px;
    }
    
    .emoji-grid {
        max-height: 120px;
    }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
    .action-btn:hover,
    .attachment-btn:hover,
    .emoji-btn:hover,
    .send-btn:hover {
        background: none;
    }
    
    .action-btn:active,
    .attachment-btn:active,
    .emoji-btn:active,
    .send-btn:active {
        background: rgba(255, 255, 255, 0.1);
    }
    
    .emoji-item:hover {
        background: none;
    }
    
    .emoji-item:active {
        background: #f0f0f0;
    }
}

/* Scrollbar Styling */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

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

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

/* WhatsApp-Style In-Chat Menu */
.whatsapp-menu-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border-radius: 16px;
    margin: 8px 0;
    max-width: 90%;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(37, 211, 102, 0.1);
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.whatsapp-menu-header {
    background: linear-gradient(135deg, #25d366 0%, #20ba5a 100%);
    padding: 16px 20px;
    border-bottom: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.whatsapp-menu-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.05) 100%);
    pointer-events: none;
}

.whatsapp-menu-title {
    font-weight: 700;
    font-size: 16px;
    color: white;
    margin: 0;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 1;
}

.whatsapp-menu-subtitle {
    font-size: 13px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
    margin: 4px 0 0 0;
    text-align: center;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 1;
}

.whatsapp-menu-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    position: relative;
    z-index: 1;
}

.whatsapp-menu-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.whatsapp-menu-content {
    padding: 20px;
    background: white;
}

.whatsapp-menu-options {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.whatsapp-menu-option {
    background: none;
    border: none;
    padding: 16px 20px;
    color: #2c3e50;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
    border-radius: 12px;
    margin-bottom: 8px;
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.whatsapp-menu-option::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(37, 211, 102, 0.1), transparent);
    transition: left 0.5s;
}

.whatsapp-menu-option:hover {
    background: linear-gradient(135deg, #f8fff9 0%, #f0fdf4 100%);
    border-color: rgba(37, 211, 102, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.15);
    color: #25d366;
}

.whatsapp-menu-option:hover::before {
    left: 100%;
}

.whatsapp-menu-option:active {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(37, 211, 102, 0.2);
}

/* Radio button styles removed - no longer needed */

/* Send button styles removed - no longer needed */

/* Quick Actions Menu - WhatsApp Style */
.quick-actions-menu {
    background: #ffffff;
    border-radius: 12px;
    margin: 8px 0;
    max-width: 90%;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
    border: 1px solid #e0e0e0;
    overflow: hidden;
}

.quick-actions-header {
    background: #f8f9fa;
    padding: 12px 16px;
    border-bottom: 1px solid #e0e0e0;
}

.quick-actions-title {
    font-weight: 600;
    font-size: 16px;
    color: #333333;
    margin: 0;
}

.quick-actions-content {
    padding: 16px;
}

.quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.quick-action-btn {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 16px 12px;
    color: #333333;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-align: center;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.quick-action-btn:hover {
    background: #e9ecef;
    border-color: #25d366;
    transform: translateY(-1px);
}

.quick-action-btn:active {
    transform: translateY(0);
    background: #dee2e6;
}

.quick-action-btn i {
    font-size: 20px;
    color: #25d366;
}

.quick-action-btn span {
    font-weight: 500;
    font-size: 13px;
}

/* Mobile Optimizations for WhatsApp-Style Menus */
@media (max-width: 768px) {
    .whatsapp-menu-card {
        max-width: 95%;
    }
    
    .whatsapp-menu-header {
        padding: 10px 14px;
    }
    
    .whatsapp-menu-title {
        font-size: 15px;
    }
    
    .whatsapp-menu-content {
        padding: 14px;
    }
    
    .whatsapp-menu-option {
        padding: 10px 0;
        font-size: 14px;
        gap: 10px;
    }
    
    .whatsapp-radio {
        width: 18px;
        height: 18px;
    }
    
    .whatsapp-radio.selected::after {
        width: 6px;
        height: 6px;
    }
    
    .whatsapp-menu-send-btn {
        padding: 12px 20px;
        font-size: 15px;
    }
    
    .quick-actions-menu {
        max-width: 95%;
    }
    
    .quick-actions-header {
        padding: 10px 14px;
    }
    
    .quick-actions-title {
        font-size: 15px;
    }
    
    .quick-actions-content {
        padding: 14px;
    }
    
    .quick-actions-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .quick-action-btn {
        padding: 14px 10px;
        font-size: 13px;
    }
    
    .quick-action-btn i {
        font-size: 18px;
    }
    
    .quick-action-btn span {
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .whatsapp-menu-card {
        max-width: 98%;
    }
    
    .whatsapp-menu-header {
        padding: 8px 12px;
    }
    
    .whatsapp-menu-title {
        font-size: 14px;
    }
    
    .whatsapp-menu-content {
        padding: 12px;
    }
    
    .whatsapp-menu-option {
        padding: 8px 0;
        font-size: 13px;
        gap: 8px;
    }
    
    .whatsapp-radio {
        width: 16px;
        height: 16px;
    }
    
    .whatsapp-radio.selected::after {
        width: 5px;
        height: 5px;
    }
    
    .whatsapp-menu-send-btn {
        padding: 10px 16px;
        font-size: 14px;
    }
    
    .quick-actions-menu {
        max-width: 98%;
    }
    
    .quick-actions-header {
        padding: 8px 12px;
    }
    
    .quick-actions-title {
        font-size: 14px;
    }
    
    .quick-actions-content {
        padding: 12px;
    }
    
    .quick-actions-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .quick-action-btn {
        padding: 12px 8px;
        font-size: 12px;
    }
    
    .quick-action-btn i {
        font-size: 16px;
    }
    
    .quick-action-btn span {
        font-size: 11px;
    }
}

