/* ==========================================================================
   USMS Responsive CSS
   File: public/assets/css/responsive.css
   ========================================================================== */

@media (max-width: 1280px) {
  :root {
    --usms-left-panel-width: 360px;
    --usms-right-panel-width: 340px;
  }

  .app-shell {
    grid-template-columns: var(--usms-left-panel-width) minmax(0, 1fr);
  }

  .messages-list {
    padding-left: 28px;
    padding-right: 28px;
  }

  .message {
    max-width: 78%;
  }

  .right-panel {
    width: var(--usms-right-panel-width);
  }
}

@media (max-width: 1180px) {
  :root {
    --usms-left-panel-width: 340px;
    --usms-right-panel-width: 330px;
  }

  .current-user-info strong {
    max-width: 150px;
  }

  .chat-header-actions {
    gap: 0;
  }

  .chat-header-actions .icon-btn {
    width: 40px;
    height: 40px;
  }

  .empty-chat-card img {
    width: 150px;
  }

  .empty-chat-card h2 {
    font-size: 30px;
  }

  .messages-list {
    padding-left: 22px;
    padding-right: 22px;
  }

  .message {
    max-width: 82%;
  }

  .message-media img,
  .message-media video {
    max-width: 300px;
    max-height: 340px;
  }

  .room-info img {
    width: 104px;
    height: 104px;
  }
}

@media (max-width: 1080px) {
  :root {
    --usms-left-panel-width: 330px;
    --usms-right-panel-width: 320px;
  }

  .left-header {
    padding-left: 12px;
    padding-right: 12px;
  }

  .search-area {
    padding-left: 10px;
    padding-right: 10px;
  }

  .quick-tabs {
    padding-left: 10px;
    padding-right: 10px;
  }

  .stories-strip {
    padding-left: 10px;
    padding-right: 10px;
  }

  .chat-item {
    padding-left: 10px;
    padding-right: 10px;
  }

  .chat-header {
    padding-left: 10px;
    padding-right: 10px;
  }

  .chat-peer-text strong {
    max-width: 230px;
  }

  .chat-peer-text small {
    max-width: 230px;
  }

  .right-panel {
    position: fixed;
    top: 0;
    right: 0;
    z-index: var(--usms-z-panel);
    box-shadow: -24px 0 70px rgba(0, 0, 0, 0.35);
  }

  .right-panel.hidden {
    display: none !important;
  }
}

@media (max-width: 980px) {
  :root {
    --usms-left-panel-width: 320px;
    --usms-header-height: 62px;
    --usms-composer-height: 70px;
  }

  .app-shell {
    grid-template-columns: var(--usms-left-panel-width) minmax(0, 1fr);
  }

  .left-panel {
    grid-template-rows: var(--usms-header-height) 56px 46px auto 1fr;
  }

  .left-header {
    height: var(--usms-header-height);
  }

  .chat-header {
    height: var(--usms-header-height);
  }

  .chat-avatar-wrap,
  .chat-avatar {
    width: 50px;
    height: 50px;
  }

  .chat-item {
    min-height: 72px;
    grid-template-columns: 50px minmax(0, 1fr);
  }

  .chat-name {
    font-size: 14.5px;
  }

  .chat-last-message {
    font-size: 12.5px;
  }

  .quick-tab {
    min-height: 30px;
    padding-left: 10px;
    padding-right: 10px;
    font-size: 12.5px;
  }

  .story-avatar {
    width: 50px;
    height: 50px;
  }

  .story-mini {
    width: 58px;
  }

  .stories-strip {
    min-height: 88px;
  }

  .messages-list {
    padding-left: 18px;
    padding-right: 18px;
  }

  .message {
    max-width: 84%;
  }

  .message-content {
    font-size: 14px;
  }

  .message-file {
    min-width: 220px;
  }

  .composer-row {
    min-height: var(--usms-composer-height);
    grid-template-columns: 42px 42px minmax(0, 1fr) 42px 42px;
    gap: 5px;
    padding: 9px 10px;
  }

  .message-input-wrap {
    min-height: 44px;
  }

  .message-input-wrap textarea {
    min-height: 44px;
    padding-top: 12px;
    padding-bottom: 12px;
  }

  .send-btn {
    width: 42px;
    height: 42px;
  }

  .icon-btn {
    width: 40px;
    height: 40px;
  }

  .icon-btn span {
    font-size: 19px;
  }
}

