/**
 * Modal Styles
 * Image Preview Modal
 */

.image-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.image-modal.open {
    opacity: 1;
    visibility: visible;
}

.image-modal img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.image-modal.open img {
    transform: scale(1);
}

.image-modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    padding: 10px;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

.image-modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
    border-color: rgba(0, 212, 255, 0.3);
}

.image-modal-close svg {
    width: 24px;
    height: 24px;
}

.image-modal-attach {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    padding: 10px;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

.image-modal-attach:hover {
    background: rgba(0, 212, 255, 0.2);
    transform: scale(1.1);
    border-color: rgba(0, 212, 255, 0.5);
}

.image-modal-attach svg {
    width: 24px;
    height: 24px;
}

.image-modal-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    padding: 12px;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

.image-modal-nav:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-50%) scale(1.1);
    border-color: rgba(0, 212, 255, 0.3);
}

.image-modal-nav.prev {
    left: 20px;
}

.image-modal-nav.next {
    right: 20px;
}

.image-modal-nav svg {
    width: 24px;
    height: 24px;
}

/* General Modal Overlay */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 400;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
}

.modal-overlay.active,
.modal-overlay.open {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: #1a1a1e;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px) scale(0.98);
}

.modal-overlay.active .modal {
    animation: modalSlideIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-header h2 {
    font-size: 16px;
    font-weight: 600;
    color: white;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}

.modal-close:hover {
    color: white;
}

.modal-close svg {
    width: 20px;
    height: 20px;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Edit Modal Specific */
.edit-modal {
    max-width: 600px;
}

.edit-warning {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.5);
    margin: 0 0 16px 0;
    padding: 12px;
    background: rgba(255, 193, 7, 0.1);
    border: 1px solid rgba(255, 193, 7, 0.2);
    border-radius: 8px;
}

.edit-textarea {
    width: 100%;
    min-height: 120px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: white;
    font-size: 14px;
    font-family: inherit;
    line-height: 1.5;
    resize: vertical;
    transition: border-color 0.2s ease;
}

.edit-textarea:focus {
    outline: none;
    border-color: rgba(0, 212, 255, 0.5);
}

.edit-textarea::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

/* Modal Buttons */
.btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.btn-primary {
    background: linear-gradient(135deg, #00d4ff 0%, #0099cc 100%);
    color: white;
    position: relative;
    overflow: hidden;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.btn-primary:hover::before {
    left: 100%;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 212, 255, 0.3);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    color: white;
}

/* Debug Modal Specific */
.debug-modal {
    max-width: 800px;
    max-height: 85vh;
}

.debug-modal-body {
    max-height: 60vh;
    overflow-y: auto;
}

.debug-section {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.debug-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.debug-section h3 {
    font-size: 14px;
    font-weight: 600;
    color: #00d4ff;
    margin: 0 0 12px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.debug-section h4 {
    font-size: 13px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.8);
    margin: 12px 0 8px 0;
}

.debug-field {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 13px;
    line-height: 1.5;
}

.debug-label {
    color: rgba(255, 255, 255, 0.5);
    min-width: 120px;
    flex-shrink: 0;
}

.debug-value {
    color: rgba(255, 255, 255, 0.9);
    word-break: break-word;
    flex: 1;
}

.debug-code {
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    font-size: 12px;
    background: rgba(0, 0, 0, 0.3);
    padding: 2px 6px;
    border-radius: 4px;
}

.debug-pre {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 12px;
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    font-size: 12px;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.85);
    white-space: pre-wrap;
    word-break: break-word;
    overflow-x: auto;
    max-height: 300px;
    overflow-y: auto;
    margin: 8px 0;
}

.debug-images-list {
    margin-left: 128px;
    margin-top: 4px;
}

.debug-image-item {
    display: flex;
    gap: 8px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    padding: 4px 0;
}

.debug-persona-prompt {
    margin-bottom: 16px;
}

.debug-persona-prompt:last-child {
    margin-bottom: 0;
}

/* Debug button styling */
.inline-action-btn.debug {
    color: rgba(255, 255, 255, 0.4);
}

.inline-action-btn.debug:hover {
    color: #00d4ff;
    background: rgba(0, 212, 255, 0.1);
}

.inline-action-btn.debug svg {
    width: 14px;
    height: 14px;
}

/* Mobile adjustments for debug modal */
@media (max-width: 768px) {
    .debug-modal {
        max-width: 95vw;
        max-height: 90vh;
    }

    .debug-modal-body {
        max-height: 70vh;
    }

    .debug-field {
        flex-direction: column;
        gap: 4px;
    }

    .debug-label {
        min-width: unset;
    }

    .debug-images-list {
        margin-left: 0;
    }

    .debug-pre {
        font-size: 11px;
        padding: 10px;
    }
}

/* ============================================
   GROUP CREATOR MODAL
   ============================================ */
.modal-panel {
    background: #1a1a1e;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    width: 100%;
    max-width: 480px;
    max-height: 85vh;
    overflow: hidden;
    transform: scale(0.95);
    transition: transform 0.2s ease;
}

.modal-overlay.open .modal-panel {
    transform: scale(1);
}

.group-creator-panel .modal-body {
    padding: 20px;
    max-height: 60vh;
    overflow-y: auto;
}

/* Form Elements */
.form-group {
    margin-bottom: 20px;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 8px;
}

.form-group label .hint {
    font-weight: 400;
    color: rgba(255, 255, 255, 0.4);
}

.form-input {
    width: 100%;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: white;
    font-size: 14px;
    transition: all 0.2s ease;
}

.form-input:focus {
    outline: none;
    border-color: rgba(0, 212, 255, 0.5);
    background: rgba(255, 255, 255, 0.08);
}

.form-input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

/* Button variants for modal */
.btn.primary {
    background: linear-gradient(135deg, #00d4ff 0%, #0099cc 100%);
    color: white;
}

.btn.primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 212, 255, 0.3);
}

.btn.primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn.secondary {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn.secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    color: white;
}

/* Mobile adjustments for group creator */
@media (max-width: 768px) {
    .modal-panel {
        max-width: 95vw;
        margin: 16px;
    }

    .persona-select-grid {
        grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
        gap: 8px;
    }

    .persona-select-item {
        padding: 10px 6px;
    }

    .persona-select-avatar {
        width: 40px;
        height: 40px;
    }
}

/* ============================================
   MOBILE KEYBOARD VISIBILITY FIX
   Position modals at top on mobile to avoid virtual keyboard
   ============================================ */
@media (max-width: 768px) {
    .modal-overlay {
        align-items: flex-start;
        padding-top: 60px;  /* Below mobile header */
    }

    .modal {
        max-height: calc(100vh - 80px);
        max-height: calc(100dvh - 80px);  /* Dynamic viewport for keyboard */
    }

    .edit-modal {
        max-height: calc(100vh - 100px);
        max-height: calc(100dvh - 100px);
    }
}

/* When keyboard is open, shrink modal further to stay visible */
body.keyboard-open .modal-overlay {
    align-items: flex-start;
    padding-top: 20px;
}

body.keyboard-open .modal {
    max-height: 50vh;
    max-height: 50dvh;  /* Dynamic viewport height */
}

body.keyboard-open .edit-modal {
    max-height: 45vh;
    max-height: 45dvh;
}

body.keyboard-open .modal-body {
    max-height: 30vh;
    max-height: 30dvh;
    overflow-y: auto;
}

/* ============================================================================
   MOMENT MODAL
   ============================================================================ */

.moment-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 400;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.moment-modal.open {
    opacity: 1;
    visibility: visible;
}

.moment-modal-content {
    background: #1a1a1e;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    width: 100%;
    max-width: 440px;
    transform: translateY(20px) scale(0.95);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.moment-modal.open .moment-modal-content {
    transform: translateY(0) scale(1);
}

.moment-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.moment-modal-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: white;
    display: flex;
    align-items: center;
    gap: 8px;
}

.moment-modal-header h3 svg {
    width: 18px;
    height: 18px;
    color: rgba(0, 212, 255, 0.8);
}

.moment-modal-close {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    padding: 4px;
    transition: color 0.2s ease;
}

.moment-modal-close:hover {
    color: white;
}

.moment-modal-close svg {
    width: 20px;
    height: 20px;
}

.moment-modal-body {
    padding: 20px;
}

.moment-form-group {
    margin-bottom: 16px;
}

.moment-form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 8px;
}

