/* Trip Chat Styles */

/* Completely lock scrolling when fullscreen chat is active */
html.chat-fullscreen-active,
body.chat-fullscreen-active {
    overflow: hidden !important;
    overscroll-behavior: none !important;
    -webkit-overflow-scrolling: auto !important;
    position: fixed !important;
    width: 100% !important;
    height: 100% !important;
    top: 0 !important;
    left: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Block ALL pointer events on page content - prevents clicking Book Now button */
body.chat-fullscreen-active {
    pointer-events: none !important;
}

/* Re-enable pointer events ONLY on overlay and its children */
body.chat-fullscreen-active .trip-chat-fullscreen-overlay,
body.chat-fullscreen-active .trip-chat-fullscreen-overlay *,
body.chat-fullscreen-active .trip-chat-fullscreen,
body.chat-fullscreen-active .trip-chat-fullscreen *,
body.chat-fullscreen-active .trip-chat-fullscreen button,
body.chat-fullscreen-active .trip-chat-fullscreen input,
body.chat-fullscreen-active .trip-chat-fullscreen textarea,
body.chat-fullscreen-active .trip-chat-fullscreen form,
body.chat-fullscreen-active .trip-chat-fullscreen-overlay .chat-send-btn,
body.chat-fullscreen-active .trip-chat-fullscreen-overlay .chat-filter-btn,
body.chat-fullscreen-active .trip-chat-fullscreen-overlay .chat-close-btn,
body.chat-fullscreen-active .trip-chat-fullscreen-overlay .chat-file-btn,
body.chat-fullscreen-active .trip-chat-fullscreen-overlay .chat-emoji-btn,
body.chat-fullscreen-active .trip-chat-fullscreen-overlay .chat-poll-btn,
body.chat-fullscreen-active .chat-sidebar,
body.chat-fullscreen-active .chat-sidebar *,
body.chat-fullscreen-active .chat-lightbox-overlay,
body.chat-fullscreen-active .chat-lightbox-overlay *,
body.chat-fullscreen-active .chat-login-modal-overlay,
body.chat-fullscreen-active .chat-login-modal-overlay *,
body.chat-fullscreen-active .best-practices-modal-overlay,
body.chat-fullscreen-active .best-practices-modal-overlay *,
body.chat-fullscreen-active .delete-modal-overlay,
body.chat-fullscreen-active .delete-modal-overlay *,
body.chat-fullscreen-active .poll-creation-modal,
body.chat-fullscreen-active .poll-creation-modal * {
    pointer-events: auto !important;
}

/* Hide sidebar overlay when fullscreen chat is active */
body.chat-fullscreen-active .chat-overlay {
    display: none !important;
}

.trip-chat-wrapper {
    margin: 30px 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.trip-chat-loading {
    text-align: center;
    padding: 40px;
    color: #666;
    font-size: 16px;
}

.trip-chat-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* Chat Header */
.trip-chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.trip-chat-header h4 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    flex: 1;
}

.trip-chat-header i.fa-comments {
    font-size: 24px;
}

.online-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 13px;
}

.online-badge .fa-circle {
    font-size: 8px;
}

.offline-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(239, 68, 68, 0.9);
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 13px;
    color: white;
}

.offline-badge .fa-circle {
    font-size: 8px;
}

.reconnecting-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(251, 191, 36, 0.9);
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 13px;
    color: white;
}

.reconnecting-badge .fa-spin {
    font-size: 12px;
}

/* Preview Card (Public/Pending Booking) */
.trip-chat-preview .trip-chat-body {
    padding: 30px;
    text-align: center;
}

.trip-chat-preview .trip-chat-body p {
    font-size: 16px;
    color: #555;
    margin-bottom: 20px;
}

.trip-chat-preview .trip-chat-body .chat-preview-text {
    font-size: 16px;
    color: #555;
    margin-bottom: 24px;
    line-height: 1.6;
}

.trip-chat-preview .trip-chat-body .chat-preview-text i {
    margin-right: 8px;
    color: #667eea;
}

.trip-chat-preview .btn {
    font-size: 16px;
    padding: 12px 24px;
    border-radius: 6px;
}

/* Blurred Message Preview (Public View - Inline) */
.trip-chat-messages-preview {
    position: relative;
    max-height: 500px;
    overflow: hidden;
    padding: 20px;
    background: #f5f7fb;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chat-message-blurred {
    filter: blur(4px);
    pointer-events: none;
    user-select: none;
}

/* Preview Messages Full-Screen */
.trip-chat-messages-preview-fullscreen {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f5f7fb;
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: relative;
}

/* Preview Overlay */
.chat-preview-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.3) 30%,
        rgba(255, 255, 255, 0.95) 60%,
        rgba(255, 255, 255, 0.98) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

