/* =============================================
   WHATSAPP UI COMPONENTS & UTILITIES
   ============================================= */

/* General Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideDown {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Scrollbar Styling (WhatsApp-like) */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

/* Loading Spinner */
.wa-spinner {
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid var(--wa-white);
    border-radius: var(--radius-round);
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Toast Notification */
.wa-toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #323232;
    color: var(--wa-white);
    padding: 14px 24px;
    border-radius: var(--radius-md);
    font-size: 14px;
    z-index: 1001;
    animation: slideUp 0.3s ease-out;
    box-shadow: var(--shadow-lg);
}

/* Status Badge */
.wa-status-badge {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 14px;
    height: 14px;
    border-radius: var(--radius-round);
    border: 2px solid var(--wa-white);
}

.wa-status-online {
    background-color: #4CAF50;
}

.wa-status-offline {
    background-color: var(--wa-gray-dark);
}

/* Ripple Effect */
.wa-ripple {
    position: relative;
    overflow: hidden;
}

.wa-ripple::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: var(--radius-round);
    background: rgba(255, 255, 255, 0.5);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.wa-ripple:active::after {
    width: 200px;
    height: 200px;
}

/* Check Marks (Message Status) */
.wa-check {
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-left: 4px;
}

.wa-check-single {
    color: var(--wa-gray-dark);
}

.wa-check-double {
    color: var(--wa-gray-dark);
}

.wa-check-read {
    color: var(--wa-blue);
}

/* Voice Message Waveform (Placeholder) */
.wa-voice-message {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
}

.wa-voice-btn {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-round);
    background-color: var(--wa-green);
    color: var(--wa-white);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.wa-waveform {
    flex: 1;
    height: 24px;
    display: flex;
    align-items: center;
    gap: 2px;
}

.wa-waveform span {
    width: 3px;
    background-color: var(--wa-gray-dark);
    border-radius: 2px;
    animation: wavePulse 1.2s infinite ease-in-out;
}

.wa-waveform span:nth-child(1) {
    height: 8px;
    animation-delay: 0s;
}

.wa-waveform span:nth-child(2) {
    height: 14px;
    animation-delay: 0.1s;
}

.wa-waveform span:nth-child(3) {
    height: 18px;
    animation-delay: 0.2s;
}

.wa-waveform span:nth-child(4) {
    height: 12px;
    animation-delay: 0.3s;
}

.wa-waveform span:nth-child(5) {
    height: 16px;
    animation-delay: 0.4s;
}

@keyframes wavePulse {

    0%,
    100% {
        transform: scaleY(1);
    }

    50% {
        transform: scaleY(1.5);
    }
}

/* Media Query Helpers */
.wa-mobile-only {
    display: block;
}

.wa-desktop-only {
    display: none;
}

@media (min-width: 768px) {
    .wa-mobile-only {
        display: none;
    }

    .wa-desktop-only {
        display: block;
    }
}

/* Dark Mode Support (Future Enhancement) */
@media (prefers-color-scheme: dark) {
    /* Dark mode styles can be added here */
}

/* Accessibility */
.wa-skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--wa-teal);
    color: var(--wa-white);
    padding: 8px;
    text-decoration: none;
    z-index: 100;
}

.wa-skip-link:focus {
    top: 0;
}

/* Focus Styles */
button:focus-visible,
a:focus-visible {
    outline: 2px solid var(--wa-green);
    outline-offset: 2px;
}

/* Print Styles */
@media print {

    .wa-header,
    .wa-bottom-nav,
    .wa-fab,
    .wa-chat-input-container,
    .wa-ad-slot,
    .wa-ad-wrapper {
        display: none !important;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .wa-profile-card {
        border: 1px solid var(--wa-black);
    }

    .wa-message {
        border: 1px solid var(--wa-black);
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}