@media (max-width: 860px) {
  :root {
    --usms-left-panel-width: 300px;
  }

  .app-shell {
    grid-template-columns: var(--usms-left-panel-width) minmax(0, 1fr);
  }

  .current-user-info {
    display: none;
  }

  .left-actions {
    margin-left: auto;
  }

  .chat-peer-text strong {
    max-width: 190px;
  }

  .chat-peer-text small {
    max-width: 190px;
  }

  .chat-header-actions .icon-btn {
    width: 38px;
    height: 38px;
  }

  .messages-list {
    padding-left: 14px;
    padding-right: 14px;
  }

  .message {
    max-width: 88%;
  }

  .empty-chat-card {
    padding: 20px;
  }

  .empty-chat-card img {
    width: 130px;
  }

  .empty-chat-card h2 {
    font-size: 28px;
  }

  .empty-chat-card p {
    font-size: 14px;
  }
}

@media (max-width: 760px) {
  :root {
    --usms-left-panel-width: 100vw;
    --usms-right-panel-width: 100vw;
    --usms-header-height: 60px;
    --usms-composer-height: 68px;
  }

  body {
    overflow: hidden;
  }

  .mobile-only {
    display: inline-grid !important;
  }

  .desktop-only {
    display: none !important;
  }

  .app-shell {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100dvh;
    display: block;
    overflow: hidden;
  }

  .left-panel {
    position: absolute;
    z-index: 10;
    inset: 0;
    width: 100vw;
    min-width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    transform: translateX(0);
    transition: transform 0.24s ease;
  }

  .chat-panel {
    position: absolute;
    z-index: 11;
    inset: 0;
    width: 100vw;
    height: 100dvh;
    transform: translateX(100%);
    transition: transform 0.24s ease;
  }

  .app-shell.chat-open .left-panel {
    transform: translateX(-100%);
  }

  .app-shell.chat-open .chat-panel {
    transform: translateX(0);
  }

  .right-panel {
    position: fixed;
    z-index: var(--usms-z-panel);
    inset: 0;
    width: 100vw;
    min-width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    border-left: 0;
    transform: translateX(0);
  }

  .right-panel.hidden {
    display: none !important;
  }

  .left-header,
  .chat-header,
  .right-panel-header {
    height: var(--usms-header-height);
    min-height: var(--usms-header-height);
    padding-left: 10px;
    padding-right: 10px;
  }

  .left-panel {
    grid-template-rows: var(--usms-header-height) 56px 46px auto 1fr;
  }

  .current-user-info {
    display: grid;
  }

  .current-user-info strong {
    max-width: 160px;
  }

  .search-area {
    padding: 7px 10px;
  }

  .search-box {
    min-height: 40px;
  }

  .search-box input {
    height: 40px;
  }

  .quick-tabs {
    padding: 6px 10px;
  }

  .stories-strip {
    min-height: 86px;
    padding: 9px 10px;
  }

  .chat-list {
    padding-bottom: env(safe-area-inset-bottom);
  }

  .chat-item {
    min-height: 74px;
    grid-template-columns: 52px minmax(0, 1fr);
    padding: 10px;
  }

  .chat-avatar-wrap,
  .chat-avatar {
    width: 52px;
    height: 52px;
  }

  .chat-name {
    font-size: 15px;
  }

  .chat-last-message {
    font-size: 13px;
  }

  .chat-peer {
    gap: 9px;
  }

  .chat-peer-avatar-wrap,
  .chat-peer-avatar-wrap img {
    width: 40px;
    height: 40px;
  }

  .chat-peer-text strong {
    max-width: calc(100vw - 230px);
    font-size: 14.5px;
  }

  .chat-peer-text small {
    max-width: calc(100vw - 230px);
    font-size: 11.5px;
  }

  .chat-header-actions {
    gap: 0;
  }

  .chat-header-actions .icon-btn {
    width: 36px;
    height: 36px;
  }

  .chat-header-actions .icon-btn span {
    font-size: 17px;
  }

  .active-chat {
    height: 100dvh;
    grid-template-rows: var(--usms-header-height) auto auto minmax(0, 1fr) auto;
  }

  .messages-viewport {
    padding-top: 12px;
    padding-bottom: 12px;
  }

  .messages-list {
    width: 100%;
    padding-left: 10px;
    padding-right: 10px;
  }

  .message {
    max-width: 89%;
  }

  .message-bubble {
    padding: 7px 8px 6px;
    border-radius: 11px;
  }

  .message-content {
    font-size: 14px;
    line-height: 1.4;
  }

  .message-media img,
  .message-media video {
    max-width: min(270px, 72vw);
    max-height: 330px;
  }

  .message-file {
    min-width: min(240px, 72vw);
    max-width: min(300px, 78vw);
  }

  .typing-indicator {
    padding-left: 14px;
    padding-right: 14px;
  }

  .scroll-bottom {
    right: 14px;
    bottom: 14px;
    width: 38px;
    height: 38px;
  }

  .composer {
    padding-bottom: env(safe-area-inset-bottom);
  }

  .composer-row {
    min-height: var(--usms-composer-height);
    grid-template-columns: 40px 40px minmax(0, 1fr) 40px 40px;
    gap: 4px;
    padding: 8px;
  }

  .composer-row .icon-btn {
    width: 40px;
    height: 40px;
  }

  .message-input-wrap {
    min-height: 42px;
    border-radius: 21px;
  }

  .message-input-wrap textarea {
    min-height: 42px;
    max-height: 126px;
    padding: 11px 13px;
    font-size: 14px;
  }

  .send-btn {
    width: 40px;
    height: 40px;
  }

  .reply-preview {
    margin: 8px 8px 0;
  }

  .attachment-panel {
    left: 8px;
    right: 8px;
    bottom: calc(var(--usms-composer-height) + env(safe-area-inset-bottom) + 8px);
    width: auto;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .attachment-panel button {
    min-height: 58px;
  }

  .emoji-panel {
    left: 8px;
    right: 8px;
    bottom: calc(var(--usms-composer-height) + env(safe-area-inset-bottom) + 8px);
    width: auto;
  }

  .emoji-grid {
    grid-template-columns: repeat(7, 1fr);
    max-height: 210px;
  }

  .recording-bar {
    padding-left: 10px;
    padding-right: 10px;
  }

  .pinned-message-bar {
    min-height: 44px;
    padding-left: 8px;
    padding-right: 8px;
  }

  .chat-search-panel {
    padding: 7px 8px;
  }

  .right-panel-body {
    padding: 14px;
  }

  .room-info {
    padding-top: 14px;
  }

  .room-info img {
    width: 104px;
    height: 104px;
  }

  .room-info h2 {
    font-size: 20px;
  }

  .room-info-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .dropdown-menu {
    max-width: calc(100vw - 24px);
  }

  .modal-backdrop {
    padding: 12px;
  }

  .modal-card {
    width: 100%;
    max-height: calc(100dvh - 24px);
    border-radius: 22px;
  }

  .modal-header {
    min-height: 58px;
    padding-left: 14px;
    padding-right: 14px;
  }

  .modal-body {
    padding: 14px;
  }

  .modal-footer {
    padding: 12px 14px;
  }

  .story-viewer {
    height: 100dvh;
  }

  .incoming-call {
    padding: 14px;
  }

  .incoming-call-card {
    width: min(350px, 100%);
    padding: 28px 20px 22px;
  }

  .call-overlay {
    padding: 0;
  }

  .call-window {
    width: 100vw;
    height: 100dvh;
    border: 0;
    border-radius: 0;
  }

  .toast-root {
    left: 12px;
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom));
    width: auto;
  }
}