.moment-type-select {
    width: 100%;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: white;
    font-size: 14px;
    cursor: pointer;
    transition: border-color 0.2s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='rgba(255,255,255,0.5)' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

.moment-type-select:focus {
    outline: none;
    border-color: rgba(0, 212, 255, 0.5);
}

.moment-type-select option {
    background: #1a1a1e;
    color: white;
}

.moment-content-input {
    width: 100%;
    min-height: 100px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: white;
    font-size: 14px;
    font-family: inherit;
    line-height: 1.5;
    resize: none;
    transition: border-color 0.2s ease;
}

.moment-content-input:focus {
    outline: none;
    border-color: rgba(0, 212, 255, 0.5);
}

.moment-content-input::placeholder {
    color: rgba(255, 255, 255, 0.35);
}

.moment-char-count {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
    text-align: right;
    margin-top: 4px;
}

.moment-priority-select {
    width: 100%;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: white;
    font-size: 14px;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='rgba(255,255,255,0.5)' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

.moment-priority-select:focus {
    outline: none;
    border-color: rgba(0, 212, 255, 0.5);
}

.moment-modal-footer {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding: 16px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.moment-btn {
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.moment-btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
}

.moment-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.moment-btn-primary {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.8) 0%, rgba(123, 47, 247, 0.8) 100%);
    border: none;
    color: white;
}

.moment-btn-primary:hover {
    background: linear-gradient(135deg, rgba(0, 212, 255, 1) 0%, rgba(123, 47, 247, 1) 100%);
    transform: translateY(-1px);
}

.moment-btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ============================================================================
   CUSTOM DROPDOWN
   ============================================================================ */

.moment-custom-dropdown {
    position: relative;
    width: 100%;
}

.moment-dropdown-selected {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.moment-dropdown-selected:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
}

.moment-custom-dropdown.open .moment-dropdown-selected {
    border-color: rgba(0, 212, 255, 0.5);
    background: rgba(255, 255, 255, 0.08);
}

.moment-dropdown-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
}