/* Preview Overlay Full-Screen */
.chat-preview-overlay-fullscreen {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom,
        rgba(245, 247, 251, 0) 0%,
        rgba(245, 247, 251, 0.3) 30%,
        rgba(245, 247, 251, 0.95) 60%,
        rgba(245, 247, 251, 0.98) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.overlay-content {
    text-align: center;
    max-width: 400px;
    animation: fadeInUp 0.6s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.overlay-content .fa-lock {
    color: #667eea;
    margin-bottom: 20px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translate(-50%, -20px);
    }
    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

@keyframes slideUp {
    from {
        opacity: 1;
        transform: translate(-50%, 0);
    }
    to {
        opacity: 0;
        transform: translate(-50%, -20px);
    }
}

/* Custom Chat Alert Notifications */
.chat-custom-alert {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

.chat-custom-alert.alert-warning {
    background: #fff3cd;
    border: 1px solid #ffc107;
    color: #856404;
}

.chat-custom-alert.alert-danger {
    background: #f8d7da;
    border: 1px solid #dc3545;
    color: #721c24;
}

.chat-custom-alert.alert-success {
    background: #d4edda;
    border: 1px solid #28a745;
    color: #155724;
}

.chat-custom-alert.alert-info {
    background: #d1ecf1;
    border: 1px solid #17a2b8;
    color: #0c5460;
}

.overlay-content h3 {
    font-size: 28px;
    font-weight: 700;
    color: #333;
    margin: 0 0 12px 0;
}

.overlay-content p {
    font-size: 16px;
    color: #666;
    margin: 0 0 24px 0;
}

.overlay-content .btn {
    font-size: 18px;
    padding: 14px 32px;
    border-radius: 8px;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    transition: all 0.3s;
}

.overlay-content .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

.overlay-content .btn i {
    margin-right: 8px;
}

/* INLINE CHAT INTERFACE (Authenticated Users) */
.trip-chat-inline {
    margin: 30px 0;
}

.trip-chat-inline .trip-chat-card {
    max-height: 600px;
    display: flex;
    flex-direction: column;
    /* Enable proper sticky positioning for input on mobile */
    position: relative;
    overflow: hidden;
}

/* Inline Chat Header */
.trip-chat-header-inline {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 8px 8px 0 0;
    /* Prevent header from shrinking */
    flex-shrink: 0;
}

.trip-chat-header-inline .header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.trip-chat-header-inline h4 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.trip-chat-header-inline i.fa-comments {
    font-size: 20px;
}

.btn-maximize {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #fff;
    /* Larger touch target for mobile (iOS minimum is 44px) */
    min-width: 44px;
    min-height: 44px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    transition: all 0.2s;
    /* Remove 300ms touch delay on Chrome mobile */
    touch-action: manipulation;
    /* Remove blue highlight on tap */
    -webkit-tap-highlight-color: transparent;
}

.btn-maximize:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

/* Inline Messages Container */
.trip-chat-messages-inline {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f5f7fb;
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-height: 400px;
    min-height: 300px;
}

/* Inline Chat Input */
.trip-chat-input-inline {
    padding: 16px 20px;
    background: #fff;
    border-top: 1px solid #e0e0e0;
    border-radius: 0 0 8px 8px;
    display: flex;
    flex-direction: column;
    /* Ensure input area stays visible on mobile keyboards */
    position: relative;
    /* Prevent input from being pushed out of view when files are attached */
    flex-shrink: 0;
}

/* FULL-SCREEN CHAT OVERLAY */
.trip-chat-fullscreen-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    min-height: 100vh !important;
    min-height: 100dvh !important; /* Dynamic viewport height - excludes keyboard on mobile */
    /* Completely opaque black background - no transparency to prevent page bleed-through */
    background: #000000 !important;
    /* Extremely high z-index to ensure chat is above ALL page content */
    z-index: 999999999 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    padding: 0 !important;
    margin: 0 !important;
    animation: fadeIn 0.2s ease-out;
    /* Prevent overscroll on both Safari iOS and Chrome mobile */
    overscroll-behavior: none !important;
    -webkit-overflow-scrolling: auto !important;
    overflow: hidden !important;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.trip-chat-fullscreen {
    /* Absolutely critical: fill overlay completely */
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: #fff !important;
    border-radius: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    box-shadow: none !important;
    /* Safe area insets for iPhone notch and Dynamic Island */
    padding-top: env(safe-area-inset-top) !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    padding-bottom: 0 !important;
    margin: 0 !important;
    /* Prevent overscroll/rubber banding */
    overscroll-behavior-y: contain !important;
    overflow: hidden !important;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Full-Screen Header */
.trip-chat-header-fullscreen {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 20px 24px;
    /* Add extra padding for iPhone notch/Dynamic Island (iPhone 14 Pro+, 15 Pro+, 16 Pro+) */
    padding-top: calc(20px + env(safe-area-inset-top));
    /* Also handle left/right safe areas for landscape mode on newer iPhones */
    padding-left: max(24px, env(safe-area-inset-left));
    padding-right: max(24px, env(safe-area-inset-right));
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 16px 16px 0 0;
    flex-shrink: 0;
    position: relative;
    z-index: 200; /* Above pull-to-refresh (z-index: 10) */
}

.trip-chat-header-fullscreen h4 {
    margin: 0;
    font-size: 22px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #fff;
    /* Larger touch target for mobile (iOS minimum is 44px) */
    min-width: 44px;
    min-height: 44px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    transition: all 0.2s;
    /* Remove 300ms touch delay on Chrome mobile */
    touch-action: manipulation;
    /* Remove blue highlight on tap */
    -webkit-tap-highlight-color: transparent;
}

/* Ensure icons and badges inside buttons don't block clicks */
.chat-close-btn i,
.chat-filter-btn i,
.chat-filter-btn span,
.chat-send-btn i,
.btn-maximize i,
.chat-file-btn i,
.chat-poll-btn i {
    pointer-events: none;
}

/* Ensure buttons are above other elements */
.chat-close-btn,
.chat-filter-btn,
.chat-send-btn,
.btn-maximize {
    position: relative;
    z-index: 100;
}

.chat-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

/* Pinned Messages */
.trip-chat-pinned {
    background: #fff9e6;
    border-bottom: 1px solid #e0e0e0;
    flex-shrink: 0;
    max-height: min(400px, 45vh); /* Responsive: 400px on desktop, 45% viewport on mobile */
    display: flex;
    flex-direction: column;
}

.pinned-header {
    padding: 10px 20px;
    font-weight: 600;
    color: #856404;
    font-size: 14px;
    border-bottom: 1px solid #f5deb3;
}

.pinned-header-collapsible {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s;
}

.pinned-header-collapsible:hover {
    background: #fff5cc;
}

.pinned-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pinned-messages-expanded {
    overflow-y: auto;
    max-height: min(350px, 40vh); /* Responsive: 350px on desktop, 40% viewport on mobile */
    transition: max-height 0.3s ease-out; /* Smooth animation */
}

.pinned-message {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 12px 20px;
    border-bottom: 1px solid #f5deb3;
    gap: 10px;
}

.pinned-message:last-child {
    border-bottom: none;
}

.pinned-message-content {
    flex: 1;
    font-size: 14px;
    color: #333;
}

.pinned-message-header-info {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.pinned-message-time {
    font-size: 12px;
    color: #999;
    margin-left: 4px;
}

.pinned-message-text {
    margin-bottom: 8px;
    line-height: 1.4;
}

.pinned-message-attachments {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}

.pinned-attachment {
    display: flex;
    align-items: center;
}

.pinned-attachment-image img {
    max-width: 200px;
    max-height: 150px;
    border-radius: 6px;
    border: 1px solid #ddd;
    object-fit: cover;
}

.pinned-attachment-video {
    max-width: 300px;
    position: relative;
}

.pinned-video-player {
    width: 100%;
    max-height: 200px;
    border-radius: 6px;
    border: 1px solid #ddd;
    background: #000;
}

.pinned-attachment-file {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    max-width: fit-content;
}

.pinned-attachment-file i {
    color: #dc3545;
    font-size: 18px;
}

.pinned-attachment-file a {
    color: #007bff;
    text-decoration: none;
    font-size: 13px;
}

.pinned-attachment-file a:hover {
    text-decoration: underline;
}

.btn-unpin {
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    color: #666;
    cursor: pointer;
    padding: 6px 10px;
    transition: all 0.2s;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
}

.btn-unpin:hover {
    background: #e8e8e8;
    color: #333;
    border-color: #ccc;
}

.btn-unpin .fa-thumb-tack {
    transform: rotate(45deg); /* Rotated to indicate "unpinning" */
}

.unpin-text {
    font-weight: 500;
}

/* Full-Screen Messages Container */
.trip-chat-messages-fullscreen {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px;
    /* Handle safe areas for landscape mode on iPhone 16 Pro */
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
    background: #f5f7fb;
    display: flex;
    flex-direction: column;
    /* Prevent overscroll on mobile to avoid conflicts with pull-to-refresh */
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
    position: relative;
    gap: 12px;
    /* Smooth momentum scrolling for iOS */
    -webkit-overflow-scrolling: touch;
    /* Prevent parent scroll when at boundaries */
    overscroll-behavior: contain;
    /* Smooth scroll behavior */
    scroll-behavior: smooth;
    /* Allow container to shrink when keyboard opens, but maximize space when closed */
    min-height: 0;
}

.no-messages {
    text-align: center;
    padding: 60px 20px;
    color: #999;
    margin: auto;
}

.no-messages i {
    font-size: 48px;
    margin-bottom: 16px;
    display: block;
}

.no-messages p {
    font-size: 16px;
    margin: 0;
}

/* Infinite Scroll Loading Indicator */
.infinite-scroll-loader {
    text-align: center;
    padding: 16px 20px;
    background: linear-gradient(to bottom, rgba(102, 126, 234, 0.05) 0%, rgba(255, 255, 255, 0) 100%);
    animation: fadeInLoader 0.3s ease-in;
    position: relative;
    z-index: 5;
}

.infinite-scroll-loader .loader-content {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: white;
    padding: 8px 16px;
    border-radius: 20px;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.15);
    color: #667eea;
    font-size: 14px;
    font-weight: 500;
}

.infinite-scroll-loader .loader-content i {
    font-size: 16px;
    color: #667eea;
}

@keyframes fadeInLoader {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Slack-Style Message Layout */
.chat-message-wrapper-slack {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 8px 16px;
    position: relative; /* For action bar positioning */
    transition: background-color 0.2s;
    animation: messageSlideIn 0.3s ease-out;
}

.chat-message-wrapper-slack:hover {
    background-color: #f8f9fa;
}

.message-avatar-slack {
    flex-shrink: 0;
    margin-top: 2px;
}

.message-content-slack {
    flex: 1;
    min-width: 0;
}

.message-header-slack {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 4px;
    flex-wrap: wrap;
}

.message-sender-name-slack {
    font-weight: 700;
    font-size: 15px;
    color: #1d1c1d;
}

.message-timestamp-slack {
    font-size: 12px;
    color: #616061;
    font-weight: 400;
    margin-left: 4px;
}

.message-time-slack {
    font-size: 12px;
    color: #616061;
    font-weight: 400;
}

.message-text-slack {
    font-size: 15px;
    line-height: 1.46668;
    color: #1d1c1d;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.message-text-slack p,
.message-text-slack div,
.message-text-slack span {
    text-indent: 0 !important;
    margin-left: 0 !important;
    padding-left: 0 !important;
}

/* Show more/less link for long messages */
.message-show-more-link {
    display: inline-block;
    margin-top: 4px;
    margin-left: 0 !important;
    text-indent: 0 !important;
    padding-left: 0 !important;
    color: #1264a3;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: color 0.2s;
    line-height: 1.4;
}

.message-show-more-link:hover {
    color: #0b4c8c;
    text-decoration: underline;
}

.message-show-more-link:focus {
    outline: 2px solid #1264a3;
    outline-offset: 2px;
    border-radius: 2px;
}

/* Message Status Indicators (Optimistic UI) */
.message-status-container {
    display: inline-block;
    margin-left: 6px;
    margin-top: 4px;
}

.message-status {
    font-size: 11px;
    color: #999;
    opacity: 0.7;
    display: inline-flex;
    align-items: center;
    transition: opacity 0.2s;
}

.message-status i {
    font-size: 12px;
}

/* Pending status - clock icon with pulse animation */
.message-status i.fa-clock-o {
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

/* Sent status - checkmark */
.message-status i.fa-check {
    color: #999;
}

/* Failed status - red exclamation */
.message-status-failed {
    color: #dc3545 !important;
    opacity: 1 !important;
}

.message-status-failed i {
    color: #dc3545;
}

/* Retry button for failed messages */
.retry-message-btn {
    margin-left: 8px;
    padding: 4px 10px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.retry-message-btn:hover {
    background: #c82333;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(220, 53, 69, 0.3);
}

.retry-message-btn:active {
    transform: translateY(0);
}

.retry-message-btn i {
    font-size: 11px;
    color: white;
}

/* Optimistic message styling - slightly faded until confirmed */
.chat-message-wrapper-slack.optimistic-message {
    opacity: 0.7;
}

.chat-message-wrapper-slack.failed-message {
    background-color: #fff3f3;
    border-left: 3px solid #dc3545;
    padding-left: 13px;
}

/* New Messages Indicator - Floating button when scrolled up */
.new-messages-indicator {
    position: sticky;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    display: flex;
    justify-content: center;
    animation: slideUpBounce 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.new-messages-indicator button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    transition: all 0.2s;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.new-messages-indicator button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.5);
}

.new-messages-indicator button:active {
    transform: translateY(0);
}

.new-messages-indicator i {
    font-size: 14px;
    animation: bounce 1.5s ease-in-out infinite;
}

@keyframes slideUpBounce {
    0% {
        opacity: 0;
        bottom: -20px;
    }
    60% {
        bottom: 25px;
    }
    100% {
        opacity: 1;
        bottom: 20px;
    }
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(3px);
    }
}

.message-actions-slack {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    opacity: 0;
    transition: opacity 0.2s;
}

.chat-message-wrapper-slack:hover .message-actions-slack {
    opacity: 1;
}

.btn-action-slack {
    background: transparent;
    border: 1px solid #d1d2d3;
    color: #616061;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.btn-action-slack:hover {
    background: #f8f9fa;
    border-color: #b0b1b3;
}

.btn-action-slack.pinned {
    background: #667eea;
    border-color: #667eea;
    color: white;
}

.btn-action-slack.pinned:hover {
    background: #5568d3;
    border-color: #5568d3;
}

/* Removed old message wrapper styles - no longer used */

/* Avatar */
.message-avatar {
    flex-shrink: 0;
}

.avatar-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 13px;
}

.avatar-image {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    object-position: center;
}

/* Message Bubbles */
.message-bubble {
    border-radius: 18px;
    padding: 12px 16px;
    position: relative;
    word-wrap: break-word;
    max-width: 100%;
}

.message-bubble-other {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 18px 18px 18px 4px;
}

.message-bubble-own {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border-radius: 18px 18px 4px 18px;
}

/* Message Sender Name (only for other users) */
.message-sender-name {
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
    color: #667eea;
}

.message-sender-own {
    justify-content: flex-end;
    color: #fff;
}

.organizer-badge {
    display: inline-block;
    background: #ffc107;
    color: #000;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 8px;
    text-transform: uppercase;
}

/* Message Text */
.message-text {
    font-size: 15px;
    line-height: 1.4;
    word-wrap: break-word;
}

.message-bubble-other .message-text {
    color: #333;
}

.message-bubble-own .message-text {
    color: #fff;
}

/* Removed old message-actions styles - no longer used */

/* Full-Screen Chat Input */
.trip-chat-input-fullscreen {
    padding: 12px 20px;
    /* Minimal bottom padding so input is flush with keyboard */
    padding-bottom: 12px;
    /* Handle left/right safe areas for landscape mode on iPhone 16 Pro */
    padding-left: max(20px, env(safe-area-inset-left));
    padding-right: max(20px, env(safe-area-inset-right));
    background: #fff;
    border-top: 1px solid #e0e0e0;
    border-radius: 0;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    /* Ensure input area stays at bottom without extra space */
    position: relative;
    z-index: 10;
    margin: 0;
    margin-bottom: 0 !important;
}

.chat-disabled-alert {
    background: #f8d7da;
    color: #721c24;
    padding: 12px;
    border-radius: 8px;
    font-size: 14px;
}

.typing-indicator {
    padding: 8px 12px;
    margin-bottom: 8px;
    background: #f3f4f6;
    border-radius: 6px;
    color: #666;
    font-size: 13px;
    font-style: italic;
    animation: fadeIn 0.2s ease-in;
}

.chat-input-form {
    display: flex;
    gap: 2px;
    align-items: center;
    position: relative;
    padding-right: 4px; /* Minimal padding - maximize input width */
}

.chat-emoji-btn {
    /* Emoji button disabled - hiding from UI */
    display: none !important;
}

.chat-emoji-btn:hover {
    background: rgba(102, 126, 234, 0.1);
}

.emoji-picker-popup {
    /* Emoji picker disabled - hiding from UI */
    display: none !important;
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 4px;
    padding: 12px;
    max-height: 250px;
    overflow-y: auto;
}

.emoji-item {
    background: transparent;
    border: none;
    font-size: 24px;
    padding: 8px;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.emoji-item:hover {
    background: rgba(102, 126, 234, 0.1);
    transform: scale(1.2);
}

.chat-input-field {
    flex: 1;
    border: 2px solid #e0e0e0;
    border-radius: 24px;
    padding: 12px 20px;
    /* CRITICAL: 16px font prevents Safari iOS auto-zoom on focus */
    font-size: 16px !important;
    line-height: 22px;
    outline: none;
    transition: border-color 0.2s;
    /* Auto-growing textarea (like Slack) */
    min-height: 44px;
    max-height: 120px;
    resize: none;
    overflow-y: auto;
    /* Prevent text size adjustment on orientation change */
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    /* Remove touch delay on Chrome mobile */
    touch-action: manipulation;
    /* Remove iOS default styling that can trigger zoom */
    -webkit-appearance: none;
    appearance: none;
    /* Ensure proper display for textarea */
    display: block;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    overflow-wrap: break-word;
    word-wrap: break-word;
}

.chat-input-field:focus {
    border-color: #667eea;
}

.chat-send-btn {
    /* iOS minimum touch target is 44px */
    min-width: 44px;
    min-height: 44px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    flex-shrink: 0;
    margin-right: 0; /* No extra margin - maximize input width */
    /* Remove 300ms touch delay on Chrome mobile */
    touch-action: manipulation;
    /* Remove blue highlight on tap */
    -webkit-tap-highlight-color: transparent;
}

.chat-send-btn:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* Pop animation when button becomes enabled (message typed) */
.chat-send-btn:not(:disabled) {
    animation: popIn 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.chat-send-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    transform: scale(0.85);
}

/* Active/pressed state for mobile tap feedback */
.chat-send-btn:active:not(:disabled) {
    transform: scale(0.95);
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.3);
}

@keyframes popIn {
    0% {
        transform: scale(0.7);
        opacity: 0.5;
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Scrollbar Styling - Full-Screen */
.trip-chat-messages-fullscreen::-webkit-scrollbar {
    width: 8px;
}

.trip-chat-messages-fullscreen::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.trip-chat-messages-fullscreen::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

.trip-chat-messages-fullscreen::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* Scrollbar Styling - Inline */
.trip-chat-messages-inline::-webkit-scrollbar {
    width: 6px;
}

.trip-chat-messages-inline::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.trip-chat-messages-inline::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.trip-chat-messages-inline::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* Chat Filter Button */
.chat-filter-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #fff;
    /* Larger touch target for mobile (iOS minimum is 44px) */
    min-width: 44px;
    min-height: 44px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    transition: all 0.2s;
    position: relative;
    /* Remove 300ms touch delay on Chrome mobile */
    touch-action: manipulation;
    /* Remove blue highlight on tap */
    -webkit-tap-highlight-color: transparent;
}

.chat-filter-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.chat-filter-btn.active {
    background: rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.5);
}

.filter-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ef4444;
    color: white;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

/* Filter Panel */
.chat-filter-panel {
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
    padding: 16px 20px;
    flex-shrink: 0;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.filter-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-weight: 600;
    color: #333;
}

.filter-count-badge {
    display: inline-block;
    margin-left: 8px;
    padding: 3px 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    animation: fadeIn 0.3s ease;
}

.filter-clear-btn {
    background: transparent;
    border: none;
    color: #667eea;
    cursor: pointer;
    font-size: 13px;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
}

.filter-clear-btn:hover {
    background: rgba(102, 126, 234, 0.1);
}

.filter-panel-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.filter-search-input {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    /* CRITICAL: 16px font prevents Safari iOS auto-zoom on focus */
    font-size: 16px !important;
    outline: none;
    transition: border-color 0.2s;
}

.filter-search-input:focus {
    border-color: #667eea;
}

.filter-loading-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    background: linear-gradient(135deg, #f0f4ff 0%, #e6eeff 100%);
    border-radius: 8px;
    color: #667eea;
    font-size: 14px;
    font-weight: 500;
    animation: fadeIn 0.3s ease;
}

.filter-loading-indicator i {
    font-size: 16px;
}

.filter-buttons {
    display: flex;
    gap: 8px;
    /* Horizontal scrollable pills */
    overflow-x: auto;
    overflow-y: hidden;
    flex-wrap: nowrap;
    /* Hide scrollbar but keep functionality */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
    /* Smooth scroll on mobile */
    -webkit-overflow-scrolling: touch;
    /* Padding for scroll area */
    padding-bottom: 4px;
}

/* Hide scrollbar for Chrome/Safari */
.filter-buttons::-webkit-scrollbar {
    display: none;
}

.filter-type-btn {
    /* Compact pill design */
    flex-shrink: 0;
    min-width: auto;
    padding: 8px 16px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 20px; /* More rounded for pill look */
    color: #666;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s;
    white-space: nowrap; /* Keep text on one line */
}

.filter-type-btn:hover {
    border-color: #667eea;
    color: #667eea;
    background: rgba(102, 126, 234, 0.05);
}

.filter-type-btn.active {
    border-color: #667eea;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.filter-type-btn i {
    font-size: 14px;
}

/* Image Lightbox */
.chat-lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 9999999999; /* Higher than fullscreen chat overlay (999999999) */
    display: flex !important;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease-out;
    padding: 20px;
}

.chat-lightbox-overlay.ng-hide {
    display: none !important;
}

.chat-lightbox-container {
    position: relative;
    max-width: 95vw;
    max-height: 95vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Counter at top */
.lightbox-counter {
    position: absolute;
    top: -60px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    color: #1a1a1a;
    padding: 8px 20px;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    border: 2px solid #e0e0e0;
    z-index: 10001;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.lightbox-close-btn {
    position: absolute;
    top: -60px;
    right: 0;
    background: white;
    border: 2px solid #e0e0e0;
    color: #333;
    width: 44px;
    height: 44px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 10001;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.lightbox-close-btn:hover {
    background: #f5f5f5;
    transform: scale(1.05);
}

.lightbox-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: white;
    border: 2px solid #e0e0e0;
    color: #333;
    width: 50px;
    height: 50px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 10001;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.lightbox-nav-btn:hover {
    background: #f5f5f5;
    transform: translateY(-50%) scale(1.05);
}

.lightbox-prev-btn {
    left: -70px;
}

.lightbox-next-btn {
    right: -70px;
}

.lightbox-media-wrapper {
    max-width: 100%;
    max-height: calc(95vh - 40px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-media-content {
    background: white;
    padding: 16px;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 100%;
    max-height: 100%;
}

/* Keep old name for backward compatibility */
.lightbox-image-wrapper {
    max-width: 100%;
    max-height: calc(90vh - 100px);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.lightbox-image {
    max-width: 100%;
    max-height: calc(95vh - 120px);
    object-fit: contain;
    border-radius: 4px;
    animation: scaleIn 0.3s ease-out;
    display: block;
}

.lightbox-video {
    max-width: calc(95vw - 120px);
    max-height: calc(95vh - 120px);
    border-radius: 4px;
    animation: scaleIn 0.3s ease-out;
    background: #000;
    display: block;
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.lightbox-info {
    text-align: center;
    color: white;
    max-width: 500px;
}

.lightbox-filename {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    word-break: break-word;
}

.lightbox-meta {
    display: flex;
    gap: 20px;
    justify-content: center;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
}

.lightbox-filename i {
    margin-right: 8px;
    opacity: 0.8;
}

/* Video preview overlay - shows expand icon on hover */
.attachment-video {
    position: relative;
}

.video-preview-overlay {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: auto;
    z-index: 10;
    cursor: pointer;
}

.attachment-video:hover .video-preview-overlay,
.pinned-attachment-video:hover .video-preview-overlay {
    opacity: 1;
}

.video-preview-overlay i {
    font-size: 14px;
}

/* Angular ng-cloak - Comprehensive FOUC Prevention */
[ng\:cloak], [ng-cloak], [data-ng-cloak], [x-ng-cloak], .ng-cloak, .x-ng-cloak {
    display: none !important;
}

/* Hide Angular expressions until compiled */
.ng-hide-add, .ng-hide-remove {
    display: block !important;
}

/* Prevent flash of chat sections during Angular initialization */
.trip-chat-wrapper[ng-controller] > div[ng-show]:not(.ng-hide),
.trip-chat-wrapper[ng-controller] > div[ng-if]:not(.ng-hide) {
    animation: fadeIn 0.15s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* MOBILE RESPONSIVE */
@media (max-width: 768px) {
    /* Inline Chat Mobile */
    .trip-chat-inline .trip-chat-card {
        max-height: 500px;
    }

    .trip-chat-header-inline {
        padding: 12px 16px;
    }

    .trip-chat-header-inline h4 {
        font-size: 16px;
    }

    .trip-chat-messages-inline {
        padding: 16px;
        gap: 12px;
        max-height: 350px;
        min-height: 250px;
    }

    /* btn-maximize now inherits the 44px size for better mobile touch targets */

    /* Full-Screen Chat Mobile */
    .trip-chat-fullscreen-overlay {
        padding: 0;
        margin: 0;
        /* Force overlay to match visible viewport on mobile */
        height: calc(var(--vh, 1vh) * 100) !important;
    }

    .trip-chat-fullscreen {
        max-width: 100%;
        /* Mobile: Use flex to fill overlay completely */
        flex: 1 !important;
        min-height: 0 !important;
        border-radius: 0;
        overflow: hidden !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    .trip-chat-header-fullscreen {
        border-radius: 0;
        padding: 16px 16px;
        /* Reduce padding on mobile for more space */
        padding-top: calc(12px + env(safe-area-inset-top));
        /* Ensure close button isn't cut off on right edge */
        padding-right: max(16px, env(safe-area-inset-right));
        padding-left: max(16px, env(safe-area-inset-left));
    }

    .trip-chat-header-fullscreen h4 {
        font-size: 18px;
        flex: 1;
        min-width: 0; /* Allow text truncation if needed */
    }

    /* Ensure close button stays visible on mobile */
    .chat-close-btn {
        flex-shrink: 0; /* Prevent button from shrinking */
        margin-left: 8px; /* Add space between title and button */
    }

    .trip-chat-messages-fullscreen {
        padding: 20px 16px 16px 16px; /* Extra top padding to prevent header overlap */
        gap: 12px;
    }

    .chat-message {
        max-width: 85%;
    }

    .avatar-circle {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }

    .avatar-image {
        width: 100%;
        height: 100%;
        object-fit: cover;
        object-position: center;
        border-radius: 50%;
    }

    .avatar-image-container {
        width: 32px;
        height: 32px;
    }

    .message-bubble {
        padding: 10px 14px;
    }

    .message-text {
        font-size: 14px;
    }

    .chat-input-field {
        /* CRITICAL: Keep 16px to prevent Safari iOS zoom */
        font-size: 16px !important;
        padding: 10px 16px;
        min-height: 44px;
        max-height: 100px;
    }

    /* Hide scrollbar on mobile for cleaner look */
    .trip-chat-messages-fullscreen::-webkit-scrollbar {
        display: none;
    }

    .trip-chat-messages-fullscreen {
        scrollbar-width: none;
    }

    .chat-send-btn {
        width: 44px;
        height: 44px;
    }

    .overlay-content h3 {
        font-size: 24px;
    }

    .overlay-content p {
        font-size: 14px;
    }

    .overlay-content .btn {
        font-size: 16px;
        padding: 12px 24px;
    }

    .trip-chat-messages-preview {
        max-height: 400px;
    }

    /* Filter mobile adjustments - horizontal scrollable pills */
    .chat-filter-panel {
        padding: 12px 16px;
    }

    .filter-panel-header {
        margin-bottom: 10px;
        font-size: 14px;
    }

    .filter-search-input {
        padding: 8px 12px;
    }

    .filter-buttons {
        /* Keep horizontal scrollable on mobile */
        gap: 6px;
    }

    .filter-type-btn {
        /* Slightly smaller padding on mobile */
        padding: 7px 14px;
        font-size: 13px;
    }

    .filter-type-btn i {
        font-size: 13px;
    }

    /* Lightbox mobile adjustments */
    .lightbox-counter {
        top: 10px;
        font-size: 14px;
        padding: 6px 16px;
    }

    .lightbox-close-btn {
        top: 10px;
        right: 10px;
        width: 40px;
        height: 40px;
    }

    .lightbox-nav-btn {
        width: 44px;
        height: 44px;
        font-size: 18px;
    }

    .lightbox-prev-btn {
        left: 10px;
    }

    .lightbox-next-btn {
        right: 10px;
    }

    .lightbox-media-content {
        padding: 12px;
    }

    .lightbox-image {
        max-height: calc(100vh - 100px);
    }

    .lightbox-video {
        max-width: calc(100vw - 64px);
        max-height: calc(100vh - 100px);
    }

    .lightbox-filename {
        font-size: 14px;
    }

    .lightbox-meta {
        font-size: 12px;
        gap: 12px;
    }
}

/* Tablet adjustments */
@media (min-width: 769px) and (max-width: 1024px) {
    .trip-chat-fullscreen {
        max-width: 700px;
        height: 85vh;
    }

    .chat-message {
        max-width: 75%;
    }

    .file-preview-item {
        min-width: 105px;
        max-width: 105px;
    }
}

/* Small screens (portrait tablets and large phones) */
@media (max-width: 576px) {
    .trip-chat-input-fullscreen {
        padding: 10px 12px;
        /* Minimal bottom padding to prevent gap when keyboard is open */
        padding-bottom: 4px;
        margin-bottom: 0 !important;
    }

    .trip-chat-input-inline {
        padding: 10px 12px;
        /* Fix for mobile keyboard hiding the input box */
        position: sticky;
        bottom: 0;
        /* Add safe area for keyboard suggestion bar - typical height ~40-50px */
        padding-bottom: max(10px, env(safe-area-inset-bottom));
        /* Ensure input stays above keyboard */
        z-index: 100;
        /* Prevent the input from moving when keyboard appears */
        transform: translateZ(0);
        -webkit-transform: translateZ(0);
    }

    .chat-file-previews {
        gap: 6px;
        padding: 0 0 8px 0;
    }

    .file-preview-item {
        min-width: 85px;
        max-width: 85px;
        padding: 5px;
        border-radius: 8px;
    }

    .file-preview-image,
    .file-preview-pdf {
        height: 55px;
    }

    .file-remove-btn {
        width: 20px;
        height: 20px;
        font-size: 10px;
    }
}

/* File Upload Styles */
.chat-file-btn {
    background: transparent;
    border: none;
    color: #667eea;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.2s;
    flex-shrink: 0;
    position: relative;
    z-index: 100;
}

.chat-file-btn:hover:not(:disabled) {
    background: rgba(102, 126, 234, 0.1);
}

.chat-file-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Poll Button Styles */
.chat-poll-btn {
    background: transparent;
    border: none;
    color: #667eea;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.2s;
    flex-shrink: 0;
    position: relative;
    z-index: 100;
}

.chat-poll-btn:hover:not(:disabled) {
    background: rgba(102, 126, 234, 0.1);
}

.chat-poll-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.chat-poll-btn i {
    pointer-events: none;
}

/* File Previews Area - Horizontal Carousel */
.chat-file-previews {
    display: flex;
    gap: 10px;
    padding: 0 0 12px 0;
    overflow-x: auto;
    overflow-y: hidden;
    flex-wrap: nowrap;
    margin-bottom: 0;
    flex-shrink: 0;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e0 transparent;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* Horizontal scrollbar styling */
.chat-file-previews::-webkit-scrollbar {
    height: 4px;
}

.chat-file-previews::-webkit-scrollbar-track {
    background: transparent;
}

.chat-file-previews::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 2px;
}

.chat-file-previews::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

.file-preview-item {
    position: relative;
    background: #ffffff;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 8px;
    min-width: 110px;
    max-width: 110px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.file-preview-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    border-color: #667eea;
}

.file-preview-item.uploading {
    opacity: 0.7;
    pointer-events: none;
}

.file-preview-item.upload-success {
    border-color: #10b981;
}

.file-preview-item.upload-error {
    border-color: #ef4444;
}

.file-remove-btn {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #ef4444;
    color: white;
    border: 2px solid white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: all 0.2s;
    z-index: 1;
}

.file-remove-btn:hover {
    background: #dc2626;
    transform: scale(1.1);
}

.file-preview-image {
    width: 100%;
    height: 70px;
    overflow: hidden;
    border-radius: 6px;
    background: #f8f9fa;
}

.file-preview-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.file-preview-pdf {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 70px;
    color: #ef4444;
    background: #fef2f2;
    border-radius: 6px;
}

.file-preview-video {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 70px;
    color: #667eea;
    background: #f0f4ff;
    border-radius: 6px;
}

.file-preview-name {
    font-size: 12px;
    color: #333;
    text-align: center;
    word-break: break-all;
    line-height: 1.3;
    max-height: 32px;
    overflow: hidden;
}

.file-preview-size {
    font-size: 11px;
    color: #666;
}

/* Upload Progress Bar */
.file-upload-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: #e5e7eb;
    border-radius: 0 0 12px 12px;
    overflow: hidden;
}

.file-upload-progress .progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    transition: width 0.3s ease;
    animation: progressPulse 1.5s ease-in-out infinite;
}

@keyframes progressPulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.8;
    }
}

/* Upload Overlay */
.upload-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    color: white;
    font-size: 24px;
}

.upload-overlay .fa-spinner {
    color: #fff;
}

.upload-overlay .fa-check {
    color: #10b981;
}

.upload-overlay .fa-exclamation-triangle {
    color: #ef4444;
}

/* Message Attachments */
.message-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.message-attachment {
    max-width: 100%;
}

.attachment-image-link {
    display: block;
    border-radius: 8px;
    overflow: hidden;
    max-width: 300px;
    transition: transform 0.2s;
}

.attachment-image-link:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.attachment-image {
    width: 100%;
    height: auto;
    display: block;
}

.attachment-pdf-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #f8f9fa;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    color: #333;
    text-decoration: none;
    transition: all 0.2s;
    max-width: 300px;
}

.attachment-pdf-link:hover {
    background: #fff;
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

.attachment-pdf-link i {
    color: #ef4444;
    flex-shrink: 0;
}

.attachment-filename {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    word-break: break-word;
}

.attachment-filesize {
    font-size: 12px;
    color: #666;
    white-space: nowrap;
}

/* Video attachment styles */
.attachment-video {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 500px;
}

.attachment-video-player {
    width: 100%;
    min-height: 250px;
    max-height: 400px;
    border-radius: 8px;
    background: #000;
    outline: none;
    object-fit: contain;
}

.attachment-video-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px 0;
}

/* Mobile adjustments for file uploads */
@media (max-width: 768px) {
    /* Horizontal carousel on mobile */
    .chat-file-previews {
        gap: 8px;
        padding: 0 0 10px 0;
    }

    .file-preview-item {
        min-width: 95px;
        max-width: 95px;
        padding: 6px;
        border-radius: 10px;
    }

    .file-preview-image,
    .file-preview-pdf {
        height: 65px;
    }

    .file-preview-name {
        font-size: 11px;
        max-height: 28px;
    }

    .file-preview-size {
        font-size: 10px;
    }

    .file-remove-btn {
        width: 22px;
        height: 22px;
        font-size: 11px;
        top: -6px;
        right: -6px;
    }

    .attachment-image-link {
        max-width: 100%;
    }

    .attachment-pdf-link {
        max-width: 100%;
        padding: 10px 12px;
        gap: 10px;
    }

    .attachment-video {
        max-width: 100%;
    }

    .attachment-video-player {
        max-height: 250px;
    }

    /* Adjust input container on mobile */
    .trip-chat-input-fullscreen {
        padding: 10px 16px;
        /* Minimal bottom padding to prevent gap on iPhone 16 Pro */
        padding-bottom: 4px;
        margin-bottom: 0 !important;
        /* Fix for mobile keyboard hiding the input box */
        position: sticky;
        bottom: 0;
        z-index: 100;
        transform: translateZ(0);
        -webkit-transform: translateZ(0);
    }

    .trip-chat-input-inline {
        padding: 12px 16px;
        /* Fix for mobile keyboard hiding the input box */
        position: sticky;
        bottom: 0;
        padding-bottom: max(12px, env(safe-area-inset-bottom));
        z-index: 100;
        transform: translateZ(0);
        -webkit-transform: translateZ(0);
    }

    /* Make buttons slightly smaller on mobile */
    .chat-file-btn,
    .chat-emoji-btn {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }

    .chat-send-btn {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }

    /* .chat-input-field font-size is already set to 16px in earlier media query to prevent iOS zoom */
    .chat-input-field {
        padding: 10px 14px;
    }
}

/* Dashboard Chat - Specific Styles */
/* Dashboard chat styles removed - now using shared partial with common chat styles */

/* Profile Picture Upload in Chat Header */
.user-profile-section {
    display: flex;
    align-items: center;
    margin-right: 12px;
}

.user-avatar-wrapper {
    position: relative;
    cursor: pointer;
}

.user-avatar {
    width: 36px;
    height: 36px;
    position: relative;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.3);
    transition: border-color 0.3s ease;
}

.user-avatar:hover {
    border-color: rgba(255, 255, 255, 0.8);
}

.user-avatar .avatar-circle {
    width: 100%;
    height: 100%;
    background: #667eea;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
}

.user-avatar .avatar-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.avatar-upload-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.user-avatar:hover .avatar-upload-overlay {
    opacity: 1;
}

.avatar-upload-overlay i {
    color: white;
    font-size: 16px;
}

/* Header Right Section */
.trip-chat-header-inline .header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Clickable avatar and user name (shared across all chat contexts) */
.message-avatar-slack.clickable-avatar {
    cursor: pointer;
    transition: opacity 0.2s ease, transform 0.2s ease;
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(102, 126, 234, 0.2);
}

.message-avatar-slack.clickable-avatar:hover {
    opacity: 0.8;
    transform: scale(1.05);
}

.message-avatar-slack.clickable-avatar:active {
    opacity: 0.7;
    transform: scale(0.98);
}

.message-sender-name-slack.clickable {
    cursor: pointer;
    text-decoration: underline;
    text-decoration-style: dotted;
    text-underline-offset: 2px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(102, 126, 234, 0.2);
}

.message-sender-name-slack.clickable:hover {
    color: #667eea;
    text-decoration-style: solid;
}

.message-sender-name-slack.clickable:active {
    color: #5a6fd8;
}

/* Network Status Banner */
.network-status-banner {
    text-align: center;
    padding: 10px 16px;
    background: #ff9800;
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    animation: slideDown 0.3s ease-out;
    flex-shrink: 0;
    z-index: 10;
}

.network-status-banner i {
    font-size: 14px;
    animation: pulse 2s ease-in-out infinite;
}

/* Pull-to-Refresh Container */
.pull-to-refresh-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
    pointer-events: none;
    transition: transform 0.4s cubic-bezier(0.4, 0.0, 0.2, 1),
                opacity 0.3s ease-out;
    will-change: transform, opacity;
}

/* Pull-to-Refresh Indicator */
.pull-refresh-indicator {
    text-align: center;
    padding: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border-radius: 0 0 12px 12px;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    pointer-events: none; /* Ensure it doesn't block clicks on header buttons */
}

.pull-refresh-indicator i {
    font-size: 16px;
    transition: transform 0.1s linear;
    will-change: transform;
}

.pull-refresh-indicator span {
    font-size: 13px;
    font-weight: 500;
}

/* Dim messages slightly during pull-to-refresh load */
.trip-chat-messages-fullscreen.loading-older {
    opacity: 0.7;
    transition: opacity 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Avatar Skeleton Loader */
.avatar-image-container {
    position: relative;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
}

.avatar-skeleton {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 50%;
    z-index: 1;
}

.avatar-image {
    position: relative;
    z-index: 2;
    opacity: 0;
    transition: opacity 0.3s ease-in;
}

.avatar-image.loaded {
    opacity: 1;
}

.avatar-image.loaded ~ .avatar-skeleton {
    display: none;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* ================================================
   CHAT LOGIN MODAL STYLES
   ================================================ */

/* Login Modal Overlay */
.chat-login-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    z-index: 9999999999; /* Higher than fullscreen chat overlay (999999999) */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s ease-out;
}

/* Login Modal Container */
.chat-login-modal {
    background: #fff;
    border-radius: 12px;
    max-width: 440px;
    width: 100%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    position: relative;
    animation: slideUpModal 0.3s ease-out;
}

@keyframes slideUpModal {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Close Button */
.chat-login-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: transparent;
    border: none;
    color: #999;
    font-size: 24px;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
    z-index: 1;
}

.chat-login-modal-close:hover {
    background: #f0f0f0;
    color: #333;
}

/* Modal Content */
.chat-login-modal-content {
    padding: 40px 32px 32px 32px;
}

/* Modal Header */
.chat-login-modal-header {
    text-align: center;
    margin-bottom: 32px;
}

.chat-login-modal-header i {
    font-size: 48px;
    color: #667eea;
    margin-bottom: 16px;
}

.chat-login-modal-header h3 {
    margin: 0 0 8px 0;
    font-size: 24px;
    font-weight: 600;
    color: #333;
}

.chat-login-modal-header p {
    margin: 0;
    font-size: 14px;
    color: #666;
}

/* Login Form */
.chat-login-form .form-group {
    margin-bottom: 20px;
}

.chat-login-form label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

/* CRITICAL: Input font-size must be 16px or larger to prevent mobile zoom */
.chat-login-form .form-control {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px !important; /* Prevent mobile zoom */
    line-height: 1.5;
    color: #333;
    background: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
    -webkit-appearance: none; /* Remove iOS default styling */
    appearance: none;
}

.chat-login-form .form-control:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.chat-login-form .form-control::placeholder {
    color: #999;
    font-size: 16px; /* Prevent mobile zoom */
}

/* Password Toggle */
.password-input-wrapper {
    position: relative;
}

.password-input-wrapper .form-control {
    padding-right: 50px;
}

.password-toggle-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    padding: 8px;
    font-size: 18px;
    line-height: 1;
    transition: color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.password-toggle-btn:hover {
    color: #667eea;
}

.password-toggle-btn:focus {
    outline: none;
}

.password-toggle-btn:active {
    transform: translateY(-50%) scale(0.95);
}

/* Error Alert */
.chat-login-form .alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-login-form .alert-danger {
    background: #fee;
    color: #c33;
    border: 1px solid #fcc;
}

.chat-login-form .alert i {
    font-size: 16px;
}

/* Submit Button */
.chat-login-form .btn {
    width: 100%;
    padding: 14px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.chat-login-form .btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}

.chat-login-form .btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.chat-login-form .btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.chat-login-form .btn i {
    font-size: 16px;
}

/* Modal Footer */
.chat-login-modal-footer {
    margin-top: 20px;
    text-align: center;
}

.chat-login-modal-footer a {
    color: #667eea;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
}

.chat-login-modal-footer a:hover {
    text-decoration: underline;
}

/* Mobile Optimizations */
@media (max-width: 576px) {
    .chat-login-modal-overlay {
        padding: 16px;
    }

    .chat-login-modal-content {
        padding: 32px 24px 24px 24px;
    }

    .chat-login-modal-header h3 {
        font-size: 20px;
    }

    .chat-login-modal-header i {
        font-size: 40px;
    }

    /* Ensure inputs stay 16px on mobile - CRITICAL for no zoom */
    .chat-login-form .form-control {
        font-size: 16px !important;
        padding: 14px 16px; /* Slightly larger touch target */
    }

    .chat-login-form .btn {
        padding: 16px 24px; /* Larger touch target */
    }

    /* Pinned Messages - Mobile */
    .pinned-message {
        padding: 12px 12px; /* Reduce horizontal padding on mobile */
        gap: 8px; /* Slightly smaller gap */
    }

    .btn-unpin {
        padding: 10px 12px; /* Larger touch target on mobile */
        font-size: 14px; /* Slightly bigger font */
        min-height: 44px; /* iOS recommends 44x44 for touch targets */
        gap: 8px; /* More space between icon and text */
    }

    .btn-unpin .fa-thumb-tack {
        font-size: 16px; /* Bigger icon on mobile */
    }
}

/* Delete Message Confirmation Modal - Override inline styles */
.delete-modal-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(0, 0, 0, 0.6) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 99999 !important; /* Higher than chat overlays */
    padding: 20px !important;
}

.delete-modal-content {
    background: white !important;
    border-radius: 16px !important;
    padding: 32px !important;
    max-width: 420px !important;
    width: 100% !important;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3) !important;
    text-align: center !important;
    position: relative !important;
    margin: auto !important;
}

.delete-modal-icon {
    width: 64px !important;
    height: 64px !important;
    margin: 0 auto 20px !important;
    border-radius: 50% !important;
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.delete-modal-icon i {
    font-size: 28px !important;
    color: #ef4444 !important;
}

.delete-modal-title {
    font-size: 24px !important;
    font-weight: 700 !important;
    color: #1a1a1a !important;
    margin: 0 0 16px !important;
}

.delete-modal-message {
    font-size: 16px !important;
    color: #666 !important;
    margin: 0 0 32px !important;
    line-height: 1.6 !important;
}

.delete-modal-actions {
    display: flex !important;
    gap: 12px !important;
    justify-content: center !important;
    flex-wrap: wrap !important;
}

.btn-delete-cancel,
.btn-delete-confirm {
    padding: 14px 32px !important;
    border-radius: 10px !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    border: none !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    outline: none !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
    min-width: 120px !important;
}

.btn-delete-cancel {
    background: #f5f5f5 !important;
    color: #666 !important;
}

.btn-delete-cancel:hover {
    background: #e5e5e5 !important;
    color: #333 !important;
}

.btn-delete-confirm {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%) !important;
    color: white !important;
}

.btn-delete-confirm:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%) !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3) !important;
}

/* Mobile adjustments for delete modal */
@media (max-width: 576px) {
    .delete-modal-content {
        padding: 24px !important;
        max-width: 90% !important;
    }

    .delete-modal-title {
        font-size: 20px !important;
    }

    .delete-modal-message {
        font-size: 14px !important;
        margin: 0 0 24px !important;
    }

    .delete-modal-actions {
        flex-direction: column !important;
        gap: 10px !important;
    }

    .btn-delete-cancel,
    .btn-delete-confirm {
        width: 100% !important;
        padding: 16px 24px !important;
        min-height: 48px !important; /* Better touch target */
    }
}

/* ===================================
   MESSAGE REACTIONS
   =================================== */

.message-reactions-container {
    margin-top: 4px;
    position: relative;
}

.reaction-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.reaction-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: #f8f9fa;
    border: 1px solid #e1e4e8;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 14px;
    line-height: 1;
}