@media (max-width: 640px) {
  .current-user-info strong {
    max-width: 135px;
  }

  .chat-peer-text strong {
    max-width: calc(100vw - 215px);
  }

  .chat-peer-text small {
    max-width: calc(100vw - 215px);
  }

  .chat-header-actions .icon-btn {
    width: 34px;
    height: 34px;
  }

  .chat-header-actions .icon-btn span {
    font-size: 16px;
  }

  .message {
    max-width: 91%;
  }

  .room-info-actions {
    gap: 6px;
  }

  .room-info-actions button {
    font-size: 11px;
  }

  .media-preview-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .incoming-call-card img {
    width: 104px;
    height: 104px;
  }

  .incoming-call-card h3 {
    font-size: 23px;
  }
}

@media (max-width: 520px) {
  .left-header {
    gap: 8px;
  }

  .avatar-btn {
    width: 42px;
    height: 42px;
  }

  .current-user {
    gap: 9px;
  }

  .current-user-info strong {
    max-width: 118px;
    font-size: 14px;
  }

  .current-user-info span {
    font-size: 11.5px;
  }

  .left-actions .icon-btn {
    width: 36px;
    height: 36px;
  }

  .left-actions .icon-btn span {
    font-size: 17px;
  }

  .chat-peer-text strong {
    max-width: calc(100vw - 200px);
  }

  .chat-peer-text small {
    max-width: calc(100vw - 200px);
  }

  #chatSearchBtn {
    display: none;
  }

  .chat-header-actions {
    gap: 0;
  }

  .messages-list {
    padding-left: 8px;
    padding-right: 8px;
  }

  .message {
    max-width: 92%;
  }

  .message-meta {
    font-size: 10.5px;
  }

  .composer-row {
    grid-template-columns: 38px 38px minmax(0, 1fr) 38px 38px;
  }

  .composer-row .icon-btn,
  .send-btn {
    width: 38px;
    height: 38px;
  }

  .composer-row .icon-btn span {
    font-size: 18px;
  }

  .message-input-wrap {
    min-height: 40px;
  }

  .message-input-wrap textarea {
    min-height: 40px;
    padding: 10px 12px;
  }

  .attachment-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .emoji-grid {
    grid-template-columns: repeat(6, 1fr);
  }

  .story-mini {
    width: 54px;
  }

  .story-avatar {
    width: 48px;
    height: 48px;
  }

  .story-mini small {
    font-size: 10.5px;
  }

  .chat-item {
    min-height: 70px;
    grid-template-columns: 48px minmax(0, 1fr);
  }

  .chat-avatar-wrap,
  .chat-avatar {
    width: 48px;
    height: 48px;
  }

  .chat-name {
    font-size: 14px;
  }

  .chat-last-message {
    font-size: 12.5px;
  }

  .chat-time {
    font-size: 10.5px;
  }

  .chat-unread {
    min-width: 20px;
    height: 20px;
    font-size: 10.5px;
  }
}

