/* Mobile Responsive Styles for Mondoshare */

/* Mobile Menu Toggle Button */
.mobile-menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 44px;
  height: 44px;
  background: rgba(148, 163, 184, 0.1);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 12px;
  cursor: pointer;
  padding: 0;
  gap: 5px;
  transition: all 0.3s ease;
}

.mobile-menu-toggle:hover {
  background: rgba(148, 163, 184, 0.2);
}

.mobile-menu-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: #e2e8f0;
  border-radius: 2px;
  transition: all 0.3s ease;
}

.mobile-menu-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-toggle.active span:nth-child(2) {
  opacity: 0;
  transform: translateX(-10px);
}

.mobile-menu-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* Base mobile adjustments */
@media (max-width: 768px) {
  /* Header & Navigation */
  .site-header {
    padding: 16px;
    flex-wrap: wrap;
    gap: 12px;
    position: relative;
  }
  .download-ad {
    width: 100%;
    max-width: 100;

  }

  .site-logo {
    font-size: 1rem;
  }

  .site-logo span {
    width: 32px;
    height: 32px;
    font-size: 0.9rem;
  }

  /* Mobile Menu Toggle */
  .mobile-menu-toggle {
    display: flex;
  }

  /* Navigation Links - Mobile Menu */
  .nav-links {
    display: none;
    width: 100%;
    flex-direction: column;
    gap: 8px;
    padding: 16px;
    background: rgba(15, 23, 42, 0.98);
    border: 1px solid rgba(148, 163, 184, 0.12);
    border-radius: 16px;
    margin-top: 12px;
    position: absolute;
    top: 100%;
    left: 16px;
    right: 16px;
    z-index: 1000;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  }

  .nav-links.active {
    display: flex;
    animation: slideDown 0.3s ease-out;
  }

  @keyframes slideDown {
    from {
      opacity: 0;
      transform: translateY(-10px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .nav-links a,
  .nav-link-button {
    width: 100%;
    text-align: center;
    padding: 12px 16px;
    font-size: 0.95rem;
    border-radius: 10px;
    background: rgba(148, 163, 184, 0.08);
    transition: all 0.2s ease;
  }

  .nav-links a:hover,
  .nav-link-button:hover {
    background: rgba(var(--color-primary-rgb, 59, 130, 246), 0.15);
  }

  .nav-links form {
    width: 100%;
  }

  .nav-links form button {
    width: 100%;
  }

  /* Hero Section */
  .hero-block {
    padding: 32px 16px 24px;
  }

  .hero-title {
    font-size: clamp(1.8rem, 8vw, 2.5rem);
    line-height: 1.1;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }

  .hero-copy {
    font-size: 0.95rem;
    line-height: 1.5;
    margin-top: 16px;
  }

  .primary-action {
    width: 100%;
    padding: 14px 20px;
    font-size: 1rem;
    margin-top: 24px;
  }

  /* Feature Cards */
  .feature-cards {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 32px;
  }

  .feature-card {
    padding: 20px;
    border-radius: 16px;
  }

  .feature-card h3 {
    font-size: 1rem;
    margin-bottom: 12px;
  }

  .feature-card p {
    font-size: 0.9rem;
    line-height: 1.6;
  }

  /* Section Title */
  .section-title {
    font-size: 0.7rem;
    letter-spacing: 0.15em;
    margin-bottom: 12px;
  }

  /* Upload Studio */
  .upload-studio {
    padding: 20px 16px;
    border-radius: 20px;
  }

  .upload-studio h2 {
    font-size: clamp(1.2rem, 5vw, 1.5rem);
  }

  .upload-limit-notice {
    font-size: 0.85rem;
    padding: 10px 12px;
    border-radius: 12px;
    line-height: 1.4;
  }

  /* Upload Card */
  .upload-card {
    padding: 20px 16px;
    border-radius: 16px;
    width: 100%;
  }

  .upload-zone {
    padding: 24px 16px;
    border-radius: 16px;
  }

  .upload-zone strong {
    font-size: 0.95rem;
  }

  .upload-zone small {
    font-size: 0.8rem;
  }

  /* Upload Actions */
  .upload-actions {
    flex-direction: column;
    gap: 12px;
    margin-top: 16px;
  }

  .upload-actions button {
    width: 100%;
    padding: 12px 16px;
    font-size: 0.9rem;
    min-height: 44px;
    border-radius: 8px;
  }

  /* Primary Action Button */
  .primary-action {
    width: 100%;
    padding: 12px 20px;
    font-size: 0.95rem;
    border-radius: 8px;
  }

  /* Status Box */
  .status-box {
    padding: 14px 16px;
    border-radius: 14px;
    font-size: 0.9rem;
    min-height: 60px;
  }

  /* File List */
  .file-list {
    margin-top: 20px;
    gap: 12px;
  }

  .file-card {
    padding: 16px;
    border-radius: 16px;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .file-card .file-info {
    width: 100%;
  }

  .file-card strong {
    font-size: 0.95rem;
    word-break: break-word;
    overflow-wrap: break-word;
  }

  .file-card span {
    font-size: 0.85rem;
  }

  .file-actions {
    width: 100%;
    flex-wrap: wrap;
    gap: 6px;
    min-width: fit-content;
  }

  .file-actions a,
  .file-actions button {
    flex: 1;
    min-width: calc(50% - 3px);
    padding: 8px 10px;
    font-size: 0.8rem;
    min-height: 36px;
    border-radius: 6px;
    display: inline-flex !important;
  }

  .action-with-icon {
    gap: 6px;
  }

  .action-icon {
    width: 14px;
    height: 14px;
  }

  .action-icon svg {
    width: 14px;
    height: 14px;
  }

  /* Admin Panel Mobile */
  .admin-panel {
    padding: 16px 12px;
  }

  .panel-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .panel-card {
    padding: 20px 16px;
    border-radius: 16px;
    overflow: hidden;
  }

  .panel-card h2 {
    font-size: 1.4rem;
    margin-bottom: 8px;
  }

  .panel-card h3 {
    font-size: 1.1rem;
    margin-bottom: 16px;
  }

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

  .section-title {
    font-size: 0.85rem;
    margin-bottom: 12px;
  }

  /* Panel Menu Mobile */
  .panel-menu {
    gap: 8px;
  }

  .panel-menu > a {
    padding: 14px 16px;
    font-size: 0.95rem;
    border-radius: 12px;
  }

  .panel-menu > form {
    margin-top: 12px;
    display: block;
  }

  .panel-menu > form button {
    width: 100%;
    padding: 14px 16px;
    font-size: 0.95rem;
    min-height: 48px;
    border-radius: 12px;
  }

  /* Table Tools Mobile */
  .table-tools {
    grid-template-columns: 1fr;
    gap: 10px;
    margin: 16px 0 12px;
  }

  .table-tools input,
  .table-tools select {
    min-height: 48px;
    padding: 12px 16px;
    font-size: 0.95rem;
    border-radius: 12px;
    width: 100%;
  }

  .batch-delete-btn {
    width: 100%;
    min-height: 48px;
    padding: 14px 16px;
    font-size: 0.95rem;
    border-radius: 12px;
    margin-top: 8px;
  }

  /* File List Mobile */
  .file-list {
    border-radius: 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Admin table responsive */
  #adminFilesBody {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  #adminFilesBody table {
    min-width: 800px;
  }

  #adminUsersBody {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  #adminUsersBody table {
    min-width: 700px;
  }

  #adminReportsBody {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  #adminReportsBody table {
    min-width: 900px;
  }

  .file-list-header {
    display: flex;
    white-space: nowrap;
  }

  .file-list-item {
    flex-direction: row;
    align-items: center;
    padding: 14px 16px;
    white-space: nowrap;
  }

  .file-list-item > div {
    padding: 0;
  }

  .file-list-item > div::before {
    display: none;
  }

  .file-list-select {
    flex: 0 0 40px !important;
  }

  .file-list-name {
    flex: 1 1 200px !important;
    min-width: 150px;
  }

  .file-list-owner {
    flex: 0 0 120px !important;
    min-width: 100px;
  }

  .file-list-size {
    flex: 0 0 80px !important;
    min-width: 70px;
  }

  .file-list-downloads {
    flex: 0 0 70px !important;
    min-width: 60px;
  }

  .file-list-actions {
    flex: 0 0 auto !important;
  }

  /* User List Mobile */
  .user-list {
    border-radius: 12px;
    overflow-x: auto;
  }

  .user-list-header {
    display: flex;
    white-space: nowrap;
  }

  .user-list-item {
    flex-direction: row;
    align-items: center;
    padding: 14px 16px;
    white-space: nowrap;
  }

  .user-list-item > div {
    padding: 0;
  }

  .user-list-item > div::before {
    display: none;
  }

  .user-list-id {
    flex: 0 0 50px !important;
    min-width: 40px;
  }

  .user-list-name {
    flex: 0 0 120px !important;
    min-width: 100px;
  }

  .user-list-email {
    flex: 1 1 150px !important;
    min-width: 120px;
  }

  .user-list-role {
    flex: 0 0 80px !important;
    min-width: 70px;
  }

  .user-list-actions {
    flex: 0 0 auto !important;
  }

  /* Reports List Mobile */
  .reports-list {
    border-radius: 12px;
    overflow-x: auto;
  }

  .reports-list-header {
    display: flex;
    white-space: nowrap;
  }

  .reports-list-item {
    flex-direction: row;
    align-items: center;
    padding: 14px 16px;
    white-space: nowrap;
  }

  .reports-list-item > div {
    padding: 0;
  }

  .reports-list-item > div::before {
    display: none;
  }

  .reports-list-time {
    flex: 0 0 120px !important;
    min-width: 100px;
  }

  .reports-list-action {
    flex: 0 0 120px !important;
    min-width: 100px;
  }

  .reports-list-actor {
    flex: 0 0 150px !important;
    min-width: 120px;
  }

  .reports-list-ip {
    flex: 0 0 100px !important;
    min-width: 80px;
  }

  .reports-list-details {
    flex: 1 1 150px !important;
    min-width: 120px;
  }

  /* Admin File Actions Mobile */
  .admin-file-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-top: 12px;
  }

  .admin-file-actions a,
  .admin-file-actions button {
    padding: 12px 16px;
    font-size: 0.9rem;
    border-radius: 10px;
    min-height: 44px;
  }

  .action-with-icon {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    justify-content: center;
    text-align: center;
    width: 100%;
  }

  .action-with-icon .action-icon {
    width: 20px;
    height: 20px;
  }

  .action-with-icon .action-icon svg {
    width: 20px;
    height: 20px;
  }

  .action-with-icon span:last-child {
    font-size: 0.85rem;
  }

  /* Sort Header Buttons Mobile */
  .sort-header-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
  }

  .sort-indicator {
    font-size: 0.9rem;
  }

  /* Expiry Info Mobile */
  .expiry-info,
  .expiry-warning,
  .expiry-expired {
    font-size: 0.8rem;
    margin-top: 4px;
    display: inline-block;
  }

  /* Settings Form Mobile */
  .panel-card form {
    gap: 16px;
  }

  .panel-card label {
    font-size: 0.9rem;
    margin-bottom: 6px;
  }

  .panel-card input[type="text"],
  .panel-card input[type="number"],
  .panel-card input[type="url"],
  .panel-card input[type="password"],
  .panel-card textarea,
  .panel-card select {
    padding: 14px 16px;
    font-size: 0.95rem;
    border-radius: 12px;
    min-height: 48px;
  }

  .panel-card textarea {
    min-height: 100px;
    resize: vertical;
  }

  .panel-card button[type="submit"] {
    width: 100%;
    padding: 16px 24px;
    font-size: 1rem;
    min-height: 52px;
    margin-top: 8px;
  }

  /* Theme Color Options Mobile */
  #themeColorOptions {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .theme-color-option {
    padding: 14px;
    border-radius: 12px;
  }

  .theme-color-option div:first-child {
    font-size: 20px;
    margin-bottom: 6px;
  }

  .theme-color-option div:last-child {
    font-size: 0.85rem;
  }

  /* S3 Settings Mobile */
  #s3-settings {
    gap: 14px;
    padding: 16px;
    border-radius: 12px;
  }

  #s3-settings p {
    font-size: 0.85rem;
    line-height: 1.6;
  }

  /* Reports Table Mobile */
  .file-table td[colspan] {
    padding: 24px 16px;
    text-align: center;
    font-size: 0.9rem;
  }

  /* Clear Reports Button Mobile */
  #clearAllReportsBtn {
    width: 100%;
    padding: 14px 16px;
    font-size: 0.95rem;
    min-height: 48px;
    border-radius: 12px;
  }

  /* User Table Mobile */
  .file-table td[style*="width"] {
    width: auto !important;
  }

  /* Checkbox Mobile */
  input[type="checkbox"] {
    width: 20px;
    height: 20px;
    min-width: 20px;
  }

  .file-checkbox,
  #selectAllFiles {
    width: 20px;
    height: 20px;
  }

  /* Admin File Actions Mobile */
  .admin-file-actions {
    grid-template-columns: 1fr;
    max-width: 100%;
    gap: 8px;
  }

  .admin-file-actions > a,
  .admin-file-actions > button,
  .admin-file-actions > form > button {
    min-height: 44px;
    padding: 12px 16px;
    font-size: 0.9rem;
  }

  .admin-file-actions .action-icon {
    width: 18px;
    height: 18px;
  }

  .admin-file-actions .action-icon svg {
    width: 18px;
    height: 18px;
  }

  .admin-file-actions .inline-rename-form.is-open {
    grid-template-columns: 1fr;
  }
}

