/* ================================================
   Creator Pay Admin - Resources Page Mobile Responsive
   ================================================ */

/* ================================================
   Scrollbar styling
   ================================================ */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* ================================================
   Base Mobile Styles
   ================================================ */
@media (max-width: 1024px) {
  /* Show mobile menu toggle */
  .mobile-menu-toggle {
    display: flex !important;
  }
  
  .page-header .mobile-menu-toggle {
    display: flex !important;
  }
  
  /* Page header adjustments */
  .page-header {
    padding: 32px 24px;
    margin-bottom: 24px;
  }
  
  .page-header h1 {
    font-size: 28px;
  }
  
  .page-header .subtitle {
    font-size: 15px;
  }
  
  /* Resource section */
  .resource-section {
    padding: 24px;
  }
  
  .section-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: nowrap;
  }

  .view-toggle {
    display: none;
  }

  .add-buttons-group {
    flex-shrink: 0;
    width: auto;
    display: flex;
    gap: 0;
  }

  .add-resource-btn {
    padding: 9px 16px;
    font-size: 13px;
    white-space: nowrap;
  }
  
  /* Grid adjustments */
  .resource-grid {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
  }
  
  /* Sidebar adjustments */
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: min(280px, 85vw);
    height: 100dvh;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 1000;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding: 0 !important;
    display: flex;
    flex-direction: column;
  }

  .sidebar-header {
    position: sticky;
    top: 0;
    z-index: 2;
    padding: 16px 20px !important;
    border-bottom: 2px solid rgba(59,130,246,0.2) !important;
    flex-shrink: 0;
  }

  /* nav links area grows and scrolls if needed */
  .sidebar > a,
  .sidebar > .sb-nm-wrap {
    flex-shrink: 0;
  }

  .sidebar-user {
    margin-top: auto !important;
    flex-shrink: 0;
    position: sticky;
    bottom: 0;
  }
  
  .sidebar.active {
    transform: translateX(0);
  }
  
  .sidebar-close-btn {
    display: block;
  }
  
  .sidebar-overlay.active {
    display: block;
  }

  /* Main content full width */
  .main {
    width: 100%;
    padding: 24px 16px;
    padding-bottom: 90px !important;
    height: 100dvh;
    overflow-y: auto !important;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box;
  }
}

@media (max-width: 768px) {
  /* Page header */
  .page-header {
    padding: 24px 20px;
    margin-bottom: 20px;
    border-radius: var(--radius-lg);
  }

  .main {
    padding-bottom: 90px !important;
  }
  
  .page-header h1 {
    font-size: 24px;
  }
  
  .page-header .subtitle {
    font-size: 14px;
  }
  
  /* Resource section */
  .resource-section {
    padding: 20px;
    border-radius: var(--radius-lg);
  }
  
  /* Section title */
  .section-title {
    /* flex-direction: column;
    align-items: flex-start; */
    gap: 8px;
  }
  
  .section-title h2 {
    font-size: 20px;
  }
  
  .resource-count {
    font-size: 12px;
    padding: 4px 10px;
    font-size: 0;
  }

  
  /* Add buttons */
  .add-buttons-group {
    width: auto;
  }
  
  /* Custom dropdown */
  .custom-select {
    width: 100%;
    min-width: unset;
  }
  
  .dropdown {
    width: 100%;
  }
  
  /* Resource grid - single column */
  .resource-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  
  /* Force grid view, hide any table */
  .resource-grid table,
  .resource-grid thead,
  .resource-grid tbody,
  .resource-grid th,
  .resource-grid td,
  .resource-grid tr,
  .resource-list,
  .resource-row,
  .resource-cell {
    display: none !important;
  }
  
  /* Resource card */
  .res-card {
    padding: 20px;
  }
  
  .res-card-header {
    flex-direction: column;
    gap: 12px;
  }
  
  .res-card-actions {
    align-self: flex-end;
  }
  
  .res-card-title {
    font-size: 16px;
  }
  
  .res-card-description {
    font-size: 13px;
  }
  
  .res-card-footer {
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
  }
  
  .res-card-price {
    font-size: 18px;
  }
  
  /* Modal */
  .modal-content {
    padding: 24px;
    margin: 16px;
    width: calc(100% - 32px);
    border-radius: var(--radius-lg);
  }
  
  .modal-content h2 {
    font-size: 20px;
    padding-right: 36px;
  }
  
  /* Form */
  .form-group input,
  .form-group textarea {
    padding: 12px 14px;
    font-size: 14px;
  }
  
  .form-group textarea {
    min-height: 100px;
  }
  
  button[type="submit"] {
    padding: 14px 20px;
    font-size: 15px;
  }
  
  /* Auth modal */
  .auth-modal-content {
    padding: 32px 24px;
    margin: 16px;
    width: calc(100% - 32px);
  }
  
  .auth-modal-content h2 {
    font-size: 24px;
  }
}