@media (max-width: 430px) {
  :root {
    --usms-header-height: 58px;
    --usms-composer-height: 66px;
  }

  .current-user-info {
    display: none;
  }

  .left-actions {
    gap: 1px;
  }

  .left-actions .icon-btn {
    width: 38px;
    height: 38px;
  }

  .search-area {
    padding: 7px 8px;
  }

  .quick-tabs {
    padding-left: 8px;
    padding-right: 8px;
    gap: 6px;
  }

  .quick-tab {
    min-height: 29px;
    padding-left: 10px;
    padding-right: 10px;
    font-size: 12px;
  }

  .stories-strip {
    min-height: 82px;
    padding: 8px;
    gap: 8px;
  }

  .story-mini {
    width: 50px;
  }

  .story-avatar {
    width: 46px;
    height: 46px;
  }

  .story-avatar b {
    width: 18px;
    height: 18px;
    font-size: 12px;
  }

  .chat-item {
    min-height: 68px;
    grid-template-columns: 46px minmax(0, 1fr);
    gap: 10px;
    padding: 9px 8px;
  }

  .chat-avatar-wrap,
  .chat-avatar {
    width: 46px;
    height: 46px;
  }

  .status-dot {
    width: 11px;
    height: 11px;
  }

  .chat-peer {
    gap: 8px;
  }

  .chat-peer-avatar-wrap,
  .chat-peer-avatar-wrap img {
    width: 38px;
    height: 38px;
  }

  .chat-peer-text strong {
    max-width: calc(100vw - 178px);
    font-size: 14px;
  }

  .chat-peer-text small {
    max-width: calc(100vw - 178px);
    font-size: 11px;
  }

  #audioCallBtn {
    display: none;
  }

  .chat-header-actions .icon-btn {
    width: 33px;
    height: 33px;
  }

  .message {
    max-width: 94%;
  }

  .message-bubble {
    min-width: 64px;
    padding: 6px 7px 5px;
  }

  .message-content {
    font-size: 13.8px;
  }

  .message-media img,
  .message-media video {
    max-width: min(238px, 72vw);
    max-height: 300px;
  }

  .message-file {
    min-width: min(220px, 76vw);
    grid-template-columns: 38px minmax(0, 1fr);
  }

  .message-file-icon {
    width: 38px;
    height: 38px;
  }

  .composer-row {
    grid-template-columns: 36px 36px minmax(0, 1fr) 36px 36px;
    padding: 7px;
  }

  .composer-row .icon-btn,
  .send-btn {
    width: 36px;
    height: 36px;
  }

  .message-input-wrap {
    border-radius: 20px;
  }

  .message-input-wrap textarea {
    font-size: 13.8px;
  }

  .reply-preview {
    margin-left: 7px;
    margin-right: 7px;
    padding: 8px;
  }

  .attachment-panel button {
    min-height: 54px;
    font-size: 11.5px;
  }

  .attachment-panel button span {
    width: 28px;
    height: 28px;
  }

  .emoji-tabs button {
    min-width: 32px;
    height: 32px;
  }

  .emoji-grid button {
    height: 34px;
    font-size: 20px;
  }

  .right-panel-body {
    padding: 12px;
  }

  .room-info img {
    width: 96px;
    height: 96px;
  }

  .room-info h2 {
    font-size: 19px;
  }

  .room-info-actions {
    grid-template-columns: 1fr;
  }

  .info-row,
  .danger-row {
    min-height: 44px;
  }

  .modal-card {
    border-radius: 20px;
  }

  .incoming-call-actions {
    gap: 10px;
  }

  .call-reject,
  .call-accept {
    min-height: 50px;
  }

  .empty-chat-card {
    padding: 16px;
  }

  .empty-chat-card h2 {
    font-size: 26px;
  }
}

