/* ============================================================
   CURVY STYLE ADVISOR - FRONTEND CSS
   Design moderno, elegante e feminino
============================================================ */

:root {
    --csa-primary: #e91e63;
    --csa-primary-dark: #c2185b;
    --csa-secondary: #9c27b0;
    --csa-secondary-dark: #7b1fa2;
    --csa-accent: #ff4081;
    --csa-gold: #ffd700;
    --csa-dark: #1a1a2e;
    --csa-light: #fef5f8;
    --csa-text: #2c2c2c;
    --csa-border: #f3e5f5;
    --csa-shadow: 0 8px 32px rgba(233, 30, 99, 0.12);
    --csa-shadow-lg: 0 20px 60px rgba(156, 39, 176, 0.2);
}

/* ============================================================
   WIDGET FLUTUANTE
============================================================ */

.csa-widget {
    position: fixed;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.csa-position-bottom-right {
    bottom: 20px;
    right: 20px;
}

.csa-position-bottom-left {
    bottom: 20px;
    left: 20px;
}

/* Botão Flutuante */
.csa-trigger {
    position: relative;
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--csa-primary) 0%, var(--csa-secondary) 100%);
    border-radius: 50%;
    box-shadow: var(--csa-shadow-lg);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: csaFloat 3s ease-in-out infinite;
}

.csa-trigger:hover {
    transform: scale(1.1);
    box-shadow: 0 24px 80px rgba(233, 30, 99, 0.4);
}

.csa-trigger-icon {
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
}

.csa-trigger-pulse {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 50%;
    background: var(--csa-primary);
    animation: csaPulse 2s infinite;
    pointer-events: none;
}

.csa-trigger-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--csa-gold);
    color: var(--csa-dark);
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.4);
    white-space: nowrap;
}

.csa-trigger-badge-dot {
    width: 6px;
    height: 6px;
    background: var(--csa-primary);
    border-radius: 50%;
    animation: csaPulseDot 1.5s infinite;
}

/* Janela do Chat */
.csa-window {
    position: fixed;
    bottom: 100px;
    width: 420px;
    max-width: calc(100vw - 40px);
    height: 640px;
    max-height: calc(100vh - 140px);
    background: white;
    border-radius: 20px;
    box-shadow: var(--csa-shadow-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: csaSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.csa-position-bottom-right .csa-window {
    right: 20px;
}

.csa-position-bottom-left .csa-window {
    left: 20px;
}

/* Header */
.csa-header {
    background: linear-gradient(135deg, var(--csa-primary) 0%, var(--csa-secondary) 100%);
    color: white;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 4px 12px rgba(156, 39, 176, 0.15);
}

.csa-header-avatar {
    position: relative;
    flex-shrink: 0;
}

.csa-header-status {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    background: var(--csa-gold);
    border: 2px solid white;
    border-radius: 50%;
    animation: csaPulseDot 2s infinite;
}

.csa-header-info {
    flex: 1;
    min-width: 0;
}

.csa-header-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 2px;
}

.csa-header-subtitle {
    font-size: 13px;
    opacity: 0.95;
}

.csa-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.csa-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

/* Social Proof */
.csa-social-proof {
    background: #fef3c7;
    color: #92400e;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    animation: csaSlideDown 0.5s ease-out;
}

.csa-social-proof-icon {
    font-size: 16px;
}

.csa-social-proof-text {
    flex: 1;
}

/* Tabs */
.csa-tabs {
    display: flex;
    background: #fef5f8;
    border-bottom: 1px solid var(--csa-border);
}

.csa-tab {
    flex: 1;
    padding: 14px;
    border: none;
    background: transparent;
    color: #9ca3af;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
    position: relative;
}

.csa-tab:hover {
    background: white;
    color: var(--csa-primary);
}

.csa-tab.active {
    background: white;
    color: var(--csa-primary);
}

.csa-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--csa-primary), var(--csa-secondary));
}

/* Messages */
.csa-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #fef5f8;
    scroll-behavior: smooth;
}

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

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

.csa-messages::-webkit-scrollbar-thumb {
    background: var(--csa-primary);
    border-radius: 3px;
}

.csa-message {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    animation: csaMessageIn 0.3s ease-out;
}

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

.csa-message-avatar {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
}

.csa-message-content {
    flex: 1;
    max-width: 75%;
}

.csa-message-text {
    background: white;
    padding: 14px 16px;
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(233, 30, 99, 0.08);
    color: var(--csa-text);
    line-height: 1.6;
}

.csa-message-user .csa-message-text {
    background: linear-gradient(135deg, var(--csa-primary) 0%, var(--csa-accent) 100%);
    color: white;
    margin-left: auto;
}

.csa-message-text p {
    margin: 0 0 12px 0;
}

.csa-message-text p:last-child {
    margin-bottom: 0;
}

.csa-message-text strong {
    font-weight: 700;
    color: var(--csa-primary);
}

.csa-message-user .csa-message-text strong {
    color: white;
}

.csa-message-text ul,
.csa-message-text ol {
    margin: 12px 0;
    padding-left: 20px;
}

.csa-message-text li {
    margin-bottom: 6px;
}

/* Products */
.csa-products {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 16px;
}

