/* dashboard-mobile.css - Mobile-specific styles for dashboard page */

@media screen and (max-width: 768px) {
  /* Fix container height */
  .container {
    min-height: 100vh;
  }

  /* Simplified header layout - using the LI position approach */
  .container header {
    position: relative;
    padding: 1rem;
    width: 100%;
    box-sizing: border-box;
  }

  /* Navigation adjustments */
  nav ul {
    margin-top: 3rem;
    width: calc(100% + 40px) !important;
    margin-left: -40px;
  }

  /* Logo adjustments - position to top left */
  .container header .logo {
    position: absolute;
    top: 17px;
    left: 15px;
    padding: 0;
  }

  .container header .logo img {
    height: 26px;
  }

  /* Position the logout menu item directly */
  .logout-menu-item {
    position: absolute !important;
    top: 17px !important;
    right: 0px !important;
  }

  /* Style improvements for the logout button */
  .logout-menu-item a {
    display: flex;
    align-items: center;
    background: rgba(161, 57, 255, 0.2);
    padding: 0.35rem 0.5rem;
    border-radius: 4px;
    margin: 0;
    font-size: 0.8rem;
  }

  .logout-menu-item a i {
    margin-right: 0.25rem;
    font-size: 0.8rem;
  }

  /* Center the Digital Twin section */
  .dashboard-menu-item {
    margin: 0 auto;
    text-align: center;
    padding-top: 15px;
  }

  /* User email styling */
  .user-email {
    font-size: 0.8rem;
    line-height: 1.2;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
  }

  /* Record menu item styling */
  .record-menu-item {
    white-space: nowrap;
    margin-top: 15px;
    text-align: center;
  }

  /* Dashboard container adjustments */
  .dashboard-container {
    padding: 0.5rem;
  }

  /* Dashboard layout adjustments */
  .dashboard-layout {
    grid-template-columns: 1fr;
    gap: 30px;
  }

  /* Section header size adjustments */
  .page-title {
    font-size: 1.8rem;
    margin-top: 0.5rem;
    margin-bottom: 1.5rem;
  }

  /* Organization Cards Mobile Styles */
  .organization-cards {
    display: flex !important;
    flex-direction: column !important;
    gap: 15px;
    margin-top: 20px;
  }

  .organization-card {
    padding: 20px;
    border-radius: 12px;
  }

  .org-header h3 {
    font-size: 1.2rem;
    margin-bottom: 12px;
  }

  .org-stats {
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 15px;
  }

  .org-stats .stat {
    font-size: 0.85rem;
  }

  .org-credits {
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 15px;
  }

  .credit-pool {
    padding: 12px;
  }

  .credit-label {
    font-size: 0.8rem;
  }

  .credit-amount {
    font-size: 1.2rem;
  }

  .org-limits {
    padding: 12px;
    margin-bottom: 15px;
  }

  .limit-item {
    padding: 6px 0;
  }

  .limit-label {
    font-size: 0.8rem;
  }

  .view-org-details {
    padding: 10px 20px;
    font-size: 0.9rem;
  }

  /* Organization Tables Mobile Fixes */
  .members-table,
  .avatars-table {
    overflow-x: auto;
    overflow-y: visible;
    max-height: none;
  }

  .members-table table,
  .avatars-table table {
    min-width: 100%;
    font-size: 0.8rem;
    border-collapse: collapse;
  }

  .members-table th,
  .avatars-table th,
  .members-table td,
  .avatars-table td {
    padding: 8px 6px;
    white-space: nowrap;
    font-size: 0.75rem;
  }

  .members-table th:first-child,
  .avatars-table th:first-child,
  .members-table td:first-child,
  .avatars-table td:first-child {
    position: sticky;
    left: 0;
    background: rgba(255, 255, 255, 0.1);
    z-index: 1;
  }

  .btn-sm {
    padding: 4px 8px;
    font-size: 0.7rem;
    white-space: nowrap;
  }

  .access-level-dropdown {
    font-size: 0.7rem;
    padding: 2px 6px;
    width: 80px;
  }

  /* PURCHASE PACKAGE MODAL STYLING */

  /* Adjust modal to take up full screen height and width on mobile */
  .modal {
    align-items: flex-start;
    padding: 0;
  }

  /* Adjust modal content for mobile with rounded corners only at top */
  .modal-content {
    width: 100%;
    max-width: 100%;
    max-height: 100vh;
    border-radius: 20px 20px 0 0;
    margin: 0;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.6);
    overflow-y: auto;
  }

  /* Make close button more prominent */
  .close-modal {
    font-size: 32px;
    padding: 5px;
  }

  /* Modal header styling */
  .modal-header {
    padding: 15px 20px;
  }

  .modal-header h2 {
    font-size: 1.4rem;
  }

  /* Modal body adjustments */
  .modal-body {
    padding: 20px;
  }

  #purchase-credits-container {
    max-height: none;
  }

  /* Transaction history modal specific styling */
  #history-modal {
    align-items: center;
  }

  #history-modal .modal-content {
    border-radius: 20px;
    max-height: 80vh;
    margin: 0 auto;
  }

  #transaction-history {
    max-height: 60vh;
    overflow-y: auto;
  }

  /* Package styling adjustments - FORCE SINGLE COLUMN LAYOUT */
  .credit-packages {
    display: flex !important;
    flex-direction: column !important;
    grid-template-columns: 1fr !important;
    gap: 25px;
    width: 100%;
  }

  /* Ensure hidden plan packages are properly hidden on mobile */
  .credit-packages.hidden,
  .normal-plan-packages.hidden,
  .subscribe-plan-packages.hidden {
    display: none !important;
  }

  /* Adjust the package styling */
  .credit-package {
    max-width: 100%;
    padding: 25px 20px;
    margin: 0 0 25px 0;
    border-radius: 15px;
    width: 100% !important;
    box-sizing: border-box;
  }

  /* Package header adjustments */
  .package-header {
    margin-bottom: 15px;
    position: relative;
  }

  .package-header h3 {
    font-size: 1.5rem;
    margin-bottom: 5px;
  }

  /* Badge positioning for mobile */
  .badge {
    position: absolute;
    top: -39px;
    right: 0;
    font-size: 0.7rem;
    padding: 0.3rem 0.6rem;
  }

  /* Price adjustments */
  .credit-package .price {
    font-size: 3.5rem;
    margin: 15px 0;
  }

  /* Description text */
  .credit-package .description {
    font-size: 0.95rem;
    margin-bottom: 15px;
    line-height: 1.4;
  }

  /* Package features list spacing */
  .credit-package ul {
    margin-bottom: 20px;
  }

  .credit-package li {
    margin-bottom: 8px;
    font-size: 0.9rem;
  }

  /* Package action buttons */
  .package-actions {
    width: 100%;
    margin-top: 15px;
  }

  .select-package {
    width: 100%;
    padding: 12px;
    font-size: 1rem;
  }

  /* Quantity control styling */
  .quantity-control {
    margin: 15px auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 200px;
  }

  .btn-quantity {
    width: 40px;
    height: 40px;
    font-size: 20px;
  }

  .quantity-value {
    width: 60px;
    height: 40px;
    font-size: 38px;
    line-height: 40px;
    text-align: center;
  }

  /* Total price and time adjustments */
  .total-price,
  .total-time {
    font-size: 1.1rem;
    margin: 10px 0;
  }

  /* Credits section adjustments */
  .credits-container {
    padding: 1rem;
  }

  .credits-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .credits-balance {
    text-align: left;
  }

  .credits-actions {
    flex-direction: column;
    gap: 0.5rem;
  }

  /* Profile adjustments */
  .profile-info {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .profile-avatar {
    margin: 0 0 1rem 0;
  }

  .profile-details {
    text-align: center;
  }

  /* General button adjustments */
  .btn-primary,
  .btn-secondary {
    width: 100%;
    padding: 0.75rem;
    margin: 0.5rem 0;
  }

  /* Migration record button specific mobile styling */
  .migration-record-btn {
    font-size: 1rem !important;
    padding: 0.75rem !important;
    width: auto !important;
    margin: 0.5rem 0 !important;
    display: block !important;
  }

  /* Modal header adjustments for mobile */
  .modal-header {
    grid-template-columns: 1fr;
    gap: 1rem;
    padding: 15px 15px 15px 15px;
    position: relative;
  }

  .modal-header-content {
    grid-column: 1;
    justify-content: center;
    order: 1;
  }

  .modal-header h2 {
    font-size: 1.3rem;
    text-align: center;
    margin-bottom: 0;
  }

  .plan-toggle-buttons {
    grid-column: 1;
    justify-self: center;
    width: 100%;
    max-width: 300px;
    margin: 0.5rem auto 0;
    display: flex !important;
    gap: 0;
    position: relative;
    z-index: 10;
    order: 2;
  }

  .plan-toggle-btn {
    padding: 10px 20px;
    font-size: 0.9rem;
    flex: 1 1 50%;
    min-width: 0;
    white-space: nowrap;
    overflow: visible;
    text-overflow: clip;
    position: relative;
    z-index: 2;
    cursor: pointer;
    -webkit-tap-highlight-color: rgba(255, 255, 255, 0.2);
    touch-action: manipulation;
    min-height: 44px;
    display: flex !important;
    align-items: center;
    justify-content: center;
    pointer-events: auto !important;
    user-select: none;
    -webkit-user-select: none;
    box-sizing: border-box;
  }

  .plan-toggle-btn:active {
    transform: scale(0.98);
  }

  .plan-toggle-btn.active {
    z-index: 3;
  }

  .close-modal {
    grid-column: 1;
    justify-self: end;
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 100;
  }

  /* Ensure modal header has proper z-index stacking */
  .modal-header {
    position: relative;
    z-index: 1;
  }
}
