/* =====================================================
   CHAT DE ATENDIMENTO - Mobile First
   ===================================================== */

/* Força tema claro */
.chat-page,
.chat-container,
.chat-messages,
.chat-input-area {
    color-scheme: light;
}

.chat-page {
    min-height: calc(100vh - 72px);
    min-height: calc(100vh - var(--header-height, 72px));
    background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 50%, #d1fae5 100%);
    background-color: #ecfdf5;
    padding: 0;
    display: flex;
    align-items: stretch;
    justify-content: center;
}

.chat-container {
    width: 100%;
    max-width: 100%;
    min-height: calc(100vh - 72px);
    min-height: calc(100vh - var(--header-height, 72px));
    background: #ffffff;
    background-color: #ffffff;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

@media (min-width: 576px) {
    .chat-page {
        padding: 20px;
        align-items: center;
    }
    
    .chat-container {
        max-width: 480px;
        min-height: auto;
        height: 75vh;
        max-height: 650px;
        border-radius: 20px;
        box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
    }
}

@media (min-width: 768px) {
    .chat-container {
        max-width: 500px;
        height: 80vh;
        max-height: 700px;
        border-radius: 24px;
    }
}

/* Header do Chat */
.chat-header {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.chat-avatar {
    position: relative;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

.avatar-icon {
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.status-online {
    position: absolute;
    bottom: 1px;
    right: 1px;
    width: 10px;
    height: 10px;
    background: #22c55e;
    border: 2px solid white;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

.chat-info {
    flex: 1;
    min-width: 0;
}

.chat-info h1 {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0 0 1px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-info p {
    font-size: 0.75rem;
    margin: 0;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 4px;
}

.btn-form-link {
    width: 36px;
    height: 36px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    text-decoration: none;
    transition: background 0.2s;
    flex-shrink: 0;
}

.btn-form-link:hover {
    background: rgba(255,255,255,0.3);
}

@media (min-width: 576px) {
    .chat-header {
        padding: 14px 18px;
        gap: 12px;
    }
    
    .chat-avatar,
    .avatar-icon {
        width: 44px;
        height: 44px;
    }
    
    .avatar-icon {
        font-size: 22px;
    }
    
    .status-online {
        width: 12px;
        height: 12px;
    }
    
    .chat-info h1 {
        font-size: 1.05rem;
    }
    
    .chat-info p {
        font-size: 0.8rem;
    }
    
    .btn-form-link {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }
}

@media (min-width: 768px) {
    .chat-header {
        padding: 16px 20px;
    }
    
    .chat-avatar,
    .avatar-icon {
        width: 48px;
        height: 48px;
    }
    
    .avatar-icon {
        font-size: 24px;
    }
    
    .chat-info h1 {
        font-size: 1.1rem;
        margin-bottom: 2px;
    }
    
    .chat-info p {
        font-size: 0.85rem;
        gap: 6px;
    }
}

/* Área de Mensagens */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #f9fafb;
    background-color: #f9fafb;
    -webkit-overflow-scrolling: touch;
}

@media (min-width: 576px) {
    .chat-messages {
        padding: 18px;
        gap: 12px;
    }
}

@media (min-width: 768px) {
    .chat-messages {
        padding: 20px;
    }
}

/* Mensagens */
.message {
    display: flex;
    gap: 8px;
    max-width: 88%;
    animation: messageIn 0.3s ease-out;
}

@keyframes messageIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.bot {
    align-self: flex-start;
}

.message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.message.bot .message-avatar {
    background: linear-gradient(135deg, #10b981, #059669);
}

.message.user .message-avatar {
    background: #e5e7eb;
}

.message-content {
    padding: 10px 14px;
    border-radius: 16px;
    line-height: 1.5;
    font-size: 0.875rem;
    word-wrap: break-word;
}

.message.bot .message-content {
    background: white;
    color: #1f2937;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.message.user .message-content {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    border-bottom-right-radius: 4px;
}

@media (min-width: 576px) {
    .message {
        max-width: 85%;
    }
    
    .message-avatar {
        width: 30px;
        height: 30px;
        font-size: 15px;
    }
    
    .message-content {
        padding: 11px 15px;
        font-size: 0.9rem;
    }
}

@media (min-width: 768px) {
    .message-avatar {
        width: 32px;
        height: 32px;
        font-size: 16px;
    }
    
    .message-content {
        padding: 12px 16px;
        border-radius: 18px;
        font-size: 0.95rem;
    }
}

/* Typing indicator */
.typing-dots {
    display: flex;
    gap: 4px;
    padding: 10px 14px;
    background: white;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
}

.typing-dots span {
    width: 7px;
    height: 7px;
    background: #9ca3af;
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out;
}

.typing-dots span:nth-child(1) { animation-delay: 0s; }
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-8px); }
}

@media (min-width: 576px) {
    .typing-dots {
        padding: 12px 16px;
        border-radius: 18px;
    }
    
    .typing-dots span {
        width: 8px;
        height: 8px;
    }
}

/* Área de Input */
.chat-input-area {
    padding: 12px;
    background: white;
    border-top: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.chat-options {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
}

.chat-option {
    padding: 8px 14px;
    background: #f3f4f6;
    border: 2px solid #e5e7eb;
    border-radius: 18px;
    font-size: 0.8125rem;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.chat-option:hover {
    background: #ecfdf5;
    border-color: #10b981;
    color: #059669;
}

.chat-option.selected {
    background: #10b981;
    border-color: #10b981;
    color: white;
}

.chat-option.price-option {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 70px;
}

.chat-option.price-option .days {
    font-weight: 600;
}

.chat-option.price-option .price {
    font-size: 0.7rem;
    opacity: 0.8;
}

@media (min-width: 576px) {
    .chat-input-area {
        padding: 14px;
    }
    
    .chat-options {
        gap: 8px;
    }
    
    .chat-option {
        padding: 9px 16px;
        font-size: 0.875rem;
        border-radius: 20px;
    }
    
    .chat-option.price-option {
        min-width: 75px;
    }
    
    .chat-option.price-option .price {
        font-size: 0.75rem;
    }
}

@media (min-width: 768px) {
    .chat-input-area {
        padding: 16px;
    }
    
    .chat-option {
        padding: 10px 18px;
        font-size: 0.9rem;
    }
    
    .chat-option.price-option {
        min-width: 80px;
    }
    
    .chat-option.price-option .price {
        font-size: 0.8rem;
    }
}

/* Input de texto */
.chat-input-wrapper {
    display: flex;
    gap: 8px;
    align-items: center;
}

#chatInput {
    flex: 1;
    padding: 10px 14px;
    border: 2px solid #e5e7eb;
    border-radius: 20px;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
    min-width: 0;
}

#chatInput:focus {
    border-color: #10b981;
}

.btn-send {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #10b981, #059669);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
    flex-shrink: 0;
}

.btn-send:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

@media (min-width: 576px) {
    #chatInput {
        padding: 11px 15px;
        font-size: 0.925rem;
        border-radius: 22px;
    }
    
    .btn-send {
        width: 42px;
        height: 42px;
    }
}

@media (min-width: 768px) {
    #chatInput {
        padding: 12px 16px;
        font-size: 0.95rem;
        border-radius: 24px;
    }
    
    .btn-send {
        width: 44px;
        height: 44px;
    }
}

/* Resumo do pedido no chat */
.order-summary {
    background: #f0fdf4;
    border: 1px solid #10b981;
    border-radius: 10px;
    padding: 12px;
    margin-top: 8px;
}

.order-summary h4 {
    margin: 0 0 10px 0;
    color: #059669;
    font-size: 0.875rem;
}

.order-summary-item {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    font-size: 0.8125rem;
    border-bottom: 1px solid #d1fae5;
    gap: 8px;
}

.order-summary-item:last-child {
    border-bottom: none;
}

.order-summary-item .label {
    color: #6b7280;
}

.order-summary-item .value {
    font-weight: 600;
    color: #1f2937;
    text-align: right;
}

.order-summary-total {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 2px solid #10b981;
    display: flex;
    justify-content: space-between;
    font-size: 1rem;
    font-weight: 700;
    color: #059669;
}

@media (min-width: 576px) {
    .order-summary {
        padding: 14px;
        border-radius: 12px;
    }
    
    .order-summary h4 {
        margin-bottom: 12px;
        font-size: 0.925rem;
    }
    
    .order-summary-item {
        padding: 6px 0;
        font-size: 0.875rem;
    }
    
    .order-summary-total {
        margin-top: 12px;
        padding-top: 12px;
        font-size: 1.05rem;
    }
}

@media (min-width: 768px) {
    .order-summary {
        padding: 16px;
    }
    
    .order-summary h4 {
        font-size: 0.95rem;
    }
    
    .order-summary-item {
        font-size: 0.9rem;
    }
    
    .order-summary-total {
        font-size: 1.1rem;
    }
}

/* Botão de ação no chat */
.chat-action-btn {
    display: block;
    width: 100%;
    padding: 12px 20px;
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    margin-top: 10px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.chat-action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.4);
    color: white;
}