.reaction-badge:hover {
    background: #e9ecef;
    border-color: #cbd1d8;
    transform: scale(1.05);
}

.reaction-badge.user-reacted {
    background: #E3F2FD;
    border-color: #2196F3;
    color: #1976D2;
}

.reaction-badge.user-reacted:hover {
    background: #BBDEFB;
    border-color: #1976D2;
}

.reaction-emoji {
    font-size: 16px;
    line-height: 1;
    font-family: "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji", sans-serif;
}

.reaction-count {
    font-size: 12px;
    font-weight: 600;
    color: #495057;
    min-width: 12px;
    text-align: center;
}

.reaction-badge.user-reacted .reaction-count {
    color: #1976D2;
}

.add-reaction-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    background: transparent;
    border: 1px solid #e1e4e8;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 14px;
    color: #6c757d;
}

.add-reaction-btn:hover {
    background: #f8f9fa;
    border-color: #cbd1d8;
    color: #495057;
    transform: scale(1.1);
}

.add-reaction-btn:active {
    transform: scale(0.95);
}

/* Desktop hover action bar */
.message-action-bar {
    position: absolute;
    top: -8px;
    right: 8px;
    display: none;
    align-items: center;
    gap: 4px;
    padding: 4px;
    background: white;
    border: 1px solid #e1e4e8;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 1050;
}

