/**
 * Wedding RSVP Companion - Mobile-First CSS
 * Version: 2.0.0 - Fully Optimized for Mobile
 */

/* ===================================
   CSS Variables
   =================================== */
:root {
    /* Status Colors */
    --wrsvp-hadir: #10B981;
    --wrsvp-tidak: #EF4444;
    --wrsvp-ragu: #F59E0B;

    /* Primary */
    --wrsvp-primary: #6366F1;

    /* Grays */
    --wrsvp-gray-50: #F9FAFB;
    --wrsvp-gray-100: #F3F4F6;
    --wrsvp-gray-200: #E5E7EB;
    --wrsvp-gray-400: #9CA3AF;
    --wrsvp-gray-600: #4B5563;
    --wrsvp-gray-900: #111827;

    /* Spacing - Mobile First */
    --wrsvp-space-2: 0.5rem;
    --wrsvp-space-3: 0.75rem;
    --wrsvp-space-4: 1rem;

    /* Border Radius */
    --wrsvp-radius-md: 0.5rem;
    --wrsvp-radius-full: 9999px;
}

/* ===================================
   Form Styles
   =================================== */
.wrsvp-form-wrapper {
    margin: 1rem 0;
}

.wrsvp-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* List Container (Scrollable) */
.wrsvp-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    max-height: 500px;
    /* Fixed height to prevent long page */
    overflow-y: auto;
    /* Internal scroll */
    padding-right: 10px;
    /* Space for scrollbar */
    margin-bottom: 20px;
}

/* Custom Scrollbar for List */
.wrsvp-list::-webkit-scrollbar {
    width: 6px;
}

.wrsvp-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.wrsvp-list::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

.wrsvp-list::-webkit-scrollbar-thumb:hover {
    background: #bbb;
}

/* Load More Button */
.wrsvp-load-more {
    text-align: center;
    margin-top: 10px;
}

.wrsvp-load-more-btn {
    background: transparent;
    border: 1px solid var(--wrsvp-primary);
    color: var(--wrsvp-primary);
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s;
}

.wrsvp-load-more-btn:hover {
    background: var(--wrsvp-primary);
    color: white;
}

/* Admin/Mempelai Badge */
.wrsvp-badge-admin {
    background-color: var(--wrsvp-primary);
    color: white;
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 8px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    vertical-align: middle;
}

.wrsvp-field {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.wrsvp-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--wrsvp-gray-900);
}

.wrsvp-required {
    color: var(--wrsvp-tidak);
}

.wrsvp-input,
.wrsvp-textarea,
.wrsvp-select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--wrsvp-gray-200);
    border-radius: var(--wrsvp-radius-md);
    font-size: 1rem;
    font-family: inherit;
}

