/**
 * CHANGE-004: Social Events Widget - Styles
 * Mobile-first design with minimize/collapse functionality
 * Optimized for 99% mobile usage
 */

/* Mobile-first: Fixed bottom positioning */
.social-events-widget {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    padding: 0;
    max-height: 90vh;
    overflow-y: auto;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    /* iOS safe area support */
    padding-bottom: env(safe-area-inset-bottom);
}

/* Desktop: Centered floating card */
@media (min-width: 769px) {
    .social-events-widget {
        position: fixed;
        bottom: 20px;
        right: 20px;
        left: auto;
        max-width: 420px;
        max-height: 80vh;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
        border-radius: 16px;
    }
}

/* Floating Button (Collapsed State) */
.sew-floating-btn {
    position: fixed;
    bottom: calc(20px + env(safe-area-inset-bottom));
    right: 20px;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
    border: none;
    box-shadow: 0 4px 20px rgba(6, 182, 212, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 9999;
    animation: sew-float-in 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    -webkit-tap-highlight-color: transparent; /* Remove iOS tap highlight */
}

.sew-floating-btn:hover {
    transform: scale(1.1) translateY(-4px);
    box-shadow: 0 8px 28px rgba(6, 182, 212, 0.5);
}

.sew-floating-btn:active {
    transform: scale(0.95);
}

.sew-floating-icon {
    font-size: 2rem;
    line-height: 1;
}

.sew-floating-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #10b981;
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    min-width: 24px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.4);
}

.sew-floating-pulse {
    position: absolute;
    top: 0;
    right: 0;
    width: 12px;
    height: 12px;
    background: #ef4444;
    border-radius: 50%;
    animation: sew-pulse 2s infinite;
}

@keyframes sew-pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(1.4);
    }
}

@keyframes sew-float-in {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Backdrop for expanded widget (mobile) */
.social-events-widget::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: -1;
}

/* Show backdrop when expanded on mobile */
@media (max-width: 768px) {
    .social-events-widget:not(.sew-collapsed)::before {
        opacity: 1;
        pointer-events: auto;
    }
}

/* Expanded Card */
.sew-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.15);
    padding: 1.5rem;
    border: 1px solid rgba(0, 0, 0, 0.05);
    position: relative;
    animation: sew-slide-up-card 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes sew-slide-up-card {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Desktop: Full rounded corners */
@media (min-width: 769px) {
    .sew-card {
        border-radius: 16px;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    }
}

/* Drag Handle (Mobile) */
.sew-handle {
    display: none;
    width: 40px;
    height: 5px;
    background: #d1d5db;
    border-radius: 3px;
    margin: 0 auto 1rem auto;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sew-handle:hover {
    background: #9ca3af;
}

.sew-handle:active {
    transform: scaleX(1.2);
}

/* Show handle only on mobile */
@media (max-width: 768px) {
    .sew-handle {
        display: block;
        margin-top: -0.5rem;
        margin-bottom: 0.75rem;
    }
}

/* Minimize Button */
.sew-minimize-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.05);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    transition: all 0.2s ease;
    z-index: 10;
}

.sew-minimize-btn:hover {
    background: rgba(0, 0, 0, 0.1);
    color: #111827;
    transform: scale(1.1);
}

.sew-minimize-btn:active {
    transform: scale(0.9);
}

/* Hide minimize button on mobile (use handle instead) */
@media (max-width: 768px) {
    .sew-minimize-btn {
        display: none;
    }
}

/* Header */
.sew-header {
    text-align: center;
    margin-bottom: 2rem;
}

.sew-header h3 {
    font-size: 1.75rem;
    font-weight: 700;
    color: #111827;
    margin: 0 0 0.5rem 0;
    background: linear-gradient(135deg, #06b6d4, #0891b2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sew-subtitle {
    color: #6b7280;
    font-size: 0.95rem;
    margin: 0;
}

/* Points Display */
.sew-points-display {
    text-align: center;
    margin-bottom: 1.5rem;
}

.sew-points-current {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.sew-points-number {
    font-size: 3.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, #06b6d4, #0891b2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
}

.sew-points-label {
    font-size: 1.1rem;
    color: #6b7280;
    font-weight: 600;
}

.sew-points-max {
    color: #9ca3af;
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.sew-raffle-info {
    color: #059669;
    font-size: 1.1rem;
    font-weight: 600;
    margin-top: 0.5rem;
}

/* Progress Bar */
.sew-progress-bar {
    width: 100%;
    height: 12px;
    background: #e5e7eb;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 1.5rem;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.06);
}

.sew-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #06b6d4 0%, #0891b2 100%);
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(6, 182, 212, 0.3);
}

/* Max Points Notice */
.sew-max-notice {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 2px solid #fbbf24;
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 4px 12px rgba(251, 191, 36, 0.2);
}

.sew-trophy {
    font-size: 2.5rem;
    line-height: 1;
    flex-shrink: 0;
}

.sew-notice-text {
    color: #78350f;
    font-size: 0.95rem;
    line-height: 1.5;
}

.sew-notice-text strong {
    display: block;
    font-size: 1.05rem;
    margin-bottom: 0.25rem;
}

/* Events List */
.sew-events-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.sew-event-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border-radius: 12px;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.sew-event-verified {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    border-color: #10b981;
}

.sew-event-pending {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-color: #fbbf24;
}

.sew-event-rejected {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    border-color: #ef4444;
}

.sew-event-available {
    background: #ffffff;
    border-color: #e5e7eb;
    cursor: pointer;
}

.sew-event-available:hover {
    border-color: #06b6d4;
    box-shadow: 0 4px 12px rgba(6, 182, 212, 0.15);
    transform: translateY(-2px);
}

.sew-event-disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.sew-event-disabled:hover {
    transform: none;
    box-shadow: none;
    border-color: #e5e7eb;
}

.sew-event-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.8);
    flex-shrink: 0;
}