/* Only show on desktop hover */
@media (min-width: 769px) {
    .chat-message-wrapper-slack:hover .message-action-bar {
        display: flex;
    }
}

.message-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 14px;
    color: #6c757d;
}

.message-action-btn:hover {
    background: #f8f9fa;
    color: #495057;
}

/* Hide add reaction button on mobile, show on desktop */
@media (max-width: 768px) {
    .add-reaction-btn {
        display: none !important;
    }

    /* Mobile long-press indicator */
    .long-press-indicator {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 60px;
        height: 60px;
        border: 3px solid rgba(101, 119, 204, 0.5);
        border-radius: 50%;
        animation: longPressRipple 0.5s ease-out;
        pointer-events: none;
        z-index: 1000;
    }

    @keyframes longPressRipple {
        0% {
            width: 20px;
            height: 20px;
            opacity: 1;
        }
        100% {
            width: 60px;
            height: 60px;
            opacity: 0;
        }
    }
}

/* Reaction Picker */
.reaction-picker {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 4px;
    padding: 8px;
    background: white;
    border: 1px solid #e1e4e8;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    gap: 4px;
    z-index: 1000;
    animation: slideDown 0.15s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.reaction-picker-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    font-size: 20px;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.12s ease;
    font-family: "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji", sans-serif;
}