.chat-action-btn.secondary {
    background: #f3f4f6;
    color: #374151;
}

.chat-action-btn.secondary:hover {
    background: #e5e7eb;
    box-shadow: none;
}

@media (min-width: 576px) {
    .chat-action-btn {
        padding: 13px 22px;
        font-size: 0.975rem;
        border-radius: 11px;
        margin-top: 11px;
    }
}

@media (min-width: 768px) {
    .chat-action-btn {
        padding: 14px 24px;
        font-size: 1rem;
        border-radius: 12px;
        margin-top: 12px;
    }
}

/* Indicador de etapa */
.step-indicator {
    display: flex;
    justify-content: center;
    gap: 6px;
    padding: 10px;
    background: white;
}

.step-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #e5e7eb;
    transition: all 0.3s;
}

.step-dot.active {
    background: #10b981;
    width: 20px;
    border-radius: 4px;
}

.step-dot.completed {
    background: #10b981;
}

@media (min-width: 576px) {
    .step-indicator {
        gap: 8px;
        padding: 12px;
    }
    
    .step-dot {
        width: 8px;
        height: 8px;
    }
    
    .step-dot.active {
        width: 24px;
    }
}

/* Mensagem com emoji grande */
.message-emoji {
    font-size: 36px;
    text-align: center;
    padding: 16px;
}