.moment-dropdown-icon svg {
    width: 18px;
    height: 18px;
    color: rgba(0, 212, 255, 0.8);
}

.moment-dropdown-label {
    flex: 1;
    font-size: 14px;
    color: white;
}

.moment-dropdown-chevron {
    width: 16px;
    height: 16px;
    color: rgba(255, 255, 255, 0.5);
    transition: transform 0.2s ease;
}

.moment-custom-dropdown.open .moment-dropdown-chevron {
    transform: rotate(180deg);
}

.moment-dropdown-list {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: rgba(20, 20, 28, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transform: translateY(-8px);
    transition: all 0.2s ease;
    z-index: 500;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.moment-dropdown-list.open {
    max-height: 320px;
    opacity: 1;
    transform: translateY(0);
    overflow-y: auto;
}

.moment-dropdown-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.moment-dropdown-option:hover {
    background: rgba(0, 212, 255, 0.1);
}

.moment-dropdown-option.selected {
    background: rgba(0, 212, 255, 0.15);
}

.moment-dropdown-option .moment-dropdown-icon svg {
    color: rgba(255, 255, 255, 0.6);
}

.moment-dropdown-option.selected .moment-dropdown-icon svg,
.moment-dropdown-option:hover .moment-dropdown-icon svg {
    color: rgba(0, 212, 255, 0.8);
}

.moment-dropdown-option .moment-dropdown-label {
    color: rgba(255, 255, 255, 0.85);
}

.moment-dropdown-option.selected .moment-dropdown-label {
    color: white;
    font-weight: 500;
}

/* ============================================================================
   MOMENT MENTION AUTOCOMPLETE
   ============================================================================ */

.moment-content-wrapper {
    position: relative;
}

.moment-content-container {
    position: relative;
}

.moment-mention-autocomplete {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    background: rgba(20, 20, 28, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    margin-bottom: 8px;
    max-height: 240px;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    opacity: 0;
    transform: translateY(8px);
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 600;
}

.moment-mention-autocomplete.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.moment-mention-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.moment-mention-item:hover,
.moment-mention-item.selected {
    background: rgba(0, 212, 255, 0.1);
}

.moment-mention-item:first-child {
    border-radius: 11px 11px 0 0;
}

.moment-mention-item:last-child {
    border-radius: 0 0 11px 11px;
}

.moment-mention-item:only-child {
    border-radius: 11px;
}

.moment-mention-avatar {
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 10px;
    background: linear-gradient(135deg, #00d4ff 0%, #7b2ff7 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    color: white;
    overflow: hidden;
}

.moment-mention-avatar.has-image {
    background: transparent;
}

.moment-mention-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Type-specific avatar styling */
.moment-mention-avatar.friend-type {
    border-radius: 50%;
    background: linear-gradient(135deg, #10b981 0%, #3b82f6 100%);
}

.moment-mention-avatar.persona-type {
    border-radius: 10px;
    background: linear-gradient(135deg, #00d4ff 0%, #7b2ff7 100%);
}

.moment-mention-info {
    flex: 1;
    min-width: 0;
}

.moment-mention-name {
    font-size: 14px;
    font-weight: 600;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.moment-mention-hint {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
}

/* ============================================================================
   FLOATING MOMENT BUTTON (Mobile)
   ============================================================================ */

.floating-moment-btn {
    position: fixed;
    top: 70px; /* Below mobile header */
    left: 50%;
    transform: translateX(-50%) translateY(-10px);
    z-index: 45;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.15) 0%, rgba(123, 47, 247, 0.15) 100%);
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-radius: 20px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.floating-moment-btn.visible {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.floating-moment-btn:hover {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.25) 0%, rgba(123, 47, 247, 0.25) 100%);
    border-color: rgba(0, 212, 255, 0.5);
}

.floating-moment-btn svg {
    width: 14px;
    height: 14px;
}

/* Hide floating button on desktop */
@media (min-width: 769px) {
    .floating-moment-btn {
        display: none !important;
    }
}

/* ============================================================================
   SIDEBAR MOMENT BUTTON
   ============================================================================ */

.sidebar-moment-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    margin-bottom: 12px;
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.08) 0%, rgba(123, 47, 247, 0.08) 100%);
    border: 1px dashed rgba(0, 212, 255, 0.25);
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sidebar-moment-btn:hover {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.15) 0%, rgba(123, 47, 247, 0.15) 100%);
    border-color: rgba(0, 212, 255, 0.4);
    color: white;
}

.sidebar-moment-btn svg {
    width: 16px;
    height: 16px;
    color: rgba(0, 212, 255, 0.7);
}

/* ============================================================================
   UNIFIED GROUP CREATOR MODAL
   ============================================================================ */

.unified-group-creator {
    max-width: 520px;
    width: 95%;
}

.unified-group-creator .modal-body {
    padding: 20px 24px;
}

/* Separator between group name and member selection */
.unified-group-creator .form-group:first-child {
    padding-bottom: 16px;
    margin-bottom: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

/* Selection Sections Container */
.selection-sections {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 16px;
}

/* Individual Section */
.selection-section {
    transition: opacity 0.3s ease, filter 0.3s ease;
}

.selection-section.disabled {
    opacity: 0.35;
    pointer-events: none;
    filter: grayscale(0.5);
}

/* Section Header */
.selection-section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    font-size: 14px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
}

.selection-section-header svg {
    color: rgba(0, 212, 255, 0.8);
}

.selection-section-header .hint {
    font-size: 12px;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.4);
}