.reaction-picker-item:hover {
    background: #f8f9fa;
    transform: scale(1.2);
}

.reaction-picker-item:active {
    transform: scale(0.95);
}

/* Mobile adjustments for reactions */
@media (max-width: 576px) {
    .reaction-badge {
        font-size: 13px;
        padding: 3px 8px;
    }

    .reaction-emoji {
        font-size: 15px;
    }

    .reaction-count {
        font-size: 11px;
    }

    .add-reaction-btn {
        width: 26px;
        height: 26px;
        font-size: 13px;
    }

    .reaction-picker {
        padding: 6px;
    }

    .reaction-picker-item {
        width: 32px;
        height: 32px;
        font-size: 18px;
    }
}

/* ========================================
   POLLS FEATURE STYLES
   ======================================== */

/* ===== POLL CONTAINER ===== */
.poll-container {
    background: #ffffff !important;
    background-color: #ffffff !important;
    border: 1px solid #e1e8ed;
    border-radius: 12px;
    padding: 16px;
    margin: 0; /* No margin - parent gap handles spacing */
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    transition: all 0.2s ease;
    position: relative;
    z-index: 1000 !important;  /* Increased z-index for better layering */
    opacity: 1 !important;
    isolation: isolate;
    pointer-events: auto !important;  /* Ensure polls are clickable */
}