.wrsvp-input:focus,
.wrsvp-textarea:focus,
.wrsvp-select:focus {
    outline: none;
    border-color: var(--wrsvp-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.wrsvp-textarea {
    resize: vertical;
    min-height: 100px;
}

.wrsvp-field-guest {
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.wrsvp-submit-btn {
    padding: 1rem;
    background: var(--wrsvp-primary);
    color: white;
    border: none;
    border-radius: var(--wrsvp-radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
}

.wrsvp-submit-btn:active {
    opacity: 0.8;
}

/* ===================================
   RSVP List - Premium Social Media Style
   Elementor-Ready with CSS Variables
   =================================== */

/* Wrapper for Elementor isolation */
.wrsvp-container {
    --wrsvp-item-bg: #ffffff;
    --wrsvp-item-hover: #fafafa;
    --wrsvp-text-primary: #262626;
    --wrsvp-text-secondary: #8e8e8e;
    --wrsvp-text-muted: #c7c7c7;
    --wrsvp-accent: #0095f6;
    --wrsvp-border: #efefef;
    --wrsvp-avatar-size: 28px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

/* Scrollable List */
.wrsvp-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    max-height: 450px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #ddd transparent;
}

.wrsvp-list::-webkit-scrollbar {
    width: 4px;
}

.wrsvp-list::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 4px;
}

/* Single RSVP Item */
.wrsvp-item {
    display: flex;
    gap: 10px;
    padding: 12px 4px;
    border-bottom: 1px solid var(--wrsvp-border);
    transition: background 0.15s ease;
}

.wrsvp-item:hover {
    background: var(--wrsvp-item-hover);
}

.wrsvp-item:last-child {
    border-bottom: none;
}

/* Compact Avatar */
.wrsvp-avatar {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 11px;
    color: white;
    text-transform: uppercase;
}

.wrsvp-initials {
    user-select: none;
}

/* Content Wrapper */
.wrsvp-content-wrapper {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Header: Name + Status Dot + Time (Inline) */
.wrsvp-item-header {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.wrsvp-name-group {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.wrsvp-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--wrsvp-text-primary);
    margin: 0;
    line-height: 1.2;
}

/* Status Dot (replaces badge) */
.wrsvp-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.wrsvp-status-dot--hadir {
    background: var(--wrsvp-hadir);
}

.wrsvp-status-dot--tidak-hadir {
    background: var(--wrsvp-tidak);
}

.wrsvp-status-dot--masih-ragu,
.wrsvp-status-dot--ragu {
    background: var(--wrsvp-ragu);
}

/* Verified Badge (Admin) */
.wrsvp-verified-tick {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 12px;
    height: 12px;
    background: var(--wrsvp-accent);
    color: white;
    border-radius: 50%;
    font-size: 8px;
    font-weight: bold;
}

/* Time */
.wrsvp-date {
    font-size: 11px;
    color: var(--wrsvp-text-secondary);
    margin-left: auto;
}

/* Message Content */
.wrsvp-item-content {
    margin: 0;
}

.wrsvp-item-content p {
    margin: 0;
    font-size: 13px;
    line-height: 1.4;
    color: var(--wrsvp-text-primary);
    word-wrap: break-word;
}

/* Actions: Always Visible (Mobile-First) */
.wrsvp-item-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 6px;
}

/* Edit Button */
.wrsvp-edit-btn {
    font-size: 11px;
    color: var(--wrsvp-text-secondary);
    text-decoration: none;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
}

.wrsvp-edit-btn:hover {
    color: var(--wrsvp-text-primary);
}

/* Like/Love Button */
.wrsvp-love-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    color: var(--wrsvp-text-secondary);
    transition: all 0.15s ease;
}

.wrsvp-love-btn:hover {
    background: rgba(237, 73, 86, 0.1);
}

.wrsvp-love-btn.active,
.wrsvp-love-btn:active {
    color: #ed4956;
}

.wrsvp-love-icon {
    font-size: 14px;
    line-height: 1;
}

.wrsvp-amin-count {
    font-size: 11px;
    font-weight: 600;
}

/* Legacy Badge (Hidden by default, shown via override) */
.wrsvp-badge {
    display: none;
}

.wrsvp-item-content p {
    margin: 0;
    color: var(--wrsvp-gray-900);
    line-height: 1.5;
    font-size: 0.875rem;
}

/* Love/Like Button */
.wrsvp-item-actions {
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    /* Default left */
    gap: 1rem;
    position: relative;
    min-height: 32px;
    /* Prevent layout jump */
}

.wrsvp-love-btn {
    margin-left: auto;
    /* Always push to right */
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: transparent;
    border: 1px solid var(--wrsvp-gray-200);
    border-radius: var(--wrsvp-radius-full);
    color: var(--wrsvp-gray-600);
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.wrsvp-love-btn:hover {
    background: var(--wrsvp-gray-50);
    border-color: var(--wrsvp-gray-400);
}

.wrsvp-love-btn.active,
.wrsvp-love-btn.wrsvp-clicked {
    background: rgba(239, 68, 68, 0.1);
    /* Soft Red */
    border-color: #EF4444;
    color: #EF4444;
    /* Red */
}

/* Icon */
.wrsvp-love-icon {
    font-size: 1.1rem;
    line-height: 1;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.wrsvp-love-btn.active .wrsvp-love-icon,
.wrsvp-love-btn.wrsvp-clicked .wrsvp-love-icon {
    transform: scale(1.2);
}

/* Count */
.wrsvp-amin-count {
    font-weight: 600;
    font-size: 0.875rem;
}

/* Actions Container - Position Amin Left, Edit Right */
.wrsvp-item-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
    position: relative;
    /* Context for absolute if needed */
}

/* Minimalist Edit Button - Reset all Elementor styles */
/* Minimalist Edit Button - Reset all Elementor styles */
a.wrsvp-edit-btn,
.wrsvp-edit-btn {
    appearance: none !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;

    font-size: 0.75rem !important;
    /* Tiny/Subtle */
    color: var(--wrsvp-gray-400) !important;
    cursor: pointer;
    font-weight: 500;
    text-decoration: none !important;

    display: inline-flex;
    align-items: center;
    gap: 4px;

    transition: color 0.2s ease;
}

.wrsvp-edit-btn:hover {
    color: var(--wrsvp-primary) !important;
    background: transparent !important;
    text-decoration: none !important;
}

.wrsvp-edit-text {
    text-decoration: underline;
    text-underline-offset: 2px;
}

.wrsvp-form.editing-highlight {
    animation: highlightPulse 2s ease;
}

@keyframes highlightPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(99, 102, 241, 0);
    }

    30% {
        box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.3);
        border-color: var(--wrsvp-primary);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(99, 102, 241, 0);
    }
}