@media (max-width: 360px) {
  .chat-peer-text strong {
    max-width: calc(100vw - 162px);
  }

  .chat-peer-text small {
    max-width: calc(100vw - 162px);
  }

  #videoCallBtn {
    display: none;
  }

  .composer-row {
    grid-template-columns: 34px 34px minmax(0, 1fr) 34px 34px;
    gap: 3px;
  }

  .composer-row .icon-btn,
  .send-btn {
    width: 34px;
    height: 34px;
  }

  .composer-row .icon-btn span {
    font-size: 16px;
  }

  .message {
    max-width: 96%;
  }

  .message-media img,
  .message-media video {
    max-width: min(220px, 74vw);
  }

  .emoji-grid {
    grid-template-columns: repeat(5, 1fr);
  }

  .attachment-panel {
    grid-template-columns: 1fr 1fr;
  }

  .chat-name {
    font-size: 13.5px;
  }

  .chat-last-message {
    font-size: 12px;
  }

  .quick-tab {
    font-size: 11.5px;
    padding-left: 8px;
    padding-right: 8px;
  }
}

@media (max-height: 620px) and (max-width: 760px) {
  .stories-strip {
    display: none;
  }

  .left-panel {
    grid-template-rows: var(--usms-header-height) 56px 46px 1fr;
  }

  .emoji-panel {
    max-height: 250px;
  }

  .emoji-grid {
    max-height: 160px;
  }

  .attachment-panel button {
    min-height: 48px;
  }

  .room-info {
    padding-top: 8px;
    padding-bottom: 14px;
  }

  .room-info img {
    width: 82px;
    height: 82px;
  }
}

@media (orientation: landscape) and (max-height: 520px) {
  .incoming-call-card {
    padding: 18px;
  }

  .incoming-call-card img {
    width: 76px;
    height: 76px;
  }

  .incoming-call-card h3 {
    margin-top: 6px;
    font-size: 20px;
  }

  .incoming-call-actions {
    margin-top: 8px;
  }

  .call-window {
    grid-template-rows: 54px 1fr 70px;
  }

  .call-header {
    min-height: 54px;
  }

  .call-actions {
    min-height: 70px;
    padding: 10px;
  }

  .call-control {
    width: 48px;
    height: 48px;
  }

  #localVideo {
    width: 120px;
    height: 88px;
  }
}

@media (hover: none) {
  .chat-item:hover,
  .icon-btn:hover,
  .quick-tab:hover,
  .info-row:hover,
  .danger-row:hover,
  .attachment-panel button:hover,
  .emoji-grid button:hover,
  .emoji-tabs button:hover {
    background: inherit;
  }

  .icon-btn:active,
  .chat-item:active,
  .quick-tab:active {
    background: rgba(134, 150, 160, 0.14);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}