/**
 * Click to Talk - Public Styles
 * The frontend magic that makes conversations happen!
 *
 * @package ClickToTalk
 */

/* ==========================================================================
   CSS Variables
   ========================================================================== */

#ctt-widget-wrapper {
    --ctt-primary: #25D366;
    --ctt-secondary: #FFFFFF;
    --ctt-text: #FFFFFF;
    --ctt-icon: #FFFFFF;
    --ctt-offset-x: 20px;
    --ctt-offset-y: 20px;
    --ctt-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    --ctt-shadow-hover: 0 6px 30px rgba(0, 0, 0, 0.2);
    --ctt-radius: 50px;
    --ctt-transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    /* Size variants */
    --ctt-size-small: 48px;
    --ctt-size-medium: 60px;
    --ctt-size-large: 72px;
}

/* ==========================================================================
   Widget Wrapper
   ========================================================================== */

#ctt-widget-wrapper {
    position: fixed;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

/* Position Classes */
.ctt-position-bottom-right {
    bottom: var(--ctt-offset-y);
    right: var(--ctt-offset-x);
}

.ctt-position-bottom-left {
    bottom: var(--ctt-offset-y);
    left: var(--ctt-offset-x);
}

.ctt-position-top-right {
    top: var(--ctt-offset-y);
    right: var(--ctt-offset-x);
}

.ctt-position-top-left {
    top: var(--ctt-offset-y);
    left: var(--ctt-offset-x);
}

/* ==========================================================================
   Main Button
   ========================================================================== */

.ctt-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: var(--ctt-primary);
    color: var(--ctt-text);
    border: none;
    border-radius: var(--ctt-radius);
    cursor: pointer;
    box-shadow: var(--ctt-shadow);
    transition: all var(--ctt-transition);
    position: relative;
    outline: none;
    padding: 0;
}

/* Size Variants */
.ctt-size-small .ctt-button {
    min-width: var(--ctt-size-small);
    min-height: var(--ctt-size-small);
    padding: 12px;
}

.ctt-size-medium .ctt-button {
    min-width: var(--ctt-size-medium);
    min-height: var(--ctt-size-medium);
    padding: 16px;
}

.ctt-size-large .ctt-button {
    min-width: var(--ctt-size-large);
    min-height: var(--ctt-size-large);
    padding: 20px;
}

/* With Label */
.ctt-button:has(.ctt-button-label) {
    padding: 12px 24px;
    border-radius: 50px;
}

.ctt-size-small .ctt-button:has(.ctt-button-label) {
    padding: 10px 18px;
}

.ctt-size-large .ctt-button:has(.ctt-button-label) {
    padding: 16px 28px;
}

/* Button Icon */
.ctt-button-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.ctt-button-icon svg,
.ctt-button-icon img {
    width: 28px;
    height: 28px;
}

.ctt-size-small .ctt-button-icon svg,
.ctt-size-small .ctt-button-icon img {
    width: 22px;
    height: 22px;
}

.ctt-size-large .ctt-button-icon svg,
.ctt-size-large .ctt-button-icon img {
    width: 34px;
    height: 34px;
}

.ctt-whatsapp-icon {
    fill: currentColor;
}

/* Button Label */
.ctt-button-label {
    font-weight: 600;
    white-space: nowrap;
    font-size: 15px;
}

.ctt-size-small .ctt-button-label {
    font-size: 13px;
}

.ctt-size-large .ctt-button-label {
    font-size: 17px;
}

/* ==========================================================================
   Hover Effects
   ========================================================================== */

.ctt-button:hover {
    box-shadow: var(--ctt-shadow-hover);
}

.ctt-hover-grow .ctt-button:hover {
    transform: scale(1.1);
}

.ctt-hover-glow .ctt-button:hover {
    box-shadow: 0 0 30px var(--ctt-primary);
}

.ctt-hover-lift .ctt-button:hover {
    transform: translateY(-5px);
}

/* ==========================================================================
   Animations
   ========================================================================== */

.ctt-animate-pulse .ctt-button {
    animation: ctt-pulse 2s ease-in-out infinite;
}

.ctt-animate-bounce .ctt-button {
    animation: ctt-bounce 2s ease-in-out infinite;
}

.ctt-animate-shake .ctt-button {
    animation: ctt-shake 3s ease-in-out infinite;
}

.ctt-animate-wobble .ctt-button {
    animation: ctt-wobble 2s ease-in-out infinite;
}

.ctt-animate-tada .ctt-button {
    animation: ctt-tada 1.5s ease-in-out infinite;
}

.ctt-animate-ring .ctt-button {
    animation: ctt-ring 2s ease-in-out infinite;
}

@keyframes ctt-pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: var(--ctt-shadow);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 6px 25px rgba(37, 211, 102, 0.4);
    }
}

@keyframes ctt-bounce {
    0%, 100% {
        transform: translateY(0);
    }
    25% {
        transform: translateY(-8px);
    }
    50% {
        transform: translateY(0);
    }
    75% {
        transform: translateY(-4px);
    }
}

@keyframes ctt-shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-3px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(3px);
    }
}

