/* =====================================================
   POONAM MALEY STORES — CHAT WIDGET CSS
   Sleek, compact, mobile-first
   ===================================================== */

/* --- Toggle Button --- */
#modernoa-chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.chat-widget-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #C9A961, #D4AF37);
    color: #fff;
    border: none;
    border-radius: 50px;
    padding: 12px 20px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(212,175,55,0.45);
    font-size: 14px;
    font-weight: 600;
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
}
.chat-widget-btn:hover { transform: scale(1.05); box-shadow: 0 6px 24px rgba(212,175,55,0.55); }
.chat-icon { font-size: 18px; }
.chat-badge {
    position: absolute;
    top: -6px; right: -6px;
    background: #e53e3e;
    color: #fff;
    border-radius: 50%;
    width: 20px; height: 20px;
    font-size: 11px;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700;
}

/* --- Chat Window --- */
.chat-window {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 360px;
    max-height: 560px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.18);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 999998;
    animation: chatSlideIn 0.25s ease;
}
@keyframes chatSlideIn {
    from { opacity: 0; transform: translateY(20px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Minimized state */
.chat-window { transition: none; }
.chat-window.minimized { 
    height: auto !important; 
    min-height: 0 !important;
    max-height: none !important;
}
.chat-window.minimized #chat-body { 
    display: none !important; 
    height: 0 !important;
    overflow: hidden !important;
    flex: 0 !important;
    min-height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
}
.chat-window.minimized .chat-header { border-radius: 12px !important; }

/* --- Header --- */
.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: linear-gradient(135deg, #1a1a2e, #2d1b4e);
    color: #fff;
    flex-shrink: 0;
}
.chat-header-info { display: flex; align-items: center; gap: 10px; }
.chat-header-logo { font-size: 22px; }
.chat-header-text { display: flex; flex-direction: column; }
.chat-header-brand { font-size: 13px; font-weight: 700; color: #D4AF37; line-height: 1.2; }
.chat-agent-status { font-size: 11px; color: #aaa; }
.chat-agent-status.online { color: #68d391; }
.chat-header-actions { display: flex; align-items: center; gap: 6px; }
.chat-header-actions button {
    background: rgba(255,255,255,0.12);
    border: none;
    color: #fff;
    width: 28px; height: 28px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.2s;
}
.chat-header-actions button:hover { background: rgba(255,255,255,0.22); }

/* --- Chat Body --- */
#chat-body { display: flex; flex-direction: column; flex: 1; overflow: hidden; min-height: 0; }

/* --- Type Chooser (Step 1) --- */
.chat-type-chooser {
    display: flex;
    flex-direction: column;
    padding: 20px 16px 16px;
    gap: 14px;
}
.chat-store-welcome { text-align: center; }
.chat-welcome-brand {
    font-size: 16px;
    font-weight: 600;
    color: #1a1a2e;
    margin: 0 0 6px;
    line-height: 1.4;
}
.chat-welcome-brand strong { color: #C9A961; }
.chat-welcome-sub { font-size: 12px; color: #777; margin: 0; }
.chat-type-options { display: flex; gap: 10px; }
.chat-type-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 14px 10px;
    background: #f8f5f0;
    border: 2px solid #e8dcc8;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}
.chat-type-btn:hover { border-color: #C9A961; background: #fdf9f0; transform: translateY(-2px); box-shadow: 0 4px 12px rgba(201,169,97,0.2); }
.chat-type-icon { font-size: 24px; }
.chat-type-label { font-size: 13px; font-weight: 700; color: #1a1a2e; }
.chat-type-desc { font-size: 10px; color: #888; line-height: 1.4; }
.chat-type-desc em { color: #C9A961; font-style: normal; font-weight: 600; }

/* --- Login Prompt (Step 2) --- */
.chat-login-prompt {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 20px;
    min-height: 220px;
}
.chat-login-prompt-inner { text-align: center; }
.chat-login-icon { font-size: 36px; display: block; margin-bottom: 10px; }
.chat-login-prompt-inner h4 { font-size: 16px; font-weight: 700; color: #1a1a2e; margin: 0 0 8px; }
.chat-login-prompt-inner p { font-size: 12px; color: #666; margin: 0 0 16px; line-height: 1.5; }
.chat-login-link-btn {
    display: inline-block;
    background: linear-gradient(135deg, #C9A961, #D4AF37);
    color: #fff;
    padding: 10px 20px;
    border-radius: 50px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    margin-bottom: 10px;
}
.chat-back-btn {
    display: block;
    background: none;
    border: none;
    color: #999;
    font-size: 12px;
    cursor: pointer;
    margin: 8px auto 0;
    text-decoration: underline;
}

/* --- Main Chat Area (Step 3) --- */
#chat-main { display: flex; flex-direction: column; flex: 1; overflow: hidden; min-height: 0; }

/* --- Messages --- */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px 12px 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    scroll-behavior: smooth;
}
.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-thumb { background: #e0d0b0; border-radius: 4px; }

/* Welcome block */
.chat-welcome { padding: 8px 4px 4px; }
#chat-welcome-text { font-size: 13px; color: #444; margin: 0 0 4px; }

/* Messages */
.chat-message {
    max-width: 82%;
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.45;
    word-break: break-word;
    animation: msgIn 0.18s ease;
}
@keyframes msgIn { from { opacity:0; transform:translateY(6px); } to { opacity:1; transform:translateY(0); } }
.chat-message.agent { background: #f0ebe0; color: #333; align-self: flex-start; border-bottom-left-radius: 4px; }
.chat-message.customer { background: linear-gradient(135deg, #C9A961, #D4AF37); color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }
.chat-message.system { background: #f7f7f7; color: #888; font-size: 11px; align-self: center; padding: 4px 10px; border-radius: 50px; }
.chat-message .msg-time { font-size: 10px; opacity: 0.65; display: block; margin-top: 3px; text-align: right; }

/* Quick actions */
.chat-quick-actions { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 0; }
.chat-quick-actions button {
    background: #fff;
    border: 1.5px solid #D4AF37;
    color: #7a6030;
    border-radius: 50px;
    padding: 5px 12px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
.chat-quick-actions button:hover, .chat-quick-actions button:active { background: #D4AF37; color: #fff; }

/* Action buttons (Yes/No login) */
.chat-action-btn {
    background: #f0ebe0;
    border: 1.5px solid #D4AF37;
    color: #7a6030;
    border-radius: 50px;
    padding: 4px 12px;
    font-size: 12px;
    cursor: pointer;
    margin: 3px 3px 0 0;
    transition: all 0.15s;
}
.chat-action-btn:hover { background: #D4AF37; color: #fff; }

/* Login issue inline form */
.chat-login-issue {
    background: #fdf9f0;
    border: 1px solid #e8dcc8;
    border-radius: 10px;
    padding: 12px;
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.chat-login-issue h4 { font-size: 13px; font-weight: 700; color: #1a1a2e; margin: 0; }
.chat-login-issue input, .chat-login-issue textarea {
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 7px 10px;
    font-size: 12px;
    width: 100%;
    box-sizing: border-box;
    font-family: inherit;
}
.chat-login-issue textarea { height: 60px; resize: none; }
.chat-login-issue button {
    background: linear-gradient(135deg, #C9A961, #D4AF37);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

/* Order picker */
.chat-order-picker { display: flex; flex-direction: column; gap: 6px; }
.order-item {
    background: #f8f5f0;
    border: 1px solid #e8dcc8;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.15s;
}
.order-item:hover { background: #f0e8d0; }

/* Typing indicator */
.chat-typing {
    font-size: 11px;
    color: #999;
    padding: 4px 12px;
    font-style: italic;
}

/* --- Input Area --- */
.chat-input-wrapper {
    padding: 8px 10px 10px;
    background: #fafafa;
    border-top: 1px solid #eee;
    flex-shrink: 0;
}
.chat-pin-panel {
    background: #f8f5f0;
    border: 1px solid #e8dcc8;
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 8px;
}
.chat-pin-panel p { font-size: 12px; color: #666; margin: 0 0 8px; }
.chat-pin-panel input {
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 7px 10px;
    font-size: 14px;
    letter-spacing: 4px;
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 6px;
}
.chat-pin-panel button {
    background: linear-gradient(135deg, #C9A961, #D4AF37);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 7px 14px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}
#chat-pin-status { font-size: 11px; margin-top: 4px; }

.chat-input-row {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #fff;
    border: 1.5px solid #e0d0b0;
    border-radius: 50px;
    padding: 4px 4px 4px 12px;
}
.chat-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 13px;
    background: transparent;
    color: #333;
    font-family: inherit;
    padding: 4px 0;
}
.chat-send-btn {
    background: linear-gradient(135deg, #C9A961, #D4AF37);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 34px; height: 34px;
    font-size: 14px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    transition: transform 0.15s;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
.chat-send-btn:hover { transform: scale(1.08); }
.chat-pin-btn {
    background: none;
    border: 1px solid #D4AF37;
    color: #C9A961;
    border-radius: 50px;
    padding: 4px 10px;
    font-size: 10px;
    font-weight: 700;
    cursor: pointer;
    flex-shrink: 0;
}

/* Rating */
#chat-rating { padding: 12px; text-align: center; }
#chat-rating p { font-size: 13px; color: #444; margin: 0 0 8px; }
.rating-stars span { font-size: 22px; color: #ddd; cursor: pointer; transition: color 0.1s; }
.rating-stars span:hover, .rating-stars span.active { color: #D4AF37; }
#rating-feedback {
    width: 100%; border: 1px solid #ddd; border-radius: 8px;
    padding: 8px; font-size: 12px; margin: 8px 0; resize: none;
    height: 50px; box-sizing: border-box; font-family: inherit;
}
#rating-submit {
    background: linear-gradient(135deg, #C9A961, #D4AF37);
    color: #fff; border: none; border-radius: 50px;
    padding: 8px 20px; font-size: 13px; font-weight: 600; cursor: pointer;
}

/* Queue */
.chat-queue { padding: 8px 12px; font-size: 12px; color: #888; text-align: center; }

/* System messages */
.chat-system-msg {
    background: #f0f0f0;
    color: #888;
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 50px;
    align-self: center;
    text-align: center;
}
.chat-login-inline {
    background: none; border: none;
    color: #C9A961; text-decoration: underline;
    cursor: pointer; font-size: inherit; padding: 0;
}

/* =====================================================
   MOBILE — Compact & Sleek
   ===================================================== */
@media (max-width: 768px) {

    #modernoa-chat-widget {
        bottom: 16px;
        right: 12px;
    }

    .chat-widget-btn {
        padding: 11px 16px;
        font-size: 13px;
    }
    .chat-widget-btn .chat-text { display: none; }

    .chat-window {
        position: fixed !important;
        bottom: 70px !important;
        right: 10px !important;
        left: auto !important;
        width: 300px !important;
        max-width: calc(100vw - 20px) !important;
        max-height: 55vh !important;
        border-radius: 16px !important;
        box-shadow: 0 8px 32px rgba(0,0,0,0.22) !important;
    }

    .chat-header { padding: 10px 12px !important; }
    .chat-header h3 { font-size: 13px !important; }
    .chat-header p { font-size: 11px !important; }

    .chat-messages {
        max-height: calc(55vh - 160px);
        padding: 8px !important;
    }

    .chat-message { font-size: 12px !important; padding: 7px 10px !important; }
    .chat-message-time { font-size: 10px !important; }

    .chat-input-area { padding: 8px !important; }
    .chat-input-area input { font-size: 12px !important; padding: 8px !important; }
    .chat-send-btn { padding: 8px 12px !important; font-size: 13px !important; }

    .chat-type-options { flex-direction: column; gap: 6px; }
    .chat-type-btn { padding: 10px 12px; flex-direction: row; gap: 10px; text-align: left; cursor: pointer; -webkit-tap-highlight-color: rgba(0,0,0,0.1); touch-action: manipulation; position: relative; z-index: 10; }
    .chat-type-icon { font-size: 18px; }
    .chat-type-label { font-size: 12px; }
    .chat-type-desc { font-size: 10px; }
    .chat-type-chooser { position: relative; z-index: 10; }

    .chat-quick-actions { flex-wrap: wrap; gap: 4px; }
    .chat-quick-actions button { font-size: 10px; padding: 4px 8px; }

    /* No message animation on mobile */
    .chat-message { animation: none; }
}

@media (max-width: 400px) {
    .chat-window {
        bottom: 66px !important;
        right: 8px !important;
        left: auto !important;
        width: 280px !important;
        max-height: 52vh !important;
    }
}