/* Section Divider */
.section-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    color: rgba(255, 255, 255, 0.3);
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.section-divider::before,
.section-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
}

/* Selection Grid */
.unified-select-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 16px;
    max-height: 200px;
    overflow-y: auto;
    padding: 8px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.unified-select-grid::-webkit-scrollbar {
    width: 6px;
}

.unified-select-grid::-webkit-scrollbar-track {
    background: transparent;
}

.unified-select-grid::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

/* Selection Item */
.unified-select-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 16px 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 2px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.unified-select-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.unified-select-item:has(input:checked) {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.15) 0%, rgba(255, 0, 170, 0.1) 100%);
    border-color: rgba(0, 212, 255, 0.5);
    box-shadow: 0 4px 16px rgba(0, 212, 255, 0.2);
}

.unified-select-item input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

/* Avatar Styling */
.unified-select-avatar {
    position: relative;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    overflow: visible;
}

.unified-select-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: border-color 0.2s ease;
}

.unified-select-item:has(input:checked) .unified-select-avatar img {
    border-color: rgba(0, 212, 255, 0.5);
}

/* Online Indicator for Friends */
.unified-select-avatar .online-indicator {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    background: #22c55e;
    border: 2px solid rgba(6, 6, 10, 0.98);
    border-radius: 50%;
    z-index: 1;
}