@keyframes ctt-wobble {
    0%, 100% {
        transform: rotate(0deg);
    }
    25% {
        transform: rotate(-5deg);
    }
    75% {
        transform: rotate(5deg);
    }
}

@keyframes ctt-tada {
    0%, 100% {
        transform: scale(1) rotate(0deg);
    }
    10%, 20% {
        transform: scale(0.95) rotate(-3deg);
    }
    30%, 50%, 70%, 90% {
        transform: scale(1.05) rotate(3deg);
    }
    40%, 60%, 80% {
        transform: scale(1.05) rotate(-3deg);
    }
}

@keyframes ctt-ring {
    0%, 100% {
        transform: rotate(0deg);
    }
    5%, 15% {
        transform: rotate(15deg);
    }
    10%, 20% {
        transform: rotate(-15deg);
    }
    25% {
        transform: rotate(0deg);
    }
}

/* ==========================================================================
   Notification Badge
   ========================================================================== */

.ctt-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 22px;
    height: 22px;
    background: #FF0000;
    color: #FFFFFF;
    font-size: 12px;
    font-weight: 700;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    border: 2px solid #FFFFFF;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    animation: ctt-badge-pulse 2s ease-in-out infinite;
}

@keyframes ctt-badge-pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

/* ==========================================================================
   Greeting Popup
   ========================================================================== */

.ctt-greeting {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 320px;
    background: #FFFFFF;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    animation: ctt-greeting-slide 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.ctt-position-bottom-left .ctt-greeting,
.ctt-position-top-left .ctt-greeting {
    right: auto;
    left: 0;
}

.ctt-position-top-right .ctt-greeting,
.ctt-position-top-left .ctt-greeting {
    bottom: auto;
    top: 80px;
}

@keyframes ctt-greeting-slide {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Close Button */
.ctt-greeting-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 28px;
    height: 28px;
    background: rgba(0, 0, 0, 0.05);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    transition: 0.2s;
    padding: 0;
}

.ctt-greeting-close:hover {
    background: rgba(0, 0, 0, 0.1);
    color: #333;
}

.ctt-greeting-close .material-symbols-outlined {
    font-size: 18px;
}

/* Greeting Header */
.ctt-greeting-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 16px 0;
}

.ctt-agent-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--ctt-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    flex-shrink: 0;
    overflow: hidden;
}

.ctt-agent-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ctt-agent-avatar .material-symbols-outlined {
    font-size: 28px;
    color: #FFFFFF;
}

.ctt-status {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid #FFFFFF;
}

.ctt-status-online {
    background: #10B981;
}

.ctt-status-away {
    background: #F59E0B;
}

.ctt-status-offline {
    background: #EF4444;
}

.ctt-agent-info {
    flex: 1;
    min-width: 0;
}

.ctt-agent-name {
    display: block;
    font-weight: 600;
    color: #1F2937;
    font-size: 15px;
}

.ctt-agent-status-text {
    display: block;
    font-size: 13px;
    color: #6B7280;
}

/* Greeting Body */
.ctt-greeting-body {
    padding: 16px;
}

.ctt-greeting-body p {
    margin: 0;
    color: #374151;
    font-size: 14px;
    line-height: 1.6;
    background: #F3F4F6;
    padding: 12px 16px;
    border-radius: 0 16px 16px 16px;
}

/* Greeting CTA */
.ctt-greeting-cta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--ctt-primary);
    color: #FFFFFF;
    text-decoration: none;
    padding: 14px 20px;
    font-weight: 600;
    font-size: 15px;
    transition: 0.2s;
    margin: 0 16px 16px;
    border-radius: 12px;
}

.ctt-greeting-cta:hover {
    background: #128C7E;
    color: #FFFFFF;
}

.ctt-greeting-cta .material-symbols-outlined {
    font-size: 20px;
}

/* Greeting Styles */
.ctt-greeting-bubble {
    border-radius: 20px;
}

.ctt-greeting-card {
    border-radius: 12px;
}