/* --- REPLIES (Admin) - Premium Style --- */
.wrsvp-replies {
    margin-top: 8px;
    margin-left: 40px;
    /* Align with content (avatar width + gap) */
    padding-left: 10px;
    border-left: 2px solid #e0e0e0;
}

.wrsvp-reply-item {
    background: #f5f5f5;
    border-radius: 12px;
    padding: 10px 12px;
    margin-bottom: 6px;
}

.wrsvp-reply-admin {
    background: linear-gradient(135deg, #f0f4ff 0%, #e8f0fe 100%);
    border-left: 2px solid #0095f6;
}

.wrsvp-reply-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}

.wrsvp-reply-author {
    font-size: 13px;
    font-weight: 600;
    color: #262626;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* Remove old crown, use verified tick */
.wrsvp-reply-author::after {
    display: none;
}

/* Admin gets verified tick */
.wrsvp-reply-admin .wrsvp-reply-author::after {
    content: '✓';
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 12px;
    height: 12px;
    background: #0095f6;
    color: white;
    border-radius: 50%;
    font-size: 8px;
    font-weight: bold;
}

.wrsvp-reply-date {
    font-size: 11px;
    color: #8e8e8e;
    margin-left: auto;
}

.wrsvp-reply-content {
    font-size: 13px;
    color: #262626;
    line-height: 1.4;
}

.wrsvp-reply-content p {
    margin: 0;
}

/* Animations */
@keyframes wrsvp-pop {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.3);
    }

    100% {
        transform: scale(1);
    }
}

.wrsvp-pop-anim {
    animation: wrsvp-pop 0.3s ease;
}

/* Empty State */
.wrsvp-empty {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--wrsvp-gray-600);
}

/* ===================================
   Stats
   =================================== */
.wrsvp-stats {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin: 1rem 0;
}

.wrsvp-stat-item {
    background: white;
    border-radius: var(--wrsvp-radius-md);
    padding: 1.5rem;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.wrsvp-stat-number {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.wrsvp-stat-hadir .wrsvp-stat-number {
    color: var(--wrsvp-hadir);
}

.wrsvp-stat-tidak .wrsvp-stat-number {
    color: var(--wrsvp-tidak);
}

.wrsvp-stat-ragu .wrsvp-stat-number {
    color: var(--wrsvp-ragu);
}

.wrsvp-stat-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--wrsvp-gray-900);
}

.wrsvp-stat-guests {
    display: block;
    font-size: 0.75rem;
    color: var(--wrsvp-gray-600);
    margin-top: 0.25rem;
}

/* ===================================
   Tablet & Desktop (min-width: 640px)
   =================================== */
@media (min-width: 640px) {
    .wrsvp-item {
        padding: 1.25rem;
    }

    .wrsvp-avatar {
        width: 44px;
        height: 44px;
    }

    .wrsvp-name {
        font-size: 1rem;
    }

    .wrsvp-date {
        font-size: 0.75rem;
    }

    .wrsvp-badge {
        font-size: 0.75rem;
        padding: 4px 10px;
    }

    .wrsvp-badge svg {
        width: 12px;
        height: 12px;
    }

    .wrsvp-item-content p {
        font-size: 0.9375rem;
    }

    .wrsvp-stats {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ===================================
   Animations
   =================================== */
@keyframes aminPulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.2);
    }
}

.wrsvp-amin-btn.amin-animate .wrsvp-amin-icon {
    animation: aminPulse 0.6s ease;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.wrsvp-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* Message */
.wrsvp-message {
    padding: 1rem;
    border-radius: var(--wrsvp-radius-md);
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

.wrsvp-message.success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid var(--wrsvp-hadir);
    color: #059669;
}

.wrsvp-message.error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--wrsvp-tidak);
    color: #DC2626;
}

/* Particles */
.wrsvp-particle {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
}