/* Mobile-specific styles for screens up to 959px */
@media (max-width: 959px) {
  /* Base layout adjustments */
  html {
    height: 100%;
    min-height: 100%;
    margin: 0;
    padding: 0;
  }

  body {
    min-height: 100vh;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    font-size: 16px;
    overflow-x: hidden;
    width: 100%;
    max-width: 100%;
    background: transparent !important;
  }

  main {
    padding: 0.5rem 1rem;
    margin: 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    box-shadow: none;
    border: none;
    background: none;
  }

  * {
    box-sizing: border-box;
  }

  /* Mobile navigation - Enhanced with more specific selectors */
  /* Show user dashboard only when authenticated */
  body.authenticated #user-dashboard.dashboard-nav,
  html body.authenticated #user-dashboard.dashboard-nav,
  body.authenticated #user-dashboard.dashboard-nav:not(.hidden) {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    height: auto !important;
    position: relative !important;
    clip: auto !important;
  }
  
  /* Hide guest dashboard when authenticated - with more specific selectors */
  body.authenticated #guest-dashboard.dashboard-nav,
  html body.authenticated #guest-dashboard.dashboard-nav,
  body.authenticated #guest-dashboard.dashboard-nav:not(.visible) {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    height: 0 !important;
    width: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    position: absolute !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
  }
  
  /* Show guest dashboard when not authenticated - with more specific selectors */
  body:not(.authenticated) #guest-dashboard.dashboard-nav,
  html body:not(.authenticated) #guest-dashboard.dashboard-nav,
  body:not(.authenticated) #guest-dashboard.dashboard-nav:not(.hidden) {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    height: auto !important;
    position: relative !important;
  }
  
  /* Ensure user dashboard is hidden when not authenticated */
  body:not(.authenticated) #user-dashboard.dashboard-nav {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    height: 0 !important;
  }
  
  .dashboard-nav {
    display: flex;
    justify-content: space-around;
    padding: 0.5rem 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    margin-bottom: 1rem;
  }
  
  .dashboard-nav a {
    padding: 0.5rem 0.25rem;
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-color);
    text-decoration: none;
    flex: 1;
    border-radius: 4px;
    transition: background-color 0.2s ease;
  }
  
  .dashboard-nav a:hover,
  .dashboard-nav a:focus {
    background-color: var(--hover-bg);
    outline: none;
  }
  

  
  /* Account Deletion Section */
  #privacy-page.active #account-deletion,
  #privacy-page:not(.active) #account-deletion {
    display: block !important;
    opacity: 1 !important;
    position: relative !important;
    clip: auto !important;
    width: auto !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
  }
  
  .account-deletion-section {
    margin: 2rem 0;
    padding: 1.75rem;
    background: rgba(26, 26, 26, 0.8);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
  }
  
  .account-deletion-section h3 {
    color: #fff;
    font-size: 1.5rem;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }
  
  .account-deletion-section h3 {
    color: #fff;
    margin-bottom: 1rem;
    font-size: 1.4rem;
  }
  
  .account-deletion-section ul {
    margin: 1.5rem 0 2rem 1.5rem;
    padding-left: 0.5rem;
  }
  
  .account-deletion-section li {
    margin-bottom: 0.75rem;
    color: #f0f0f0;
    line-height: 1.5;
    position: relative;
    padding-left: 1.5rem;
  }
  
  .account-deletion-section li:before {
    content: '•';
    color: #ff5e57;
    font-weight: bold;
    font-size: 1.5rem;
    position: absolute;
    left: 0;
    top: -0.25rem;
  }
  
  .danger-button {
    background: linear-gradient(135deg, #ff3b30, #ff5e57);
    color: white;
    border: none;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    max-width: 300px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(255, 59, 48, 0.3);
    text-align: center;
  }
  
  .danger-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 59, 48, 0.4);
  }
  
  .danger-button:active {
    transform: translateY(0);
  }
  
  .text-link {
    color: #4dabf7;
    text-decoration: none;
    transition: color 0.2s ease;
  }
  
  .text-link:hover {
    color: #74c0fc;
    text-decoration: underline;
  }

  /* Hide desktop navigation in mobile */
  nav.dashboard-nav {
    display: none;
  }

  header {
    padding: 0.5rem 1rem;
  }

  header h1 {
    font-size: 1.8rem;
    margin: 0.5rem 0;
  }

  header p {
    font-size: 1rem;
    margin: 0.25rem 0 1rem;
  }

  .dashboard-nav {
    width: 100%;
    padding: 0.5rem;
    box-sizing: border-box;
    text-align: center;
    font-size: 0.9rem;
  }

  .dashboard-nav a {
    padding: 0.5rem;
    margin: 0 0.25rem;
    display: inline-block;
  }

  main > section {
    width: 100%;
    max-width: 100%;
    padding: 1rem;
    box-sizing: border-box;
  }

  .btn {
    width: 100%;
    height: 48px;
    padding: 0.75rem 1rem;
    margin: 0.5rem 0;
    font-size: 1rem;
    box-sizing: border-box;
  }

  .audio-player {
    width: 100%;
    margin: 1rem 0;
  }

  .audio-controls {
    flex-direction: column;
  }

  .audio-controls button {
    margin: 0.25rem 0;
  }

  .dropzone {
    padding: 2rem;
  }

  #quota-meter {
    max-width: 600px;
    width: 100%;
    margin: 1rem auto;
    padding: 0 1rem;
    box-sizing: border-box;
  }

  .quota-meter {
    height: 20px;
  }

  /* Stream item styles moved to .stream-player */
  .stream-item {
    padding: 0;
    margin: 0;
    border: none;
  }

  .modal-content {
    width: 90%;
    max-width: 90%;
  }

  footer {
    padding: 1rem;
  }

  .footer-hint {
    font-size: 0.9rem;
  }

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

  #burger-label {
    display: block;
  }

  section#links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #1e1e1e;
    z-index: 1000;
  }

  #burger-toggle:checked + #burger-label + section#links {
    display: block;
  }

  /* Make sure all interactive elements are touch-friendly */
  a, [role="button"], label, select, textarea {
    min-height: 44px;
    min-width: 44px;
  }

  .dropzone {
    padding: 1.5rem;
    margin: 1rem 0;
  }

  .dropzone p {
    font-size: 1rem;
    margin: 0.5rem 0;
  }

  /* Adjust header text for better mobile display */
  header h1 {
    font-size: 1.5rem;
  }

  header p {
    font-size: 0.9rem;
  }

  .dashboard-nav {
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    padding: 0.5rem 0;
  }

  .dashboard-nav::-webkit-scrollbar {
    display: none;
  }

  nav.dashboard-nav a {
    all: unset;
    display: inline-block;
    background-color: var(--surface);
    color: var(--text-color);
    padding: 0.5rem 1rem;
    margin: 0 0.25rem;
    border-radius: 4px;
    font-size: 0.9rem;
    cursor: pointer;
    text-align: center;
    min-width: 100px;
    box-sizing: border-box;
    transition: background-color 0.2s;
  }

  .dashboard-nav a:active {
    background-color: var(--border);
  }

  /* Stream page specific styles */
  #stream-page {
    padding: 0.5rem;
  }

  #stream-page h2 {
    font-size: 1.5rem;
  }

  #stream-page article {
    padding: 1rem;
    margin: 0.5rem 0;
  }

  #stream-list {
    padding: 0 1rem;
    margin: 0 auto;
    max-width: 600px;
    width: 100%;
    box-sizing: border-box;
  }

  #stream-list li {
    margin: 0;
    padding: 0;
    border: none;
    background: transparent;
    list-style: none;
  }

  .stream-player {
    padding: 0.75rem;
  }

  .stream-player h3 {
    font-size: 1.1rem;
  }

  .stream-info {
    font-size: 0.9rem;
  }

  /* Stream list items are now handled by the rules above */

  /* User upload area - matches article styling */
  #user-upload-area {
    margin: 2rem auto;
    padding: 1.6875rem;
    background: var(--surface);
    border: 1px solid var(--border-color, #2a2a2a);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    text-align: center;
    cursor: pointer;
    max-width: 600px;
    width: 100%;
    box-sizing: border-box;
    color: var(--text-color);
  }

  #user-upload-area p {
    margin: 0.5rem 0;
  }

  /* Stream player adjustments */
  .stream-player {
    padding: 1rem;
    margin: 0.5rem 0;
    border: 1px solid #444;
    border-radius: 8px;
    background-color: #1e1e1e;
  }

  .stream-player h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.2rem;
  }

  .stream-info {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
  }

  .stream-audio {
    width: 100%;
  }

  /* Form elements */

  input[type="text"],
  input[type="email"],
  input[type="password"],
  textarea {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    -moz-box-sizing: border-box;
    -webkit-box-sizing: border-box;
    padding: 0.75rem;
    margin: 0.5rem 0;
    font-size: 1rem;
    border-radius: 4px;
    border: 1px solid #444;
    background-color: #2a2a2a;
    color: #f0f0f0;
  }
  
  /* Firefox mobile specific fixes */
  @-moz-document url-prefix() {
    input[type="email"] {
      min-height: 2.5rem;
      appearance: none;
    }
  }

  /* Adjust audio element for mobile */
  audio {
    width: 100% !important;
    max-width: 100% !important;
  }

  /* Toast notifications */
  .toast {
    width: 90%;
    max-width: 100%;
    left: 5%;
    right: 5%;
    transform: none;
    margin: 0 auto;
  }
}