@media (max-width: 480px) {
  /* Page header */
  .page-header {
    padding: 20px 16px;
    margin-bottom: 16px;
  }
  
  .page-header h1 {
    font-size: 22px;
  }
  
  .page-header .subtitle {
    font-size: 13px;
   
  }
  
  /* Resource section */
  .resource-section {
    padding: 16px;
  }
  
  /* Section title */
  .section-title h2 {
    font-size: 18px;
  }
  
  /* Add buttons */
  .add-btn {
    padding: 12px 16px;
    font-size: 13px;
  }
  
  .btn-icon img {
    width: 16px;
    height: 16px;
  }
  
  /* Custom select */
  .custom-select {
    padding: 10px 14px;
  }
  
  .custom-select .select-icon {
    width: 20px;
    height: 20px;
  }
  
  /* Dropdown */
  .dropdown div {
    padding: 12px 14px;
    font-size: 14px;
  }
  
  .dropdown div img {
    width: 18px;
    height: 18px;
  }
  
  /* Resource card */
  .res-card {
    padding: 16px;
  }
  
  .res-card-btn {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }
  
  .res-card-title {
    font-size: 15px;
  }
  
  .res-card-description {
    font-size: 13px;
    -webkit-line-clamp: 3;
  }
  
  /* Empty state */
  .empty-state {
    padding: 40px 16px;
  }
  
  .empty-icon {
    width: 80px;
    height: 80px;
    font-size: 36px;
  }
  
  .empty-icon img {
    width: 48px;
    height: 48px;
  }
  
  .empty-state h3 {
    font-size: 18px;
  }
  
  .empty-state p {
    font-size: 14px;
  }
  
  /* Modal */
  .modal-content {
    padding: 20px 16px;
    margin: 12px;
    width: calc(100% - 24px);
  }
  
  .modal-content .close {
    top: 16px;
    right: 16px;
    font-size: 24px;
  }
  
  .modal-content h2 {
    font-size: 18px;
  }
  
  /* Form */
  .form-group {
    gap: 6px;
  }
  
  .form-group label {
    font-size: 13px;
  }
  
  .form-group input,
  .form-group textarea {
    padding: 10px 12px;
    font-size: 14px;
    border-radius: var(--radius-sm);
  }
  
  /* Auth modal */
  .auth-modal-content {
    padding: 24px 20px;
    margin: 12px;
    width: calc(100% - 24px);
  }
  
  .auth-modal-content h2 {
    font-size: 22px;
  }
  
  .auth-modal-content p {
    font-size: 14px;
  }
  
  .toggle-form {
    font-size: 13px;
  }
}

@media (max-width: 360px) {
  /* Extra small devices */
  .page-header h1 {
    font-size: 20px;
  }
  
  .section-title h2 {
    font-size: 16px;
  }
  
  .resource-count {
    padding: 3px 8px;
  }
  
  .res-card-type {
    font-size: 10px;
    padding: 4px 8px;
  }
  
  .res-card-price {
    font-size: 16px;
  }
}

/* ================================================
   Touch Device Optimizations
   ================================================ */
@media (hover: none) and (pointer: coarse) {
  /* Larger touch targets for touch devices */
  .add-btn {
    padding: 16px 20px;
  }
  
  .res-card-btn {
    width: 44px;
    height: 44px;
  }
  
  .custom-select {
    padding: 14px 18px;
  }
  
  .dropdown div {
    padding: 16px 18px;
  }
  
  .modal-content .close {
    width: 44px;
    height: 44px;
  }
}

/* ================================================
   Landscape Mobile
   ================================================ */
@media (max-height: 500px) and (orientation: landscape) {
  .page-header {
    padding: 16px 20px;
    margin-bottom: 16px;
  }
  
  .page-header h1 {
    font-size: 20px;
  }
  
  /* .page-header .subtitle {
    display: none;
  } */
  
  .modal-content {
    max-height: 80vh;
    overflow-y: auto;
  }
  
  .auth-modal-content {
    max-height: 80vh;
    overflow-y: auto;
  }
}

/* ================================================
   High DPI / Retina Displays
   ================================================ */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .page-header::before {
    background-size: 30px 30px;
  }
}

/* ================================================
   Reduced Motion
   ================================================ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ================================================
   Print Styles
   ================================================ */
@media print {
  .mobile-menu-toggle,
  .sidebar-overlay,
  .add-buttons-group,
  .res-card-actions,
  .modal-content {
    display: none !important;
  }
  
  .page-header {
    background: none !important;
    color: black !important;
    box-shadow: none !important;
    border: 1px solid #ccc;
  }
  
  .page-header h1,
  .page-header .subtitle {
    color: black !important;
    text-shadow: none !important;
  }
  
  .resource-section {
    box-shadow: none !important;
    border: 1px solid #ccc;
  }
  
  .res-card {
    break-inside: avoid;
    border: 1px solid #ccc;
  }
}