/* Force ALL elements inside polls to be 100% opaque and clickable */
.poll-container *,
.poll-container *::before,
.poll-container *::after {
    opacity: 1 !important;
}

/* Ensure all poll interactive elements are clickable */
.poll-container button,
.poll-container input,
.poll-container select,
.poll-container a,
.poll-container [ng-click] {
    pointer-events: auto !important;
    cursor: pointer;
    position: relative;
    z-index: 1002 !important;
}

/* Ensure polls are opaque in fullscreen mode */
.trip-chat-fullscreen .poll-container,
.trip-chat-messages-fullscreen .poll-container {
    background: #ffffff !important;
    background-color: #ffffff !important;
    opacity: 1 !important;
    z-index: 1000 !important;  /* Match increased z-index */
    isolation: isolate;
    pointer-events: auto !important;  /* Ensure clickable in fullscreen */
}

.trip-chat-fullscreen .poll-container *,
.trip-chat-fullscreen .poll-container *::before,
.trip-chat-fullscreen .poll-container *::after,
.trip-chat-messages-fullscreen .poll-container *,
.trip-chat-messages-fullscreen .poll-container *::before,
.trip-chat-messages-fullscreen .poll-container *::after {
    opacity: 1 !important;
}

.poll-container:hover {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

.poll-container.pinned {
    border-left: 4px solid #1da1f2;
    background: #f7fcff !important;
    background-color: #f7fcff !important;
    opacity: 1 !important;
    z-index: 1001 !important;  /* Slightly higher for pinned polls */
    pointer-events: auto !important;
}

/* Ensure pinned polls are opaque in fullscreen mode */
.trip-chat-fullscreen .poll-container.pinned,
.trip-chat-messages-fullscreen .poll-container.pinned {
    background: #f7fcff !important;
    background-color: #f7fcff !important;
    opacity: 1 !important;
    z-index: 1001 !important;  /* Match pinned z-index */
    pointer-events: auto !important;
}

.poll-container.official {
    border-left: 4px solid #ffa500;
    z-index: 1001 !important;  /* Match pinned z-index */
    pointer-events: auto !important;
}

.poll-container.closed {
    opacity: 1 !important;
    background: #f5f8fa !important;
    background-color: #f5f8fa !important;
    z-index: 1000 !important;  /* Match base z-index */
    pointer-events: auto !important;
}

/* Ensure closed polls are opaque in fullscreen mode */
.trip-chat-fullscreen .poll-container.closed,
.trip-chat-messages-fullscreen .poll-container.closed {
    background: #f5f8fa !important;
    background-color: #f5f8fa !important;
    opacity: 1 !important;
    z-index: 1000 !important;  /* Match base z-index */
    pointer-events: auto !important;
}

/* ===== POLL HEADER ===== */
.poll-header {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    gap: 8px;
    flex-wrap: wrap;
}

.poll-icon {
    font-size: 20px;
    color: #1da1f2;
}

.poll-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    line-height: 1;
}

.poll-badge.organizer {
    background: #ffa500;
    color: white;
}

.poll-badge.pinned {
    background: #1da1f2;
    color: white;
}

.poll-badge.official {
    background: #ff6b6b;
    color: white;
}

.poll-badge.closed {
    background: #95a5a6;
    color: white;
}

/* ===== POLL TITLE & META ===== */
.poll-title {
    font-size: 18px;
    font-weight: 600;
    color: #14171a;
    margin-bottom: 6px;
    line-height: 1.4;
}

/* Inline title for pill view (mobile only) */
.poll-title-inline {
    display: none;
}

.poll-meta {
    font-size: 13px;
    color: #657786;
    margin-bottom: 4px;
}

.poll-meta strong {
    color: #14171a;
    font-weight: 600;
}

.poll-description {
    font-size: 14px;
    color: #14171a;
    margin-bottom: 16px;
    line-height: 1.5;
    white-space: pre-wrap;
}

.poll-deadline {
    font-size: 13px;
    color: #657786;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.poll-deadline.urgent {
    color: #e0245e;
    font-weight: 600;
}

.poll-deadline i {
    font-size: 14px;
}

/* ===== POLL OPTIONS ===== */
.poll-options {
    margin-bottom: 16px;
}

.poll-option {
    position: relative;
    margin-bottom: 10px;
    border: 2px solid #e1e8ed;
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.15s ease;
    overflow: hidden;
    z-index: 1002 !important;  /* Ensure poll options are clickable */
    pointer-events: auto !important;
    background: white !important;
    background-color: white !important;
    opacity: 1 !important;
}

.poll-option:hover {
    border-color: #1da1f2;
    background: #f7fcff !important;
    background-color: #f7fcff !important;
}

/* Ensure poll options are opaque in fullscreen mode */
.trip-chat-fullscreen .poll-option,
.trip-chat-messages-fullscreen .poll-option {
    background: white !important;
    background-color: white !important;
    opacity: 1 !important;
}

.trip-chat-fullscreen .poll-option:hover,
.trip-chat-messages-fullscreen .poll-option:hover {
    background: #f7fcff !important;
    background-color: #f7fcff !important;
}

.poll-option.selected {
    border-color: #1da1f2;
    background: #e8f5fe !important;
    background-color: #e8f5fe !important;
    opacity: 1 !important;
}

.poll-option.winner {
    border-color: #17bf63;
    background: #e6f9f0 !important;
    background-color: #e6f9f0 !important;
    opacity: 1 !important;
}

/* Ensure selected and winner poll options are opaque in fullscreen mode */
.trip-chat-fullscreen .poll-option.selected,
.trip-chat-messages-fullscreen .poll-option.selected {
    background: #e8f5fe !important;
    background-color: #e8f5fe !important;
    opacity: 1 !important;
}

.trip-chat-fullscreen .poll-option.winner,
.trip-chat-messages-fullscreen .poll-option.winner {
    background: #e6f9f0 !important;
    background-color: #e6f9f0 !important;
    opacity: 1 !important;
}

.poll-option.disabled {
    cursor: not-allowed;
    opacity: 1 !important;
    filter: grayscale(30%);
    background: #f5f5f5 !important;
    background-color: #f5f5f5 !important;
}

/* Ensure disabled poll options are opaque in fullscreen mode */
.trip-chat-fullscreen .poll-option.disabled,
.trip-chat-messages-fullscreen .poll-option.disabled {
    opacity: 1 !important;
    background: #f5f5f5 !important;
    background-color: #f5f5f5 !important;
}

/* Vote bar background */
.vote-bar {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: linear-gradient(90deg, #e8f5fe 0%, #cfe9fc 100%);
    z-index: 0;
    transition: width 0.4s ease;
}

.poll-option.winner .vote-bar {
    background: linear-gradient(90deg, #e6f9f0 0%, #b8f0d6 100%);
}

/* Option content */
.poll-option-content {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 12px;
}

.poll-option-checkbox,
.poll-option-radio {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.option-image {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
}

.option-text {
    flex: 1;
    font-size: 15px;
    font-weight: 500;
    color: #14171a;
}

.vote-stats {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.vote-count {
    font-size: 14px;
    font-weight: 600;
    color: #657786;
}

.vote-percentage {
    font-size: 14px;
    font-weight: 600;
    color: #1da1f2;
}

.you-voted {
    display: inline-block;
    padding: 2px 6px;
    background: #1da1f2;
    color: white;
    font-size: 11px;
    font-weight: 600;
    border-radius: 4px;
}

.winner-icon {
    color: #17bf63;
    font-size: 16px;
}

/* ===== RANKED CHOICE ===== */
.poll-option-ranked {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    margin-bottom: 10px;
    background: white;
    border: 2px solid #e1e8ed;
    border-radius: 8px;
    cursor: move;
    transition: all 0.15s ease;
}

.poll-option-ranked:hover {
    border-color: #1da1f2;
    background: #f7fcff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.poll-option-ranked.ui-sortable-helper {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transform: rotate(2deg);
}

.rank-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: #1da1f2;
    color: white;
    font-weight: 600;
    border-radius: 50%;
    font-size: 14px;
    flex-shrink: 0;
}

.drag-handle {
    color: #657786;
    cursor: grab;
    font-size: 18px;
    flex-shrink: 0;
}

.drag-handle:active {
    cursor: grabbing;
}

/* ===== POLL RESULTS ===== */
.poll-results {
    margin-bottom: 16px;
    padding: 12px;
    background: #f5f8fa !important;
    background-color: #f5f8fa !important;
    border-radius: 8px;
    opacity: 1 !important;
}

/* Ensure poll results are opaque in fullscreen mode */
.trip-chat-fullscreen .poll-results,
.trip-chat-messages-fullscreen .poll-results {
    background: #f5f8fa !important;
    background-color: #f5f8fa !important;
    opacity: 1 !important;
}

.poll-stat {
    display: inline-block;
    margin-right: 20px;
    margin-bottom: 8px;
    font-size: 13px;
    color: #657786;
}

.poll-stat strong {
    color: #14171a;
    font-weight: 600;
}

.poll-stat i {
    margin-right: 4px;
    color: #657786;
}

.majority-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: #17bf63;
    color: white;
    font-size: 12px;
    font-weight: 600;
    border-radius: 4px;
    margin-left: 8px;
}

.majority-indicator.not-reached {
    background: #657786;
}

.non-voters {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e1e8ed;
    font-size: 13px;
    color: #657786;
}

.non-voters strong {
    color: #14171a;
}

.non-voters-list {
    margin-top: 6px;
    font-size: 12px;
    color: #657786;
}

/* ===== POLL ACTIONS ===== */
.poll-actions {
    display: flex;
    gap: 8px;
    padding-top: 12px;
    border-top: 1px solid #e1e8ed;
    flex-wrap: wrap;
}

.poll-action-btn {
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 600;
    position: relative;
    z-index: 1002 !important;  /* Ensure buttons are above poll container */
    pointer-events: auto !important;
    color: #657786;
    background: transparent;
    border: 1px solid #e1e8ed;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.poll-action-btn:hover {
    color: #1da1f2;
    border-color: #1da1f2;
    background: #f7fcff;
}

.poll-action-btn.danger:hover {
    color: #e0245e;
    border-color: #e0245e;
    background: #ffeef3;
}

.poll-action-btn.primary {
    background: #1da1f2;
    color: white;
    border-color: #1da1f2;
}

.poll-action-btn.primary:hover {
    background: #1a91da;
}

.poll-action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ===== POLL CREATION MODAL ===== */
.poll-creation-modal {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(0, 0, 0, 0.75) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 9999999999 !important; /* Higher than fullscreen chat overlay (999999999) */
    padding: 20px !important;
}

/* Ensure poll modal is on top even in fullscreen mode */
body.chat-fullscreen-active .poll-creation-modal {
    z-index: 9999999999 !important; /* Ensure it's on top of fullscreen chat */
}

.poll-modal-content {
    background: white !important;
    border-radius: 12px !important;
    max-width: 600px !important;
    width: 100% !important;
    max-height: 90vh !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2) !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important; /* No scrollbar on modal itself */
    position: relative !important;
    z-index: 9999999999 !important; /* Match parent z-index */
}

.poll-modal-header {
    font-size: 20px;
    font-weight: 600;
    padding: 24px 24px 20px 24px;
    color: #14171a;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0; /* Don't shrink header */
    border-bottom: 1px solid #e0e0e0;
}

.poll-modal-body {
    flex: 1; /* Take up remaining space */
    overflow-y: auto; /* Scroll only the form content */
    overflow-x: hidden;
    padding: 24px;
    min-height: 0; /* Important for flexbox scrolling */
}

/* Hide scrollbar for cleaner look while maintaining functionality */
.poll-modal-body::-webkit-scrollbar {
    width: 0px;
    background: transparent;
}

/* Firefox scrollbar hiding */
.poll-modal-body {
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

.poll-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #657786;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.15s ease;
}

.poll-modal-close:hover {
    background: #f5f8fa;
    color: #14171a;
}

.poll-form-group {
    margin-bottom: 20px;
}

.poll-form-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
    color: #14171a;
}