/* Name Label */
.unified-select-name {
    font-size: 12px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.8);
    text-align: center;
    max-width: 90px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.unified-select-item:has(input:checked) .unified-select-name {
    color: white;
}

/* Empty Section Message */
.empty-section-message {
    text-align: center;
    padding: 24px 16px;
    color: rgba(255, 255, 255, 0.4);
    font-size: 13px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 12px;
    border: 1px dashed rgba(255, 255, 255, 0.1);
}

/* ============================================================================
   UNIFIED MEMBER LIST (iMessage-style)
   ============================================================================ */

.unified-member-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: 300px;
    overflow-y: auto;
    padding: 4px 0;
}

.unified-member-list::-webkit-scrollbar {
    width: 6px;
}

.unified-member-list::-webkit-scrollbar-track {
    background: transparent;
}

.unified-member-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

/* Member Item - Horizontal list row */
.unified-member-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.15s ease, opacity 0.2s ease;
    position: relative;
}

.unified-member-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

.unified-member-item.selected {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.15) 0%, rgba(255, 0, 170, 0.1) 100%);
}

.unified-member-item.disabled {
    opacity: 0.35;
    pointer-events: none;
}

/* Member Avatar */
.unified-member-item .member-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.unified-member-item.selected .member-avatar {
    border-color: rgba(0, 212, 255, 0.5);
}

/* Online indicator dot */
.unified-member-item .member-online-dot {
    position: absolute;
    left: 42px;
    top: 36px;
    width: 10px;
    height: 10px;
    background: #4caf50;
    border-radius: 50%;
    border: 2px solid var(--bg-primary, #1a1a2e);
}

/* Member Info */
.unified-member-item .member-info {
    flex: 1;
    min-width: 0;
}

.unified-member-item .member-name {
    font-size: 14px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.unified-member-item.selected .member-name {
    color: white;
}

/* Type Badge */
.unified-member-item .type-badge {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}

.unified-member-item .type-badge svg {
    flex-shrink: 0;
}

.unified-member-item .type-badge.persona {
    color: rgba(0, 212, 255, 0.9);
}

.unified-member-item .type-badge.friend {
    color: rgba(76, 175, 80, 0.9);
}

/* Create Button States */
.unified-group-creator .modal-footer .btn.primary {
    min-width: 160px;
    transition: all 0.2s ease;
}