.ctt-greeting-minimal {
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.ctt-greeting-minimal .ctt-greeting-header {
    display: none;
}

.ctt-greeting-minimal .ctt-greeting-body p {
    background: transparent;
    padding: 0;
    border-radius: 0;
}

/* ==========================================================================
   Button Styles
   ========================================================================== */

/* Style 1: Classic Circle */
.ctt-style-1 .ctt-button {
    border-radius: 50%;
}

.ctt-style-1 .ctt-button:has(.ctt-button-label) {
    border-radius: 50px;
}

/* Style 2: Rounded Pill */
.ctt-style-2 .ctt-button {
    border-radius: 50px;
    padding-left: 20px;
    padding-right: 20px;
}

/* Style 3: Square Modern */
.ctt-style-3 .ctt-button {
    border-radius: 16px;
}

/* Style 4: Floating Card */
.ctt-style-4 .ctt-button {
    border-radius: 12px;
    padding: 16px 24px;
    background: #FFFFFF;
    color: var(--ctt-primary);
    border: 2px solid var(--ctt-primary);
}

.ctt-style-4 .ctt-button:hover {
    background: var(--ctt-primary);
    color: #FFFFFF;
}

/* Style 5: Minimal Line */
.ctt-style-5 .ctt-button {
    background: transparent;
    border: 2px solid var(--ctt-primary);
    color: var(--ctt-primary);
    box-shadow: none;
}

.ctt-style-5 .ctt-button:hover {
    background: var(--ctt-primary);
    color: #FFFFFF;
}

/* Style 6: Gradient Glow */
.ctt-style-6 .ctt-button {
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    box-shadow: 0 4px 20px rgba(37, 211, 102, 0.4);
}

.ctt-style-6 .ctt-button:hover {
    box-shadow: 0 6px 30px rgba(37, 211, 102, 0.6);
}

/* Style 7: Chat Head */
.ctt-style-7 .ctt-button {
    border-radius: 50%;
    border: 3px solid #FFFFFF;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25);
}

/* Style 8: WhatsApp Native */
.ctt-style-8 .ctt-button {
    background: #25D366;
    border-radius: 50%;
}

.ctt-style-8 .ctt-button:has(.ctt-button-label) {
    border-radius: 28px;
    background: #25D366;
}

/* ==========================================================================
   GDPR Modal
   ========================================================================== */

.ctt-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999999;
    animation: ctt-modal-fade 0.2s ease;
}

@keyframes ctt-modal-fade {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.ctt-modal-content {
    background: #FFFFFF;
    border-radius: 16px;
    padding: 24px;
    max-width: 400px;
    width: 90%;
    animation: ctt-modal-slide 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes ctt-modal-slide {
    from {
        transform: translateY(20px) scale(0.95);
    }
    to {
        transform: translateY(0) scale(1);
    }
}

.ctt-modal-content h3 {
    margin: 0 0 16px;
    font-size: 18px;
    color: #1F2937;
}

.ctt-gdpr-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 14px;
    color: #4B5563;
    cursor: pointer;
    margin-bottom: 20px;
}

.ctt-gdpr-label input {
    margin-top: 3px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.ctt-modal-buttons {
    display: flex;
    gap: 12px;
}

.ctt-modal-cancel,
.ctt-modal-confirm {
    flex: 1;
    padding: 12px 20px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: 0.2s;
    border: none;
}

.ctt-modal-cancel {
    background: #F3F4F6;
    color: #4B5563;
}

.ctt-modal-cancel:hover {
    background: #E5E7EB;
}

.ctt-modal-confirm {
    background: #25D366;
    color: #FFFFFF;
    pointer-events: none;
    opacity: 0.5;
}

.ctt-modal-confirm.ctt-enabled {
    pointer-events: auto;
    opacity: 1;
}

.ctt-modal-confirm.ctt-enabled:hover {
    background: #128C7E;
}

/* ==========================================================================
   Inline Button (Shortcode)
   ========================================================================== */

.ctt-inline-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #25D366;
    color: #FFFFFF;
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    transition: 0.2s;
}

.ctt-inline-button:hover {
    background: #128C7E;
    color: #FFFFFF;
}

.ctt-inline-icon {
    fill: currentColor;
}

/* Inline Size Variants */
.ctt-inline-button.ctt-size-small {
    padding: 8px 16px;
    font-size: 13px;
}

.ctt-inline-button.ctt-size-large {
    padding: 14px 28px;
    font-size: 16px;
}

/* ==========================================================================
   QR Code
   ========================================================================== */

.ctt-qr-code {
    display: inline-block;
    text-align: center;
    padding: 16px;
    background: #FFFFFF;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.ctt-qr-code img {
    display: block;
    margin: 0 auto;
}

.ctt-qr-label {
    margin: 12px 0 0;
    font-size: 13px;
    color: #6B7280;
}

/* ==========================================================================
   Link Style
   ========================================================================== */

.ctt-link {
    color: #25D366;
    text-decoration: none;
    font-weight: 500;
    transition: 0.2s;
}

.ctt-link:hover {
    color: #128C7E;
    text-decoration: underline;
}

/* ==========================================================================
   Pro Notice
   ========================================================================== */

.ctt-pro-notice {
    background: #FEF3C7;
    border: 1px solid #F59E0B;
    color: #92400E;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
}

/* ==========================================================================
   Hidden State
   ========================================================================== */

#ctt-widget-wrapper.ctt-hidden {
    opacity: 0;
    transform: scale(0.8);
    pointer-events: none;
}

#ctt-widget-wrapper.ctt-scroll-hidden .ctt-button {
    transform: scale(0.8);
    opacity: 0;
    pointer-events: none;
}

/* ==========================================================================
   Responsive Adjustments
   ========================================================================== */

@media (max-width: 480px) {
    .ctt-greeting {
        width: calc(100vw - 40px);
        max-width: 320px;
    }

    .ctt-button-label {
        display: none;
    }

    .ctt-button:has(.ctt-button-label) {
        padding: 16px;
        border-radius: 50%;
    }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    #ctt-widget-wrapper {
        display: none !important;
    }
}

/* ==========================================================================
   Reduced Motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    .ctt-button,
    .ctt-greeting,
    .ctt-badge {
        animation: none !important;
        transition: none !important;
    }
}