.csa-product {
    background: white;
    border: 2px solid var(--csa-border);
    border-radius: 12px;
    padding: 14px;
    transition: all 0.3s;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
}

.csa-product:hover {
    border-color: var(--csa-primary);
    box-shadow: 0 8px 24px rgba(233, 30, 99, 0.2);
    transform: translateY(-2px);
}

.csa-product-name {
    font-weight: 700;
    font-size: 14px;
    color: var(--csa-dark);
    line-height: 1.4;
    margin-bottom: 12px;
}

.csa-product-description {
    font-size: 12px;
    color: #4b5563;
    line-height: 1.6;
    margin-bottom: 12px;
    flex: 1;
}

.csa-product-cta {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    background: linear-gradient(135deg, var(--csa-primary) 0%, var(--csa-secondary) 100%);
    border-radius: 8px;
    color: white;
    font-size: 13px;
    font-weight: 700;
    gap: 6px;
}

.csa-product:hover .csa-product-cta {
    background: linear-gradient(135deg, var(--csa-primary-dark) 0%, var(--csa-secondary-dark) 100%);
}

/* Suggestions */
.csa-suggestions {
    padding: 12px 20px;
    background: white;
    border-top: 1px solid var(--csa-border);
}

.csa-suggestions-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--csa-primary);
    margin-bottom: 8px;
}

.csa-suggestions-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.csa-suggestion-btn {
    background: #fef5f8;
    border: 1px solid var(--csa-border);
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 13px;
    color: var(--csa-text);
    cursor: pointer;
    transition: all 0.2s;
}

.csa-suggestion-btn:hover {
    background: var(--csa-primary);
    border-color: var(--csa-primary);
    color: white;
    transform: translateY(-1px);
}

/* Input */
.csa-input-wrapper {
    padding: 16px 20px;
    background: white;
    border-top: 1px solid var(--csa-border);
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.csa-input {
    flex: 1;
    border: 2px solid var(--csa-border);
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 15px;
    font-family: inherit;
    resize: none;
    max-height: 120px;
    transition: all 0.2s;
}

.csa-input:focus {
    outline: none;
    border-color: var(--csa-primary);
    box-shadow: 0 0 0 3px rgba(233, 30, 99, 0.1);
}

.csa-send {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--csa-primary) 0%, var(--csa-secondary) 100%);
    border: none;
    border-radius: 12px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    flex-shrink: 0;
}

.csa-send:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(233, 30, 99, 0.4);
}

.csa-send:active {
    transform: translateY(0);
}

.csa-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Rating */
.csa-rating {
    padding: 16px 20px;
    background: #fef5f8;
    border-top: 1px solid var(--csa-border);
    text-align: center;
}

.csa-rating-text {
    font-size: 14px;
    color: var(--csa-text);
    margin-bottom: 10px;
    font-weight: 600;
}

.csa-rating-stars {
    display: flex;
    justify-content: center;
    gap: 8px;
}

.csa-rating-star {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    transition: all 0.2s;
    filter: grayscale(100%);
    opacity: 0.4;
}

.csa-rating-star:hover,
.csa-rating-star.active {
    filter: grayscale(0%);
    opacity: 1;
    transform: scale(1.2);
}

/* Footer */
.csa-footer {
    padding: 10px 20px;
    background: #fef5f8;
    border-top: 1px solid var(--csa-border);
    text-align: center;
    color: #9ca3af;
    font-size: 11px;
}

/* Loading */
.csa-loading {
    display: flex;
    gap: 6px;
    justify-content: center;
    padding: 20px;
}

.csa-loading-dot {
    width: 8px;
    height: 8px;
    background: var(--csa-primary);
    border-radius: 50%;
    animation: csaBounce 1.4s infinite ease-in-out both;
}

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

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

/* ============================================================
   ANIMATIONS
============================================================ */

@keyframes csaFloat {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

@keyframes csaPulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

@keyframes csaPulseDot {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.3;
    }
}

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

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

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

@keyframes csaBounce {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

/* ============================================================
   MOBILE RESPONSIVE
============================================================ */

@media (max-width: 768px) {
    .csa-window {
        bottom: 0;
        left: 0 !important;
        right: 0 !important;
        width: 100%;
        max-width: 100%;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }
    
    .csa-trigger {
        width: 56px;
        height: 56px;
    }
    
    .csa-trigger-badge {
        top: -6px;
        right: -6px;
        padding: 4px 10px;
        font-size: 10px;
    }
    
    .csa-input {
        font-size: 16px; /* Previne zoom no iOS */
    }
    
    .csa-message-content {
        max-width: 85%;
    }
    
    .csa-header {
        padding: 16px;
    }
    
    .csa-header-title {
        font-size: 16px;
    }
    
    .csa-header-subtitle {
        font-size: 12px;
    }
}

/* Landscape mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .csa-window {
        height: 100vh;
    }
}

/* Touch improvements */
@media (hover: none) and (pointer: coarse) {
    .csa-trigger {
        -webkit-tap-highlight-color: transparent;
    }
    
    .csa-send,
    .csa-close,
    .csa-tab,
    .csa-product,
    .csa-suggestion-btn {
        -webkit-tap-highlight-color: transparent;
        min-height: 44px; /* iOS recommended touch target */
    }
}