@media (min-width: 576px) {
    .message-emoji {
        font-size: 44px;
        padding: 18px;
    }
}

@media (min-width: 768px) {
    .message-emoji {
        font-size: 48px;
        padding: 20px;
    }
}

/* Validação inline */
.validation-error {
    color: #ef4444;
    font-size: 0.8rem;
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 4px;
}

@media (min-width: 576px) {
    .validation-error {
        font-size: 0.85rem;
        margin-top: 8px;
    }
}

/* Loading state */
.chat-loading {
    text-align: center;
    padding: 32px;
    color: #6b7280;
    font-size: 0.9rem;
}

@media (min-width: 576px) {
    .chat-loading {
        padding: 40px;
    }
}

/* Animação de shake para erro */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.shake {
    animation: shake 0.3s ease-in-out;
}

/* Estilo para links no chat */
.message-content a {
    color: inherit;
    text-decoration: underline;
}

.message.bot .message-content a {
    color: #059669;
}

/* =====================================================
   NOTEBOOKS PEQUENOS (1024px - 1366px)
   ===================================================== */
@media (min-width: 992px) and (max-width: 1366px) {
    .chat-page {
        padding: 16px;
    }
    
    .chat-container {
        max-width: 440px;
        height: 72vh;
        max-height: 580px;
    }
    
    .chat-header {
        padding: 10px 14px;
    }
    
    .chat-avatar,
    .avatar-icon {
        width: 36px;
        height: 36px;
    }
    
    .avatar-icon svg {
        width: 20px;
        height: 20px;
    }
    
    .chat-info h1 {
        font-size: 1rem;
    }
    
    .chat-info p {
        font-size: 0.75rem;
    }
    
    .chat-messages {
        padding: 12px;
    }
    
    .message-content {
        padding: 10px 12px;
        font-size: 0.85rem;
    }
    
    .message-time {
        font-size: 0.65rem;
    }
    
    .chat-input-area {
        padding: 10px;
    }
    
    .chat-input {
        padding: 10px 14px;
        font-size: 0.9rem;
    }
    
    .send-btn {
        padding: 10px 14px;
    }
    
    .chat-option {
        padding: 8px 14px;
        font-size: 0.8rem;
    }
}