.sew-event-verified .sew-event-icon {
    background: #10b981;
    color: white;
}

.sew-event-pending .sew-event-icon {
    background: #fbbf24;
    color: white;
}

.sew-event-rejected .sew-event-icon {
    background: #ef4444;
    color: white;
}

.sew-event-info {
    flex: 1;
}

.sew-event-name {
    font-weight: 600;
    color: #111827;
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
}

.sew-event-status {
    font-size: 0.85rem;
    color: #6b7280;
}

.sew-event-points {
    font-size: 0.85rem;
    color: #059669;
    font-weight: 600;
}

.sew-event-action {
    flex-shrink: 0;
}

/* Buttons */
.sew-btn-small {
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #06b6d4, #0891b2);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(6, 182, 212, 0.3);
}

.sew-btn-small:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(6, 182, 212, 0.4);
}

.sew-btn-small:disabled {
    background: #9ca3af;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Raffle Footer */
.sew-raffle-footer {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 2px solid #e5e7eb;
    text-align: center;
}

.sew-draw-date {
    color: #6b7280;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.sew-prizes-preview {
    color: #059669;
    font-size: 1.1rem;
    font-weight: 600;
}

/* Prompt (when no lead) */
.sew-prompt {
    text-align: center;
    padding: 2rem;
    color: #6b7280;
    font-size: 1.05rem;
}

/* Modal */
.sew-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 1rem;
    backdrop-filter: blur(4px);
    animation: sew-fade-in 0.2s ease;
}

@keyframes sew-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.sew-modal-content {
    background: white;
    border-radius: 16px;
    max-width: 500px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: sew-slide-up 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes sew-slide-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.sew-modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sew-modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    color: #111827;
}

.sew-modal-close {
    background: none;
    border: none;
    font-size: 1.75rem;
    color: #9ca3af;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.sew-modal-close:hover {
    background: #f3f4f6;
    color: #111827;
}

.sew-modal-body {
    padding: 1.5rem;
}

.sew-modal-body p {
    color: #6b7280;
    margin: 0 0 1rem 0;
}

.sew-hashtag-hint {
    background: #fef3c7;
    border: 1px solid #fbbf24;
    border-radius: 8px;
    padding: 0.75rem;
    color: #78350f;
    font-size: 0.9rem;
}

.sew-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.2s ease;
}

.sew-input:focus {
    outline: none;
    border-color: #06b6d4;
    box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.1);
}

.sew-modal-footer {
    padding: 1.5rem;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

.sew-btn-primary,
.sew-btn-secondary {
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.sew-btn-primary {
    background: linear-gradient(135deg, #06b6d4, #0891b2);
    color: white;
    box-shadow: 0 2px 8px rgba(6, 182, 212, 0.3);
}

.sew-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(6, 182, 212, 0.4);
}

.sew-btn-secondary {
    background: #f3f4f6;
    color: #6b7280;
}

.sew-btn-secondary:hover {
    background: #e5e7eb;
}

/* Mobile Optimizations (99% mobile usage!) */
@media (max-width: 768px) {
    .sew-card {
        padding: 1.25rem;
        max-height: 90vh;
        overflow-y: auto;
    }

    .sew-header {
        margin-bottom: 1.5rem;
        padding-right: 2rem; /* Space for minimize button */
    }

    .sew-header h3 {
        font-size: 1.4rem;
    }

    .sew-subtitle {
        font-size: 0.9rem;
    }

    .sew-points-number {
        font-size: 2.5rem;
    }

    .sew-points-label {
        font-size: 1rem;
    }

    .sew-event-item {
        padding: 0.875rem;
        gap: 0.75rem;
    }

    .sew-event-icon {
        width: 36px;
        height: 36px;
        font-size: 1.25rem;
    }

    .sew-event-name {
        font-size: 0.9rem;
    }

    /* Touch-friendly buttons */
    .sew-btn-small {
        padding: 0.625rem 1.125rem;
        font-size: 0.9rem;
        min-height: 44px; /* iOS touch target */
    }

    .sew-minimize-btn {
        width: 40px;
        height: 40px;
        top: 0.75rem;
        right: 0.75rem;
    }

    .sew-floating-btn {
        width: 60px;
        height: 60px;
        bottom: calc(16px + env(safe-area-inset-bottom));
        right: 16px;
    }

    .sew-floating-icon {
        font-size: 1.75rem;
    }

    .sew-modal-content {
        margin: 0.5rem;
    }

    /* Smooth scrolling for mobile */
    .social-events-widget {
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }
}

/* Extra small devices */
@media (max-width: 375px) {
    .sew-card {
        padding: 1rem;
    }

    .sew-header h3 {
        font-size: 1.25rem;
    }

    .sew-points-number {
        font-size: 2.25rem;
    }

    .sew-event-item {
        padding: 0.75rem;
        gap: 0.5rem;
    }

    .sew-event-icon {
        width: 32px;
        height: 32px;
        font-size: 1.125rem;
    }
}
