/* Mobile Styles for TempSend - Optimized for all mobile devices */

/* Fix background and prevent horizontal scroll */
html, body {
  width: 100%;
  overflow-x: hidden;
  background: var(--body-gradient);
  background-attachment: fixed;
  background-size: cover;
  background-repeat: no-repeat;
  min-height: 100vh;
  position: relative;
}

body::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--body-gradient);
  z-index: -1;
  pointer-events: none;
}

* {
  max-width: 100%;
  box-sizing: border-box;
}

/* Base Mobile Styles */
@media (max-width: 768px) {
  /* Ensure body background extends fully */
  html {
    height: 100%;
    overflow-x: hidden;
  }

  body {
    min-height: 100vh;
    min-height: -webkit-fill-available; /* iOS Safari */
    overflow-x: hidden;
    position: relative;
    background: var(--body-gradient);
    background-attachment: fixed;
    background-size: cover;
    background-repeat: no-repeat;
  }

  /* Prevent horizontal scroll */
  * {
    max-width: 100vw;
    box-sizing: border-box;
  }

  img, video, iframe, svg {
    max-width: 100%;
    height: auto;
  }

  /* Container and Layout */
  .container {
    padding: 1rem 0.75rem;
    max-width: 100%;
    width: 100%;
    overflow-x: hidden;
  }

  header {
    margin-bottom: 1.5rem;
    text-align: center;
  }

  header h1 {
    font-size: 1.75rem;
    text-align: center;
  }

  header p {
    text-align: center;
    font-size: 0.9rem;
  }

  .subtitle {
    font-size: 0.875rem;
  }

  .card {
    padding: 1.25rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
  }

  .card h2 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    text-align: center;
  }

  .card p {
    font-size: 0.875rem;
    line-height: 1.5;
  }

  /* Front page specific styles */
  #create-room-section .options {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
  }

  #create-room-section .option-group {
    gap: 1rem;
    width: 100%;
  }

  /* Make option rows stack nicely on mobile */
  #create-room-section .option-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    width: 100%;
  }

  #create-room-section .option-row label {
    font-size: 0.875rem;
    white-space: nowrap;
    margin: 0;
  }

  #create-room-section .option-row select {
    flex: 1;
    min-width: 150px;
    min-height: 44px;
    font-size: 0.875rem;
    max-width: 100%;
  }

  #create-room-section #create-room-btn {
    width: 100%;
    margin-top: 0.5rem;
    min-height: 44px;
  }

  /* Make password protected section nicer on mobile */
  #create-room-section .option-row.password-row {
    align-items: center;
  }

  #create-room-section .option-row.password-row .toggle-switch {
    width: fit-content;
    justify-content: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
    margin: 0 auto;
  }

  #create-room-section .lock-icon {
    width: 18px;
    height: 18px;
  }

  #create-room-section #room-password {
    width: 100% !important;
    min-height: 44px;
    margin: 0;
    max-width: 100% !important;
  }

  /* Room Name Section */
  #room-name-container {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
  }

  #room-name-display {
    font-size: 1.25rem;
    flex-wrap: nowrap;
    gap: 0.5rem;
    justify-content: center !important; /* Always center by default on mobile */
    position: relative;
    overflow: hidden;
  }

  /* When room options button is visible, use space-between */
  #room-name-display:has(#room-options-btn:not(.hidden)) {
    justify-content: space-between !important;
  }

  /* When room options button is hidden, use a centered layout with share button on left */
  #room-name-display:not(:has(#room-options-btn:not(.hidden))) {
    justify-content: center !important;
    position: relative;
  }

  /* Share button container - keep in flow but don't affect centering */
  #room-name-display:not(:has(#room-options-btn:not(.hidden))) > div:first-child {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    pointer-events: none; /* Let clicks pass through to button */
  }
  
  /* Ensure share button itself is clickable */
  #room-name-display:not(:has(#room-options-btn:not(.hidden))) > div:first-child > button {
    pointer-events: auto !important;
    position: relative;
    z-index: 11;
  }

  #room-name-text {
    flex-wrap: nowrap;
    gap: 0.5rem;
    flex: 1;
    justify-content: center !important;
    order: 2;
    min-width: 0;
    text-align: center !important;
    display: flex;
    align-items: center;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
    -webkit-overflow-scrolling: touch;
    padding: 0 0.5rem;
    margin: 0 auto; /* Center the text when share button is absolute */
  }

  #room-name-text::-webkit-scrollbar {
    height: 4px;
  }

  #room-name-text::-webkit-scrollbar-track {
    background: transparent;
  }

  #room-name-text::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 2px;
  }

  #room-name-text-inner {
    white-space: nowrap;
    font-size: 1.125rem;
  }

  /* Share button on left */
  #share-btn-header {
    order: 1;
    flex-shrink: 0;
    min-width: 40px;
    min-height: 40px;
    width: 40px;
    height: 40px;
    padding: 0.5rem;
    margin: 0;
    background: transparent !important;
    border: none !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    pointer-events: auto !important;
    cursor: pointer !important;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    user-select: none;
    touch-action: manipulation;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
    z-index: 11;
    position: relative;
  }
  
  /* Share menu container - prevent pull-to-refresh */
  #share-btn-header + div,
  #share-menu-header {
    touch-action: manipulation;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
  }
  
  /* Share menu and room options menu - match room-info-compact width on mobile */
  #share-menu-header:not(.hidden),
  #room-options-menu {
    /* Width will be set dynamically in JavaScript to match .room-info-compact */
    max-width: calc(100vw - 2rem); /* Account for container padding */
  }
  
  /* Prevent pull-to-refresh when interacting with share button area */
  #room-name-display > div:first-child {
    touch-action: manipulation;
    overscroll-behavior-y: contain;
  }
  
  #share-btn-header svg {
    width: 18px;
    height: 18px;
  }
  
  /* Owner options to the far right */
  #room-options-btn {
    order: 3;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    user-select: none;
  }

  #room-name-edit {
    margin-top: 0.75rem;
  }

  #room-name-input {
    max-width: 100%;
    font-size: 0.95rem;
    padding: 0.75rem;
  }

  /* Buttons */
  .btn {
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    min-height: 44px; /* Touch-friendly size */
  }

  .btn-small {
    padding: 0.5rem 0.75rem;
    font-size: 0.8125rem;
    min-height: 40px;
  }

  .btn-icon {
    min-width: 44px;
    min-height: 44px;
  }

  .btn-icon-small {
    min-width: 40px;
    min-height: 40px;
    padding: 0.5rem;
  }

  /* Room Info */
  .download-info {
    margin-top: 0.75rem;
    font-size: 0.875rem;
  }

  .status {
    font-size: 0.875rem;
    padding: 0.75rem;
  }

  /* File Upload Section */
  .upload-section {
    margin-bottom: 1.5rem;
  }

  .upload-area {
    padding: 2rem 1rem;
    min-height: 150px;
  }

  .upload-area.dragover {
    padding: 1.875rem 0.875rem;
  }

  .file-details {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .actions {
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
  }

  .actions .btn {
    width: 100%;
  }

  /* File Grid */
  .files-preview,
  .uploaded-files-grid,
  .files-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.75rem;
  }

  .uploaded-file-item {
    min-height: 140px;
  }

  .file-thumbnail {
    height: 120px;
  }

  .file-info {
    padding: 0.5rem;
    font-size: 0.75rem;
  }

  .file-name {
    font-size: 0.75rem;
    line-height: 1.3;
  }

  /* Chat Section */
  .chat-section {
    margin-top: 1.5rem;
  }

  .chat-header {
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
    gap: 0.5rem;
    position: relative;
  }

  .chat-header h3 {
    font-size: 1.125rem;
  }

  .chat-wrapper {
    flex-direction: column;
    gap: 0.75rem;
    position: relative;
  }

  .users-sidebar {
    width: 100%;
    max-width: 100%;
    max-height: 300px;
    order: 0;
    margin-bottom: 0.75rem;
    position: relative;
    top: auto;
    right: auto;
    left: auto;
    bottom: auto;
    transform: none;
  }

  .users-sidebar:not(.hidden) {
    display: flex;
  }

  .users-sidebar-header {
    padding: 0.75rem 1rem;
    gap: 0.75rem;
    min-height: 48px;
    display: flex !important;
    justify-content: space-between;
    align-items: center;
    width: 100%;
  }

  .users-sidebar-header h4 {
    flex: 1;
    min-width: 0;
    margin: 0 !important;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    order: 1;
  }

  #close-users-sidebar {
    flex-shrink: 0;
    margin-left: 0.5rem;
    order: 2;
    width: auto;
    height: auto;
  }

  .chat-container {
    order: 1;
    width: 100%;
    display: flex;
    flex-direction: column;
    height: auto;
    max-height: calc(100vh - 200px);
  }

  .chat-tabs {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--bg-color);
    border-bottom: 1px solid var(--border-color);
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
    -webkit-overflow-scrolling: touch;
    flex-shrink: 0;
  }

  .chat-tabs::-webkit-scrollbar {
    height: 4px;
  }

  .chat-tabs::-webkit-scrollbar-track {
    background: transparent;
  }

  .chat-tabs::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 2px;
  }

  .chat-tab {
    padding: 0.5rem 1rem;
    border: 2px solid transparent;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
    white-space: nowrap;
    flex-shrink: 0;
  }

  .chat-tab:hover {
    background: var(--card-bg);
  }

  .chat-tab.active {
    background: var(--primary-color);
    color: white;
  }

  .chat-tab.has-unread-pm {
    border-color: var(--error-color);
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.5), 0 0 20px rgba(239, 68, 68, 0.3);
    animation: pm-glow 2s ease-in-out infinite alternate;
  }

  .chat-messages {
    height: 250px;
    min-height: 200px;
    max-height: 400px;
    padding: 0.75rem;
    gap: 0.5rem;
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .chat-message {
    padding: 0;
    margin-bottom: 0;
    width: 100%;
    max-width: 100%;
  }

  .chat-message.own-message {
    /* No special styling for own messages in linear chat format */
  }

  .chat-message-header {
    font-size: 0.7rem;
    gap: 0.375rem;
  }

  .chat-username {
    font-size: 0.75rem;
  }

  .chat-time {
    font-size: 0.65rem;
  }

  .chat-message-text {
    font-size: 0.875rem;
    line-height: 1.4;
  }

  .delete-message-btn {
    margin-left: auto !important;
    flex-shrink: 0 !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    padding: 0.25rem !important;
    height: fit-content !important;
    min-height: 0 !important;
    max-height: 1.2em !important;
    min-width: 0 !important;
    width: auto !important;
    line-height: 1 !important;
    vertical-align: middle !important;
    display: inline-flex !important;
    align-items: center !important;
  }

  .delete-message-btn svg {
    width: 14px !important;
    height: 14px !important;
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .chat-message-line {
    line-height: 1.2;
    margin: 5px;
    padding: 0;
    width: 100%;
    display: flex;
    align-items: center;
  }

  .chat-input-container {
    padding: 0.75rem;
    gap: 0.5rem;
    position: sticky;
    bottom: 0;
    z-index: 100;
    background: var(--bg-color);
    border-top: 1px solid var(--border-color);
  }

  .chat-input {
    font-size: 0.875rem;
    padding: 0.625rem;
    min-height: 44px;
  }

  .chat-send-btn {
    min-width: 44px;
    min-height: 44px;
    width: 44px;
    height: 44px;
    padding: 0;
    flex-shrink: 0;
  }

  .chat-input-container {
    gap: 0.5rem;
  }

  .chat-input {
    flex: 1;
  }
  
  /* Prevent scrollIntoView behavior on mobile */
  .chat-input:focus {
    scroll-margin: 0;
  }
  

  /* Modal Styles */
  .modal-content {
    padding: 1rem;
    border-radius: 12px;
    max-width: 95vw;
    max-height: 95vh;
  }

  .modal-top-bar {
    padding: 0.625rem 1rem;
    min-height: 3rem;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .modal-top-info {
    gap: 0.5rem;
    flex: 1 1 100%;
    min-width: 0;
  }

  .modal-top-info .modal-filename {
    font-size: 0.875rem;
  }

  .modal-top-info .modal-details {
    font-size: 0.7rem;
  }

  .modal-top-info .modal-index {
    font-size: 0.7rem;
  }

  .modal-top-actions {
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: space-between;
    width: 100%;
  }

  .modal-vote-container {
    gap: 0.375rem;
    margin-right: auto;
    order: 1;
  }

  .modal-download-icon,
  .modal-close {
    order: 2;
  }

  .modal-vote-container .vote-btn {
    width: 32px;
    height: 32px;
  }

  .modal-vote-container .vote-btn svg {
    width: 14px;
    height: 14px;
  }

  .modal-vote-container .vote-count {
    font-size: 0.8125rem;
    min-width: 1.75rem;
  }

  .modal-download-icon,
  .modal-close {
    width: 36px;
    height: 36px;
  }

  .modal-download-icon svg {
    width: 16px;
    height: 16px;
  }

  .modal-close {
    font-size: 22px;
  }

  .modal-content {
    padding-top: 3.5rem;
  }

  .modal-nav {
    width: 40px;
    height: 40px;
  }

  .modal-nav-prev {
    left: 0.75rem;
  }

  .modal-nav-next {
    right: 0.75rem;
  }

  .modal-image-container {
    padding: 0.5rem;
  }

  /* Custom Modals */
  .custom-modal-content {
    max-width: 95vw;
    padding: 1.5rem 1rem;
    margin: 1rem;
  }

  .custom-modal-content h2 {
    font-size: 1.25rem;
  }

  .custom-modal-content p {
    font-size: 0.875rem;
  }

  /* Forms */
  .option-group {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  /* Make "File's Expires In:" label and select side by side on mobile */
  .option-group:has(#file-expires-in) {
    flex-direction: row;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
  }

  .option-group:has(#file-expires-in) label {
    white-space: nowrap;
    margin: 0;
    font-size: 0.875rem;
  }

  .option-group:has(#file-expires-in) select {
    width: auto;
    min-width: 150px;
    flex: 1;
    max-width: 100%;
  }

  .option-group select,
  .option-group input[type="number"],
  .option-group input[type="text"] {
    width: 100%;
    min-height: 44px;
    font-size: 0.875rem;
  }

  /* Share Menu */
  #share-menu-header {
    min-width: 180px;
    right: 0;
    left: auto;
  }

  /* File Options Menu */
  .file-options-menu {
    min-width: 160px;
    bottom: 2.25rem;
    left: 0.25rem;
  }

  .file-option-item {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    min-height: 44px;
  }
  
  /* Make options button nicer and smaller on mobile */
  .btn-options-overlay {
    opacity: 0.85 !important;
    width: 28px !important;
    height: 28px !important;
    min-width: 28px !important;
    min-height: 28px !important;
    background: rgba(0, 0, 0, 0.6) !important;
    backdrop-filter: blur(4px) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 50% !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2) !important;
  }
  
  .btn-options-overlay:active {
    transform: scale(0.95) !important;
  }
  
  .btn-options-overlay svg {
    width: 14px !important;
    height: 14px !important;
  }
  
  /* Copy warning - full width on mobile */
  .copy-warning {
    left: 0 !important;
    right: 0 !important;
    transform: none !important;
    max-width: 100% !important;
    width: calc(100% - 2rem) !important;
    margin: 0 1rem !important;
    border-radius: 8px !important;
    padding: 1rem 1.25rem !important;
    font-size: 0.875rem !important;
    background: rgba(239, 68, 68, 0.15) !important;
    backdrop-filter: blur(10px) !important;
    border: 1px solid rgba(239, 68, 68, 0.3) !important;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2) !important;
  }

  /* Pin Badge */
  .pin-badge {
    position: absolute !important;
    top: auto !important;
    left: auto !important;
    bottom: 0.5rem !important;
    right: 0.5rem !important;
    padding: 0.25rem !important;
    width: fit-content !important;
    height: fit-content !important;
    min-width: fit-content !important;
    min-height: fit-content !important;
    max-width: fit-content !important;
    max-height: fit-content !important;
    flex: none !important;
    flex-shrink: 0 !important;
    flex-grow: 0 !important;
    box-sizing: content-box !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    overflow: visible !important;
  }

  .pin-badge svg {
    width: 14px !important;
    height: 14px !important;
    display: block !important;
    flex-shrink: 0 !important;
    flex-grow: 0 !important;
  }

  /* Vote Container */
  .vote-container {
    gap: 0.25rem;
  }

  .vote-btn {
    width: 32px;
    height: 32px;
  }

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

  .vote-count {
    font-size: 0.75rem;
    min-width: 1.5rem;
  }

  /* Room Info Grid */
  .room-info-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .info-item {
    padding: 0.75rem;
  }

  .info-label {
    font-size: 0.75rem;
  }

  .info-value {
    font-size: 1rem;
  }

  /* Security Details */
  .security-details {
    padding: 0.75rem;
    font-size: 0.875rem;
  }

  .security-details-content {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    justify-content: center;
  }

  .security-details-content .security-badge {
    margin: 0;
    flex-shrink: 0;
  }

  .security-details-content .security-help-link {
    flex-basis: 100%;
    width: 100%;
    justify-content: center;
    margin-top: 0.5rem;
  }

  /* Users List */
  .users-list {
    padding: 0.75rem;
    gap: 0.5rem;
  }

  .user-item {
    padding: 0.625rem;
    font-size: 0.875rem;
  }

  /* QR Code Modal */
  #qr-code-container {
    width: 280px;
    height: 280px;
    padding: 1rem;
  }

  /* Touch-friendly spacing */
  * {
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
  }

  button,
  .btn,
  .clickable {
    cursor: pointer;
    -webkit-tap-highlight-color: rgba(255, 255, 255, 0.1);
  }

  /* Prevent text selection on buttons */
  button,
  .btn {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
  }

  /* Better scrolling on mobile */
  .chat-messages,
  .users-list,
  .modal-image-container {
    -webkit-overflow-scrolling: touch;
    overflow-scrolling: touch;
  }

  /* Safe area insets for notched devices */
  @supports (padding: max(0px)) {
    .container {
      padding-left: max(1rem, env(safe-area-inset-left));
      padding-right: max(1rem, env(safe-area-inset-right));
    }

    header {
      padding-top: max(1rem, env(safe-area-inset-top));
    }

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

  /* Fix white space at bottom */
  body::before {
    content: '';
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 100vh;
    background: var(--body-gradient);
    z-index: -2;
    pointer-events: none;
  }

  /* Ensure all sections have proper background */
  section, .card, .chat-section, .upload-section {
    position: relative;
    z-index: 1;
  }

  /* Prevent elements from causing horizontal scroll */
  .card, .container, section, header, footer {
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
  }

  /* Fix any elements that might overflow */
  .upload-area, .chat-messages, .files-grid, .uploaded-files-grid {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  /* Ensure modals don't cause horizontal scroll */
  .fullscreen-modal, .custom-modal {
    width: 100vw;
    max-width: 100vw;
    overflow-x: hidden;
  }

  .modal-content {
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
  }

  /* Share Button */
  #share-btn-header {
    min-width: 36px !important;
    min-height: 36px !important;
    padding: 0.5rem !important;
  }

  #share-btn-header svg {
    width: 16px !important;
    height: 16px !important;
  }

  /* ETH Address Section */
  footer {
    padding: 1rem 0.75rem;
    margin-top: 2rem;
    text-align: center;
  }

  footer p {
    font-size: 0.8125rem;
    word-wrap: break-word;
    margin-bottom: 0.5rem;
  }

  footer > div {
    flex-direction: row;
    align-items: center !important;
    gap: 0.5rem;
    width: 100%;
    margin-top: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
  }

  footer > div p {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    margin: 0;
  }

  footer > div p a {
    white-space: nowrap;
    font-size: 0.8rem !important;
  }

  footer code {
    font-size: 0.7rem !important;
    padding: 0.625rem 0.75rem !important;
    display: flex;
    flex: 1;
    text-align: left;
    max-width: 100%;
    white-space: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    line-height: 1.4;
    min-width: 0;
    box-sizing: border-box;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
  }

  footer code::-webkit-scrollbar {
    height: 4px;
  }

  footer code::-webkit-scrollbar-track {
    background: transparent;
  }

  footer code::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 2px;
  }

  #copy-eth-btn {
    min-width: 36px;
    min-height: 36px;
    width: 36px;
    height: 36px;
    padding: 0.5rem;
    flex-shrink: 0;
  }

  #copy-eth-btn svg {
    width: 16px;
    height: 16px;
  }
}