/* Extra small screens */
@media (max-width: 480px) {
  /* Header */
  .site-header {
    padding: 12px;
  }

  .site-logo {
    font-size: 0.9rem;
    gap: 8px;
  }

  .site-logo span {
    width: 28px;
    height: 28px;
    font-size: 0.8rem;
  }

  .nav-links {
    gap: 8px;
  }

  .nav-links a,
  .nav-link-button {
    font-size: 0.8rem;
    padding: 6px 10px;
  }

  /* Hero */
  .hero-block {
    padding: 24px 12px 20px;
  }

  .hero-title {
    font-size: clamp(1.5rem, 10vw, 2rem);
  }

  .hero-copy {
    font-size: 0.9rem;
  }

  /* Features */
  .feature-card {
    padding: 16px;
  }

  .feature-card h3 {
    font-size: 0.95rem;
  }

  .feature-card p {
    font-size: 0.85rem;
  }

  /* Upload */
  .upload-studio {
    padding: 16px 12px;
  }

  .upload-studio h2 {
    font-size: 1.2rem;
  }

  .upload-card {
    padding: 16px 12px;
  }

  .upload-zone {
    padding: 20px 12px;
  }

  .upload-zone strong {
    font-size: 0.9rem;
  }

  .upload-zone small {
    font-size: 0.75rem;
  }

  /* File Actions */
  .file-actions {
    flex-direction: column;
  }

  .file-actions a,
  .file-actions button {
    width: 100%;
    min-width: auto;
  }

  /* Modals */
  .share-modal {
    padding: 20px;
    max-width: 95%;
  }

  .share-modal-header h3 {
    font-size: 1rem;
  }

  .share-option {
    padding: 12px;
    font-size: 0.9rem;
  }

  .confirm-dialog {
    padding: 18px;
    max-width: 90%;
  }

  .confirm-dialog h3 {
    font-size: 1rem;
  }

  .confirm-dialog p {
    font-size: 0.9rem;
  }

  /* Toast */
  .toast {
    padding: 12px 16px;
    font-size: 0.85rem;
    max-width: 95%;
  }
}

