@media (max-width: 768px) {

  .support-widget {
    position: fixed !important;
    bottom: 134px !important;
    right: 20px !important;
    z-index: 1000 !important;
    width: auto !important;
    height: auto !important;
    background: none !important;
    border: none !important;
    padding: 0 !important;
    box-shadow: none !important;
  }

  .support-widget::before,
  .support-widget::after {
    display: none !important;
    content: none !important;
  }

  .support-button {
    width: 36px !important;
    height: 36px !important;
    border-radius: 50% !important;
    background: linear-gradient(135deg, var(--primary, #B74D3F) 0%, var(--primary-dark, #8C3530) 100%) !important;
    border: none !important;
    box-shadow: 0 4px 18px rgba(var(--primary-rgb, 183, 77, 63), 0.40) !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease !important;
    position: static !important;
    margin: 0 !important;
  }

  .support-button:active {
    transform: scale(0.92) !important;
  }

  .support-button svg {
    width: 16px !important;
    height: 16px !important;
    fill: white !important;
    flex-shrink: 0 !important;
  }

  .support-widget .notification-badge {
    position: absolute !important;
    top: -4px !important;
    right: -4px !important;
    min-width: 16px !important;
    height: 16px !important;
    padding: 0 6px !important;
    border-radius: 20px !important;
    background: #ff3b30 !important;
    color: white !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    line-height: 16px !important;
    text-align: center !important;
    z-index: 1001 !important;
    box-shadow: 0 2px 6px rgba(255, 59, 48, 0.4) !important;
    animation: notification-pulse 2s infinite !important;
    display: flex !important;
  }

  @keyframes notification-pulse {
    0% {
      transform: scale(1);
    }
    50% {
      transform: scale(1.1);
    }
    100% {
      transform: scale(1);
    }
  }

  .support-widget .notification-badge.hidden {
    display: none !important;
  }

  .support-widget:has(.support-chat.active) .notification-badge {
    display: none !important;
  }

  .support-widget:has(.support-chat.active) .support-button {
    opacity: 0 !important;
    pointer-events: none !important;
    transform: scale(0.6) !important;
    transition: opacity 0.2s, transform 0.2s !important;
  }

  body:has(.support-chat.active)::before {
    content: '' !important;
    position: fixed !important;
    inset: 0 !important;
    background: rgba(var(--primary-rgb, 49, 130, 206), 0.18) !important;
    z-index: 999 !important;
    backdrop-filter: blur(10px) saturate(1.05) !important;
    -webkit-backdrop-filter: blur(10px) saturate(1.05) !important;
    pointer-events: none !important;
  }

  .support-chat {
    display: flex !important;
    flex-direction: column !important;

    position: fixed !important;
    left: 50% !important;
    top: 50% !important;
    transform: translate(-50%, -50%) scale(0.95) !important;
    width: calc(100% - 48px) !important;
    max-width: 400px !important;
    
    height: min(560px, 80svh) !important;
    min-height: 400px !important;
    max-height: min(560px, 80svh) !important;

    border-radius: 28px !important;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3) !important;
    z-index: 1002 !important;
    overflow: hidden !important;

    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    transition: 
      opacity 0.25s ease,
      transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
      visibility 0s 0.3s !important;
  }

  .support-chat.active {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    transform: translate(-50%, -50%) scale(1) !important;
    transition: 
      opacity 0.25s ease,
      transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
      visibility 0s 0s !important;
  }

  .support-chat-header::before {
    display: none !important;
  }

  .support-chat .sp-body {
    flex: 1 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    min-height: 0 !important;
    padding: 20px !important;
    display: flex !important;
    flex-direction: column !important;
  }

  .support-chat .message {
    display: flex !important;
    width: 100% !important;
    margin-bottom: 16px !important;
  }

  .support-chat .message.sender,
  .support-chat .message.sent,
  .support-chat .message-out {
    justify-content: flex-end !important;
  }

  .support-chat .message.sender .message-bubble,
  .support-chat .message.sent .message-bubble,
  .support-chat .message-out .message-bubble {
    background: linear-gradient(135deg, var(--primary, #B74D3F) 0%, var(--primary-dark, #8C3530) 100%) !important;
    color: white !important;
    border-radius: 18px 4px 18px 18px !important;
    max-width: 80% !important;
    padding: 12px 16px !important;
    word-wrap: break-word !important;
    box-shadow: 0 2px 8px rgba(183, 77, 63, 0.3) !important;
    font-size: 14px !important;
    line-height: 1.4 !important;
    margin-left: auto !important;
  }

  .support-chat .message.reply,
  .support-chat .message.received,
  .support-chat .message-in {
    justify-content: flex-start !important;
  }

  .support-chat .message.reply .message-bubble,
  .support-chat .message.received .message-bubble,
  .support-chat .message-in .message-bubble {
    background: #f0f2f5 !important;
    color: #1a1a1a !important;
    border-radius: 4px 18px 18px 18px !important;
    max-width: 80% !important;
    padding: 12px 16px !important;
    word-wrap: break-word !important;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05) !important;
    font-size: 14px !important;
    line-height: 1.4 !important;
    margin-right: auto !important;
  }

  .support-chat .message-time {
    font-size: 11px !important;
    margin-top: 6px !important;
    opacity: 0.7 !important;
    padding: 0 4px !important;
  }

  .support-chat .message.reply .message-time,
  .support-chat .message.received .message-time,
  .support-chat .message-in .message-time {
    color: #666 !important;
    text-align: left !important;
  }

  .support-chat .message.sender .message-time,
  .support-chat .message.sent .message-time,
  .support-chat .message-out .message-time {
    color: rgba(255, 255, 255, 0.7) !important;
    text-align: right !important;
  }

  .support-chat .message.reply .message-avatar,
  .support-chat .message.received .message-avatar,
  .support-chat .message-in .message-avatar {
    width: 32px !important;
    height: 32px !important;
    border-radius: 50% !important;
    margin-right: 8px !important;
    background: linear-gradient(135deg, var(--primary, #B74D3F) 0%, var(--primary-dark, #8C3530) 100%) !important;
    color: white !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-weight: 600 !important;
    font-size: 14px !important;
    flex-shrink: 0 !important;
  }

  .support-chat .message.reply,
  .support-chat .message.received,
  .support-chat .message-in {
    display: flex !important;
    align-items: flex-end !important;
  }

  .support-chat .message-wrapper {
    display: flex !important;
    flex-direction: column !important;
    max-width: 80% !important;
  }

  .support-chat .message.system {
    justify-content: center !important;
  }

  .support-chat .message.system .message-bubble {
    background: rgba(0, 0, 0, 0.05) !important;
    color: #666 !important;
    border-radius: 20px !important;
    padding: 6px 16px !important;
    font-size: 12px !important;
    max-width: 90% !important;
    text-align: center !important;
  }

  .support-chat .sp-header {
    padding: 16px 24px 8px !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08) !important;
  }

  .support-chat .sp-header h3 {
    font-size: 18px !important;
    font-weight: 700 !important;
    margin: 0 0 4px 0 !important;
  }

  .support-chat .sp-header p {
    font-size: 13px !important;
    opacity: 0.7 !important;
    margin: 0 !important;
  }

  .support-chat .sp-footer {
    padding: 16px 24px !important;
    border-top: 1px solid rgba(0, 0, 0, 0.08) !important;
    background: inherit !important;
  }

  .support-chat .sp-input {
    width: 100% !important;
    padding: 14px 18px !important;
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
    border-radius: 24px !important;
    font-size: 15px !important;
    background: white !important;
  }

  .support-chat .sp-close {
    position: absolute !important;
    top: 16px !important;
    right: 16px !important;
    width: 32px !important;
    height: 32px !important;
    border-radius: 50% !important;
    background: rgba(0, 0, 0, 0.05) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    z-index: 10 !important;
    border: none !important;
    font-size: 18px !important;
    color: #666 !important;
  }

  body.dark-mode .support-chat {
    background: #1a1a1a !important;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.45) !important;
  }

  body.dark-mode .support-chat .sp-header,
  body.dark-mode .support-chat .sp-footer {
    border-color: rgba(255, 255, 255, 0.08) !important;
  }

  body.dark-mode .support-chat .sp-header h3 {
    color: #fff !important;
  }

  body.dark-mode .support-chat .sp-header p {
    color: #ccc !important;
  }

  body.dark-mode .support-chat .sp-input {
    background: #2a2a2a !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    color: white !important;
  }

  body.dark-mode .support-chat .message.reply .message-bubble,
  body.dark-mode .support-chat .message.received .message-bubble,
  body.dark-mode .support-chat .message-in .message-bubble {
    background: #2a2a2a !important;
    color: #fff !important;
  }

  body.dark-mode .support-chat .message.system .message-bubble {
    background: rgba(255, 255, 255, 0.1) !important;
    color: #ccc !important;
  }

  body.dark-mode .support-chat .message.reply .message-time,
  body.dark-mode .support-chat .message.received .message-time,
  body.dark-mode .support-chat .message-in .message-time {
    color: #999 !important;
  }

  body.dark-mode .support-chat .sp-close {
    background: rgba(255, 255, 255, 0.1) !important;
    color: #fff !important;
  }

  @media (max-width: 480px) {
    .support-chat {
      width: calc(100% - 32px) !important;
      max-width: none !important;
      height: min(540px, 75svh) !important;
      min-height: 380px !important;
    }
    
    .support-chat .message.sender .message-bubble,
    .support-chat .message.sent .message-bubble,
    .support-chat .message-out .message-bubble,
    .support-chat .message.reply .message-bubble,
    .support-chat .message.received .message-bubble,
    .support-chat .message-in .message-bubble {
      max-width: 85% !important;
      padding: 10px 14px !important;
    }
  }

  @media (max-width: 360px) {
    .support-chat {
      width: calc(100% - 24px) !important;
      height: min(500px, 70svh) !important;
      min-height: 350px !important;
    }
  }

}

@media (max-width: 768px) {
  .campus-qr-widget {
    position: fixed !important;
    right: 20px !important;
    bottom: 84px !important;
    z-index: 1000 !important;
  }

  .campus-qr-button {
    width: 43px !important;
    height: 43px !important;
    box-shadow: 0 3px 12px rgba(var(--primary-rgb, 183, 77, 63), 0.36) !important;
  }

  .campus-qr-button svg {
    width: 20px !important;
    height: 20px !important;
  }

  body:has(.support-chat.active) .campus-qr-widget {
    opacity: 0 !important;
    pointer-events: none !important;
    transform: scale(0.85) !important;
  }

  .campus-qr-modal {
    align-items: flex-start !important;
    padding-top: max(calc(env(safe-area-inset-top, 0px) + 82px), 24vh) !important;
    padding-bottom: 10px !important;
  }

  .campus-qr-modal-dialog {
    width: calc(100% - 36px) !important;
    max-height: min(88svh, 620px) !important;
    padding: 0.8rem !important;
    border-radius: 16px !important;
    margin-top: 0 !important;
  }

  .campus-qr-modal.campus-qr-has-view {
    padding-top: max(calc(env(safe-area-inset-top, 0px) + 52px), 15vh) !important;
  }

  .campus-qr-modal:not(.campus-qr-has-view) .campus-qr-modal-dialog {
    padding-bottom: 0.62rem !important;
  }

  .campus-qr-modal:not(.campus-qr-has-view) .campus-qr-login-btn {
    margin-top: 0.3rem !important;
  }

  .campus-qr-view {
    min-height: 280px !important;
  }

  .campus-qr-frame {
    min-height: 250px !important;
  }

  .support-widget,
  .campus-qr-widget {
    opacity: 0 !important;
    pointer-events: none !important;
    transform: translateY(10px) scale(0.88) !important;
    transition:
      opacity 0.22s ease,
      transform 0.28s cubic-bezier(0.22, 1, 0.36, 1) !important;
  }

  body.mobile-actions-open .campus-qr-widget {
    opacity: 1 !important;
    pointer-events: auto !important;
    transform: translateY(0) scale(1) !important;
    transition-delay: 0s !important;
  }

  body.mobile-actions-open .support-widget {
    opacity: 1 !important;
    pointer-events: auto !important;
    transform: translateY(0) scale(1) !important;
    transition-delay: 0.12s !important;
  }

  body:has(.support-chat.active) .support-widget {
    opacity: 1 !important;
    pointer-events: auto !important;
    transform: none !important;
    z-index: 1003 !important;
  }

  body:has(.support-chat.active) .support-widget .support-chat {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    z-index: 1004 !important;
  }
}