.poll-form-label .optional {
    font-weight: 400;
    color: #657786;
    font-size: 12px;
}

.poll-form-input,
.poll-form-textarea,
.poll-form-select {
    width: 100%;
    padding: 10px 12px;
    font-size: 14px;
    border: 2px solid #e1e8ed;
    border-radius: 6px;
    transition: border-color 0.15s ease;
    font-family: inherit;
}

.poll-form-input:focus,
.poll-form-textarea:focus,
.poll-form-select:focus {
    outline: none;
    border-color: #1da1f2;
}

.poll-form-textarea {
    min-height: 80px;
    resize: vertical;
}

.poll-form-checkbox-group {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.poll-form-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.poll-form-checkbox-label {
    font-size: 14px;
    color: #14171a;
    cursor: pointer;
}

/* Poll type selector */
.poll-type-selector {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.poll-type-option {
    padding: 16px 12px;
    border: 2px solid #e1e8ed;
    border-radius: 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.15s ease;
}

.poll-type-option:hover {
    border-color: #1da1f2;
    background: #f7fcff;
}

.poll-type-option.selected {
    border-color: #1da1f2;
    background: #e8f5fe;
}

.poll-type-option i {
    font-size: 24px;
    color: #1da1f2;
    margin-bottom: 8px;
}

.poll-type-option .type-name {
    font-size: 14px;
    font-weight: 600;
    color: #14171a;
    margin-bottom: 4px;
}

.poll-type-option .type-desc {
    font-size: 12px;
    color: #657786;
}

/* Poll options input */
.poll-option-item {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
    align-items: flex-start;
}

.poll-option-item input {
    flex: 1;
}

.poll-option-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 38px;
    background: #f5f8fa;
    color: #657786;
    font-weight: 600;
    border-radius: 6px;
    font-size: 14px;
    flex-shrink: 0;
}

.btn-upload-image {
    padding: 8px 12px;
    background: #f5f8fa;
    color: #1da1f2;
    border: 2px solid #e1e8ed;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
    transition: all 0.15s ease;
}

.btn-upload-image:hover {
    background: #e8f5fe;
    border-color: #1da1f2;
}

.btn-remove-option {
    padding: 8px 12px;
    background: #e0245e;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
    transition: all 0.15s ease;
}

.btn-remove-option:hover {
    background: #c91d50;
}

.btn-add-option {
    width: 100%;
    padding: 10px;
    background: #f5f8fa;
    color: #1da1f2;
    border: 2px dashed #1da1f2;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.15s ease;
}

.btn-add-option:hover {
    background: #e8f5fe;
}

.poll-modal-actions {
    display: flex;
    gap: 12px;
    padding: 20px 24px 24px 24px;
    border-top: 1px solid #e0e0e0;
    flex-shrink: 0; /* Don't shrink actions */
    background: white; /* Ensure white background */
}

.btn-modal-submit {
    flex: 1;
    padding: 12px 24px;
    background: #1da1f2;
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-modal-submit:hover {
    background: #1a91da;
}

.btn-modal-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-modal-cancel {
    padding: 12px 24px;
    background: transparent;
    color: #657786;
    border: 2px solid #e1e8ed;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-modal-cancel:hover {
    background: #f5f8fa;
}

/* ===== TIE BREAKER ===== */
.tie-alert {
    padding: 12px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 6px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.tie-alert i {
    font-size: 20px;
    color: #ffc107;
}

.tie-alert-text {
    flex: 1;
    font-size: 14px;
    color: #856404;
    font-weight: 600;
}

.tie-option {
    margin-bottom: 8px;
}

.btn-select-winner {
    width: 100%;
    padding: 12px;
    background: white;
    border: 2px solid #e1e8ed;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: #14171a;
    transition: all 0.15s ease;
}

.btn-select-winner:hover {
    border-color: #17bf63;
    background: #e6f9f0;
    color: #17bf63;
}

/* ===== LOADING STATE ===== */
.poll-loading {
    text-align: center;
    padding: 20px;
    color: #657786;
}

.poll-loading i {
    font-size: 24px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ===== POLLS STRIP - HORIZONTAL SCROLLABLE ===== */
.polls-strip-container {
    display: block;
    background: #f5f7fb;
    border-bottom: 1px solid #e1e8ed;
    position: relative;
    z-index: 90;
    flex-shrink: 0;
}

/* Polls strip header with collapse toggle */
.polls-strip-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    background: #e8ecf0;
    border-bottom: 1px solid #d1d8e0;
    cursor: pointer;
    transition: background 0.2s;
    user-select: none;
}

.polls-strip-header:hover {
    background: #dde3ea;
}

.polls-strip-title {
    font-size: 14px;
    font-weight: 600;
    color: #14171a;
    display: flex;
    align-items: center;
    gap: 8px;
}

.polls-strip-title i {
    color: #667eea;
    font-size: 16px;
}

.polls-toggle-btn {
    color: #657786;
    font-size: 16px;
    padding: 4px;
    transition: all 0.2s;
}

.polls-strip-header:hover .polls-toggle-btn {
    color: #14171a;
}

.polls-strip-content {
    display: flex;
    gap: 12px;
    padding: 12px 24px;
    overflow-x: auto;
    overflow-y: visible;
    scrollbar-width: thin;
    scroll-behavior: smooth;
}

/* Desktop: Show polls expanded in strip */
.polls-strip-content .poll-container {
    flex-shrink: 0;
    min-width: 350px;
    max-width: 500px;
}

/* Desktop: Hide poll header (it's only for mobile pills) */
.polls-strip-content .poll-container .poll-header {
    display: none;
}

/* Desktop: Hide inline title (it's only for mobile pills) */
.polls-strip-content .poll-container .poll-title-inline {
    display: none;
}

@media (max-width: 768px) {
    /* Hide header on mobile (we use pills instead) */
    .polls-strip-header {
        display: none;
    }

    .polls-strip-container {
        padding: 8px 0;
    }

    .polls-strip-content {
        gap: 8px;
        padding: 0 16px;
        /* Always show on mobile */
        display: flex !important;
        /* Hide scrollbar on mobile */
        scrollbar-width: none; /* Firefox */
        -ms-overflow-style: none; /* IE/Edge */
        -webkit-overflow-scrolling: touch;
    }

    .polls-strip-content::-webkit-scrollbar {
        display: none; /* Chrome/Safari */
    }

    /* Mobile: Reset desktop min-width */
    .polls-strip-content .poll-container {
        min-width: auto;
        max-width: none;
    }

    /* Pills in strip layout horizontally when collapsed */
    .polls-strip-content .poll-container.mobile-collapsed {
        flex-shrink: 0; /* Prevent pills from shrinking */
        display: inline-block;
        margin: 0;
    }

    /* Hide all collapsed pills when ANY poll is expanded */
    .polls-strip-content:has(.poll-container:not(.mobile-collapsed)) .poll-container.mobile-collapsed {
        display: none;
    }

    /* Backdrop for expanded polls */
    .polls-strip-content .poll-container:not(.mobile-collapsed)::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.4);
        z-index: -1;
        animation: fadeIn 0.2s ease-out;
    }

    /* Expanded poll - fixed overlay that covers chat area */
    .polls-strip-content .poll-container:not(.mobile-collapsed) {
        position: fixed;
        left: 16px;
        right: 16px;
        top: 100px; /* Below header */
        bottom: 80px; /* Above message input */
        z-index: 95; /* Above strip but below header */
        background: #fff !important;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
        border-radius: 12px;
        border: 1px solid #e1e8ed;
        overflow-y: auto;
        max-width: calc(100vw - 32px);
        animation: slideInUp 0.2s ease-out;
        padding: 16px;
    }

    /* Show full poll content when expanded in strip */
    .polls-strip-content .poll-container:not(.mobile-collapsed) .poll-title {
        display: block !important;
    }

    .polls-strip-content .poll-container:not(.mobile-collapsed) .poll-meta {
        display: block !important;
    }

    .polls-strip-content .poll-container:not(.mobile-collapsed) .poll-description {
        display: block !important;
    }

    /* Hide inline title when expanded */
    .polls-strip-content .poll-container:not(.mobile-collapsed) .poll-title-inline {
        display: none !important;
    }

    /* Make expanded poll header look like regular poll header */
    .polls-strip-content .poll-container:not(.mobile-collapsed) .poll-header {
        display: flex !important;
        background: transparent !important;
        padding: 0 !important;
        margin-bottom: 12px !important;
        gap: 8px !important;
        box-shadow: none !important;
        border-radius: 0 !important;
    }

    .polls-strip-content .poll-container:not(.mobile-collapsed) .poll-icon {
        color: #667eea !important;
        font-size: 20px !important;
    }

    .polls-strip-content .poll-container:not(.mobile-collapsed) .poll-badge {
        font-size: 11px !important;
        padding: 4px 8px !important;
    }

    @keyframes slideInUp {
        from {
            transform: translateY(30px);
            opacity: 0;
        }
        to {
            transform: translateY(0);
            opacity: 1;
        }
    }

    @keyframes fadeIn {
        from { opacity: 0; }
        to { opacity: 1; }
    }
}

/* ===== MOBILE RESPONSIVE ===== */
@media (max-width: 768px) {
    .poll-container {
        padding: 8px;
        margin: 0; /* No margin - parent gap handles spacing */
        border-radius: 8px;
    }

    /* PILL VIEW - Compact collapsed state on mobile */
    .poll-container.mobile-collapsed {
        padding: 0;
        border: none;
        box-shadow: none;
        background: transparent !important;
        cursor: pointer;
        transition: transform 0.2s ease;
    }

    .poll-container.mobile-collapsed:active {
        transform: scale(0.98);
    }

    /* Hide all content except header/title in collapsed state */
    .poll-container.mobile-collapsed .poll-options,
    .poll-container.mobile-collapsed .poll-results,
    .poll-container.mobile-collapsed .poll-actions,
    .poll-container.mobile-collapsed .poll-deadline,
    .poll-container.mobile-collapsed .poll-meta,
    .poll-container.mobile-collapsed .poll-description {
        display: none;
    }

    /* Pill: Header as compact chip - DEFAULT: Needs your vote (orange/red for action) */
    .poll-container.mobile-collapsed .poll-header {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        padding: 8px 12px;
        background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
        border-radius: 20px;
        margin-bottom: 0;
        box-shadow: 0 2px 8px rgba(255, 107, 107, 0.3);
    }

    .poll-container.mobile-collapsed .poll-icon {
        color: #fff;
        font-size: 14px;
    }

    /* Pill: Title inline with icon - hide the regular title div */
    .poll-container.mobile-collapsed .poll-title {
        display: none;
    }

    /* Pill: Show inline title in header when collapsed */
    .poll-container.mobile-collapsed .poll-title-inline {
        display: inline-block;
        font-size: 13px;
        font-weight: 600;
        color: #fff;
        max-width: 180px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        flex: 1;
    }

    /* Pill: Badges inline */
    .poll-container.mobile-collapsed .poll-badge {
        font-size: 10px;
        padding: 3px 7px;
        background: rgba(255, 255, 255, 0.25);
        border-radius: 10px;
        color: #fff;
        font-weight: 600;
    }

    /* Organizer badge - gold star */
    .poll-container.mobile-collapsed .poll-badge.organizer {
        background: rgba(255, 215, 0, 0.3);
        color: #ffd700;
    }

    /* Voted badge - bright checkmark */
    .poll-container.mobile-collapsed .poll-badge.voted {
        background: rgba(255, 255, 255, 0.4);
        color: #fff;
    }

    /* Pinned badge - urgent indicator */
    .poll-container.mobile-collapsed .poll-badge.pinned {
        background: rgba(255, 255, 255, 0.4);
        color: #fff;
    }

    /* Closed badge - lock icon */
    .poll-container.mobile-collapsed .poll-badge.closed {
        background: rgba(0, 0, 0, 0.15);
        color: rgba(255, 255, 255, 0.8);
    }

    /* Color variations for different poll states - INTUITIVE COLORS */

    /* Already voted - green (completed/success) */
    .poll-container.mobile-collapsed .poll-header[data-voted="true"] {
        background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
        box-shadow: 0 2px 8px rgba(56, 239, 125, 0.3);
    }

    /* Closed poll - gray (inactive/informational) */
    .poll-container.mobile-collapsed.closed .poll-header {
        background: linear-gradient(135deg, #bdc3c7 0%, #95a5a6 100%);
        box-shadow: 0 2px 8px rgba(149, 165, 166, 0.3);
    }

    /* From organizer - gold/purple (official/important) */
    .poll-container.mobile-collapsed .poll-header[data-organizer="true"] {
        background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
        box-shadow: 0 2px 8px rgba(240, 147, 251, 0.4);
    }

    /* Pinned poll - bright pink/magenta (urgent/priority) - overrides all */
    .poll-container.mobile-collapsed.pinned .poll-header {
        background: linear-gradient(135deg, #fc466b 0%, #3f5efb 100%);
        box-shadow: 0 2px 8px rgba(252, 70, 107, 0.4);
        animation: pulse-border 2s ease-in-out infinite;
    }

    /* Pinned + voted - still show as priority but calmer */
    .poll-container.mobile-collapsed.pinned .poll-header[data-voted="true"] {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
    }

    @keyframes pulse-border {
        0%, 100% { box-shadow: 0 2px 8px rgba(252, 70, 107, 0.4); }
        50% { box-shadow: 0 2px 12px rgba(252, 70, 107, 0.6), 0 0 0 2px rgba(252, 70, 107, 0.2); }
    }

    /* Compact header */
    .poll-header {
        margin-bottom: 6px;
        gap: 4px;
        flex-wrap: wrap;
    }

    .poll-icon {
        font-size: 14px;
    }

    .poll-badge {
        font-size: 9px;
        padding: 2px 4px;
    }

    /* Compact title */
    .poll-title {
        font-size: 14px;
        line-height: 1.3;
        margin-bottom: 4px;
        max-height: 2.6em; /* 2 lines max */
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
    }

    /* Hide meta and description on mobile to save space */
    .poll-meta {
        font-size: 10px;
        margin-bottom: 4px;
        color: #657786;
    }

    .poll-description {
        display: none; /* Hide on mobile to save space */
    }

    .poll-deadline {
        font-size: 11px;
        padding: 4px 8px;
        margin-bottom: 8px;
    }

    /* Poll Options - Compact mobile layout */
    .poll-options {
        margin-bottom: 8px;
    }

    .poll-option {
        padding: 10px 8px;
        margin-bottom: 6px;
        min-height: 44px;
        border-radius: 8px;
    }

    .poll-option-content {
        gap: 8px;
    }

    .option-text {
        font-size: 14px;
        line-height: 1.3;
    }

    .option-image {
        width: 36px;
        height: 36px;
        min-width: 36px;
    }

    /* Compact vote stats - horizontal layout */
    .vote-stats {
        gap: 6px;
        flex-wrap: nowrap;
        font-size: 11px;
    }

    .vote-count {
        font-size: 11px;
    }

    .vote-percentage {
        font-size: 11px;
        font-weight: 700;
    }

    .you-voted {
        font-size: 9px;
        padding: 2px 4px;
    }

    .winner-icon {
        font-size: 14px;
    }

    /* Poll Results - Compact mobile layout */
    .poll-results {
        padding: 8px;
        margin-top: 8px;
        margin-bottom: 0;
        border-radius: 6px;
    }

    .poll-stat {
        display: inline-block;
        margin-right: 12px;
        margin-bottom: 6px;
        font-size: 11px;
    }

    .poll-stat i {
        font-size: 12px;
    }

    /* Compact majority indicator */
    .majority-indicator {
        font-size: 10px;
        padding: 3px 6px;
        margin-left: 4px;
    }

    /* Hide non-voters section on mobile */
    .non-voters {
        display: none;
    }

    /* Poll Actions - Compact layout */
    .poll-actions {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 4px;
        margin-top: 8px;
        padding-top: 8px;
        border-top: 1px solid #e1e8ed;
    }

    .poll-action-btn {
        flex: 1 1 auto;
        min-width: calc(50% - 2px);
        justify-content: center;
        padding: 8px 10px;
        font-size: 12px;
        min-height: 38px;
    }

    .poll-action-btn i {
        font-size: 13px;
        margin-right: 4px;
    }

    /* Pinned polls - extra compact */
    .poll-container.pinned {
        padding: 8px;
        margin: 8px 0;
    }

    .poll-container.pinned .poll-results {
        padding: 6px;
        margin-top: 6px;
    }

    .poll-container.pinned .poll-option {
        padding: 8px 6px;
        margin-bottom: 4px;
        min-height: 40px;
    }

    .poll-container.pinned .poll-actions {
        margin-top: 6px;
        padding-top: 6px;
    }

    /* Ranked choice - Mobile optimized */
    .poll-option-ranked {
        padding: 12px;
        margin-bottom: 8px;
        min-height: 48px;
    }

    .rank-number {
        width: 28px;
        height: 28px;
        font-size: 13px;
    }

    .drag-handle {
        font-size: 16px;
    }

    /* Poll Modal - Mobile optimized */
    .poll-creation-modal {
        padding: 0;
    }

    .poll-modal-content {
        width: 100%;
        max-width: 100%;
        height: 100vh;
        max-height: 100vh;
        margin: 0;
        border-radius: 0;
        padding: 16px;
        overflow-y: auto;
    }

    .poll-modal-header {
        padding: 12px 0;
        margin-bottom: 16px;
        font-size: 18px;
    }

    .poll-modal-close {
        width: 36px;
        height: 36px;
        font-size: 20px;
    }

    .poll-modal-body {
        padding-bottom: 80px; /* Space for fixed actions */
    }

    .poll-form-label {
        font-size: 14px;
        margin-bottom: 6px;
    }

    .poll-form-input,
    .poll-form-textarea,
    .poll-form-select {
        font-size: 16px; /* Prevents iOS zoom */
        padding: 12px;
        min-height: 44px;
    }

    .poll-type-selector {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .poll-type-option {
        padding: 14px;
        min-height: 56px;
    }

    .type-name {
        font-size: 15px;
    }

    .type-desc {
        font-size: 12px;
    }

    .poll-option-item {
        margin-bottom: 10px;
        gap: 8px;
    }

    .poll-option-number {
        min-width: 28px;
        font-size: 13px;
    }

    .btn-remove-option {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }

    .btn-add-option {
        padding: 12px;
        font-size: 14px;
        min-height: 44px;
    }

    .poll-modal-actions {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        padding: 12px 16px;
        background: white;
        border-top: 1px solid #e1e8ed;
        box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
        z-index: 10;
    }

    .btn-modal-cancel,
    .btn-modal-submit {
        flex: 1;
        padding: 14px;
        font-size: 16px;
        min-height: 48px;
        border-radius: 8px;
    }

    /* Tie Alert - Mobile */
    .tie-alert {
        padding: 10px;
        font-size: 13px;
        margin-bottom: 10px;
    }

    .tie-option {
        margin-bottom: 8px;
    }

    .btn-select-winner {
        padding: 12px;
        font-size: 14px;
        min-height: 44px;
    }
}

/* Extra small screens */
@media (max-width: 480px) {
    .poll-container {
        padding: 12px;
        margin: 12px 4px;
    }

    .poll-title {
        font-size: 16px;
    }

    .poll-meta {
        font-size: 11px;
    }

    .poll-badge {
        font-size: 9px;
        padding: 2px 5px;
    }

    .option-text {
        font-size: 14px;
    }

    .poll-action-btn {
        min-width: 100%;
        font-size: 14px;
    }

    .poll-stat {
        font-size: 12px;
    }
}

/* ===== CREATE POLL BUTTON (in chat input) ===== */
.chat-poll-btn {
    background: #f5f8fa;
    border: 1px solid #e1e8ed;
    border-radius: 6px;
    padding: 8px 12px;
    cursor: pointer;
    transition: all 0.15s ease;
    color: #1da1f2;
    font-size: 16px;
}

.chat-poll-btn:hover {
    background: #e8f5fe;
    border-color: #1da1f2;
}

.chat-poll-btn i {
    margin: 0;
}

/* ===== WELCOME BANNER ===== */
.welcome-banner {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    margin: 12px;
    padding: 0;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    animation: slideDown 0.3s ease-out;
}

.welcome-banner-content {
    position: relative;
}

.welcome-banner-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px 12px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.welcome-banner-title {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #fff;
    font-size: 15px;
    font-weight: 600;
}

.welcome-banner-title i {
    font-size: 18px;
}

.welcome-banner-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s;
}

.welcome-banner-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.welcome-banner-body {
    padding: 20px;
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.welcome-organizer-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.3);
    object-fit: cover;
}

.welcome-organizer-avatar-placeholder {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 20px;
}

.welcome-message-text {
    flex: 1;
    margin: 0;
    color: #fff;
    font-size: 14px;
    line-height: 1.6;
    white-space: pre-wrap;
}

.welcome-banner-footer {
    padding: 12px 20px 20px 20px;
    text-align: right;
}

.btn-welcome-dismiss {
    background: rgba(255, 255, 255, 0.9);
    color: #667eea;
    border: none;
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-welcome-dismiss:hover {
    background: #fff;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 768px) {
    .welcome-banner {
        margin: 8px;
        border-radius: 8px;
    }

    .welcome-banner-body {
        padding: 16px;
        gap: 12px;
    }

    .welcome-organizer-avatar,
    .welcome-organizer-avatar-placeholder {
        width: 40px;
        height: 40px;
    }

    .welcome-message-text {
        font-size: 13px;
    }
}