/* Landscape mobile */
@media (max-width: 768px) and (orientation: landscape) {
  .hero-block {
    padding: 20px 16px;
  }

  .hero-title {
    font-size: clamp(1.4rem, 4vw, 1.8rem);
  }

  .feature-cards {
    grid-template-columns: repeat(2, 1fr);
    display: grid;
  }

  .upload-studio {
    padding: 16px;
  }

  .upload-actions {
    flex-direction: row;
  }

  .upload-actions button {
    width: auto;
    flex: 1;
  }
}

/* Prevent text overflow */
* {
  max-width: 100%;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* Ensure images don't overflow */
img {
  max-width: 100%;
  height: auto;
}

/* Improve touch targets on mobile */
@media (max-width: 768px) {
  button,
  a,
  input,
  select {
    min-height: 44px;
  }

  .file-actions a,
  .file-actions button,
  .nav-links a,
  .nav-link-button {
    min-height: 40px;
  }
}
/* ===================================================
   MOBILE FIX FOR ALL 5 THEMES & USER PANEL BUTTONS
   =================================================== */

@media (max-width: 768px) {
    /* Enforce modern alignment and layout for user buttons on small screens */
    .dashboard-file-actions, 
    .file-actions {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: wrap !important;
        gap: 8px !important;
        width: 100% !important;
        padding: 4px 0 !important;
    }

    /* Standardize button size and eliminate stretched layouts */
    .dashboard-file-actions a, 
    .dashboard-file-actions button,
    .file-actions a,
    .file-actions button {
        flex: 1 !important;
        min-width: calc(50% - 4px) !important;
        width: auto !important;
        min-height: 38px !important;
        height: 38px !important;
        padding: 6px 12px !important;
        font-size: 0.82rem !important;
        border-radius: 8px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    /* Force delete buttons to maintain custom red theme on mobile */
    .dashboard-file-actions .danger-link-button,
    .file-actions button.delete-file-btn {
        background: rgba(239, 68, 68, 0.16) !important;
        color: #fca5a5 !important;
        border: 1px solid rgba(239, 68, 68, 0.3) !important;
    }
}