/* Extra Small Devices (phones in portrait) */
@media (max-width: 480px) {
  .container {
    padding: 0.75rem 0.5rem;
  }

  header h1 {
    font-size: 1.5rem;
  }

  .card {
    padding: 0.75rem;
  }

  #room-name-display {
    font-size: 1.125rem;
  }

  #room-name-text-inner {
    font-size: 1rem;
  }

  .files-preview,
  .uploaded-files-grid,
  .files-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.5rem;
  }

  .uploaded-file-item {
    min-height: 120px;
  }

  .file-thumbnail {
    height: 100px;
  }

  .chat-messages {
    height: 200px;
    padding: 0.5rem;
  }

  .chat-message {
    max-width: 100%;
    padding: 0;
    margin-bottom: 0;
    width: 100%;
    font-size: 0.8125rem;
  }

  .modal-top-bar {
    padding: 0.5rem 0.75rem;
    min-height: 2.75rem;
  }

  .modal-top-info .modal-filename {
    font-size: 0.8125rem;
  }

  .modal-top-info .modal-details {
    font-size: 0.65rem;
  }

  .modal-top-info .modal-index {
    font-size: 0.65rem;
  }

  .modal-vote-container .vote-btn {
    width: 28px;
    height: 28px;
  }

  .modal-vote-container .vote-btn svg {
    width: 12px;
    height: 12px;
  }

  .modal-download-icon,
  .modal-close {
    width: 32px;
    height: 32px;
  }

  .modal-close {
    font-size: 20px;
  }

  .modal-nav {
    width: 36px;
    height: 36px;
  }

  .modal-nav-prev {
    left: 0.5rem;
  }

  .modal-nav-next {
    right: 0.5rem;
  }

  #qr-code-container {
    width: 240px;
    height: 240px;
    padding: 0.75rem;
  }
}

/* Landscape orientation adjustments */
@media (max-width: 768px) and (orientation: landscape) {
  .chat-messages {
    height: 180px;
  }

  .users-sidebar {
    max-height: 200px;
  }

  .modal-content {
    max-height: 90vh;
  }

  .modal-image-container {
    padding: 0.25rem;
  }
}

/* High DPI displays */
@media (max-width: 768px) and (-webkit-min-device-pixel-ratio: 2) {
  .btn,
  .file-thumbnail,
  .modal-nav {
    border-width: 0.5px;
  }
}

