/* Modern Layout Structure CSS */
:root {
  --primary-color: #F7931A; /* Bitcoin Orange */
  --primary-dark: #E07D10; /* Darker Bitcoin Orange */
  --secondary-color: #f3f4f6; /* Light Gray */
  --accent-color: #1A3D7C; /* Dark Blue */
  --success-color: #10b981; /* Green */
  --warning-color: #f59e0b; /* Amber */
  --error-color: #ef4444; /* Red */
  --info-color: #3b82f6; /* Blue */
  --dark-text: #1f2937; /* Near Black */
  --light-text: #6b7280; /* Gray */
  --border-color: #e5e7eb; /* Light Gray Border */
  --card-bg: #ffffff; /* White */
  --body-bg: #f9fafb; /* Off-White */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --header-height: 80px;
  --sidebar-width: 280px;
  --content-max-width: 1400px;
}

/* Base Styles */
body {
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  margin: 0;
  padding: 0;
  background-color: var(--body-bg);
  color: var(--dark-text);
  line-height: 1.5;
}

/* App Container */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background-color: #f9fafb;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  background-color: white;
  border-bottom: 1px solid #e5e7eb;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand h1 {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary-color);
  margin: 0;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

/* Main Layout */
.main-layout {
  display: flex;
  flex: 1;
  height: calc(100vh - 70px);
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: 250px;
  background-color: white;
  border-right: 1px solid #e5e7eb;
  padding: 1.5rem 0;
  height: 100%;
  overflow-y: auto;
  flex-shrink: 0;
}

.sidebar-section {
  padding: 0 1.5rem;
  margin-bottom: 2rem;
}

.sidebar-section h3 {
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  color: #6b7280;
  margin: 0 0 1rem 0;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #f3f4f6;
}

.sidebar-links {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  color: #1f2937;
  text-decoration: none;
  transition: background-color 0.2s;
  position: relative;
}

.sidebar-link:hover {
  background-color: #f3f4f6;
}

.sidebar-link.active {
  background-color: #f3f4f6;
  color: var(--primary-color);
  font-weight: 500;
}

.sidebar-link .icon {
  margin-right: 0.75rem;
  font-size: 1.125rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
}

.badge {
  position: absolute;
  right: 1rem;
  background-color: var(--primary-color);
  color: white;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 9999px;
  padding: 0.125rem 0.5rem;
  min-width: 1.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Main Content */
.main-content {
  flex: 1;
  padding: 2rem;
  overflow-y: auto;
  height: 100%;
}

/* Cards and Grids */
.nft-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.nft-gallery.list-view {
  grid-template-columns: 1fr;
}

.nft-card {
  background-color: white;
  border-radius: 0.75rem;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
}

.nft-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
}

.nft-image-container {
  position: relative;
  padding-top: 100%;
  background-color: #f3f4f6;
}

.nft-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.nft-image-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(0deg, rgba(0,0,0,0.4) 0%, rgba(0,0,0,0) 50%);
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  padding: 1rem;
  opacity: 0;
  transition: opacity 0.2s;
}

.nft-card:hover .nft-image-overlay {
  opacity: 1;
}

.nft-info {
  padding: 1rem;
}

.nft-info h3 {
  margin: 0 0 0.5rem 0;
  font-size: 1rem;
  color: #1f2937;
}

.nft-info p {
  margin: 0 0 0.5rem 0;
  color: #6b7280;
  font-size: 0.875rem;
}

.nft-price {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.75rem;
}

.price-label {
  font-size: 0.75rem;
  color: #6b7280;
}

.price-amount {
  font-weight: 600;
  color: #10b981;
}

/* Collections Grid */
.collections-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.25rem;
  margin-top: 1rem;
}

.collection-card {
  background-color: white;
  border-radius: 0.75rem;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
}

.collection-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
}

.collection-image {
  position: relative;
  padding-top: 75%;
  background-color: #f3f4f6;
}

.collection-image img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.collection-info {
  padding: 1rem;
}

.collection-info h4 {
  margin: 0 0 0.25rem 0;
  font-size: 1rem;
  color: #1f2937;
}

.collection-info p {
  margin: 0;
  color: #6b7280;
  font-size: 0.875rem;
}

/* Creator Cards */
.creator-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1.25rem;
  margin-top: 1rem;
}

.creator-card {
  background-color: white;
  border-radius: 0.75rem;
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
}

.creator-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
}

.creator-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  overflow: hidden;
  background-color: #f3f4f6;
  flex-shrink: 0;
}

.creator-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.creator-info {
  flex: 1;
}

.creator-info h3 {
  margin: 0 0 0.25rem 0;
  font-size: 1rem;
  color: #1f2937;
}

.creator-info p {
  margin: 0;
  color: #6b7280;
  font-size: 0.875rem;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-top: 1rem;
}

.stat-card {
  background-color: white;
  border-radius: 0.75rem;
  padding: 1.25rem;
  text-align: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 0.5rem;
}

.stat-label {
  font-size: 0.875rem;
  color: #6b7280;
}

/* User and Creator Panels */
.user-panels, .creator-panels {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  margin-top: 1.5rem;
}

@media (min-width: 1024px) {
  .user-panels, .creator-panels {
    grid-template-columns: repeat(2, 1fr);
  }
}

.user-panel, .creator-panel {
  background-color: white;
  border-radius: 0.75rem;
  padding: 1.5rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.user-panel h3, .creator-panel h3 {
  margin: 0 0 1rem 0;
  font-size: 1.125rem;
  color: #1f2937;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #f3f4f6;
}

/* Add New Collection Card */
.add-collection {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  color: #6b7280;
  border: 2px dashed #e5e7eb;
  border-radius: 0.75rem;
  transition: all 0.2s;
}

.add-collection:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.plus-icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

/* Creator Actions */
.creator-actions {
  display: flex;
  gap: 1rem;
  margin-top: 2rem;
}

/* Loading States */
.loading {
  padding: 2rem;
  text-align: center;
  color: #6b7280;
  font-style: italic;
}

/* Search and Filter Bar */
.search-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
  align-items: center;
}

.search-box {
  flex: 1;
  position: relative;
  min-width: 250px;
}

.search-box input {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 2.5rem;
  border-radius: 0.5rem;
  border: 1px solid #e5e7eb;
  font-size: 0.875rem;
}

.search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #6b7280;
  cursor: pointer;
}

.filter-options {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.filter-options select {
  padding: 0.625rem 1rem;
  border-radius: 0.5rem;
  border: 1px solid #e5e7eb;
  background-color: white;
  color: #1f2937;
  font-size: 0.875rem;
  cursor: pointer;
}

.view-toggle {
  display: flex;
  gap: 0.25rem;
}

.view-btn {
  padding: 0.5rem;
  border-radius: 0.375rem;
  border: 1px solid #e5e7eb;
  background-color: white;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.2s;
}

.view-btn.active {
  background-color: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

/* Results Summary */
.results-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1.5rem;
  color: #6b7280;
  font-size: 0.875rem;
}

.pagination {
  display: flex;
  align-items: center;
  gap: 1rem;
}

#page-info {
  min-width: 100px;
  text-align: center;
}

/* Enhanced Responsive Design */

/* Large Desktop (1400px+) */
@media (min-width: 1400px) {
  .app-container {
    max-width: 1600px;
    margin: 0 auto;
  }
  
  .nft-gallery {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
  }
  
  .main-content {
    padding: 2.5rem;
  }
}

/* Desktop (1024px - 1399px) */
@media (min-width: 1024px) and (max-width: 1399px) {
  .sidebar {
    width: 240px;
  }
  
  .nft-gallery {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  }
}

/* Tablet Landscape (768px - 1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
  .app-header {
    padding: 1rem 1.5rem;
  }
  
  .brand h1 {
    font-size: 1.75rem;
  }
  
  .header-controls {
    gap: 1rem;
  }
  
  .sidebar {
    width: 220px;
  }
  
  .main-content {
    padding: 1.5rem;
  }
  
  .nft-gallery {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.25rem;
  }
  
  .mode-selector {
    padding: 1.5rem;
  }
  
  .tabs {
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  
  .search-filter-bar {
    flex-direction: column;
    gap: 1rem;
  }
  
  .filter-options {
    flex-wrap: wrap;
    gap: 0.5rem;
  }
}

/* Tablet Portrait (481px - 767px) */
@media (min-width: 481px) and (max-width: 767px) {
  .main-layout {
    flex-direction: column;
    height: auto;
  }
  
  .sidebar {
    width: 100%;
    height: auto;
    border-right: none;
    border-bottom: 1px solid #e5e7eb;
    padding: 1rem 0;
  }
  
  .sidebar-section {
    padding: 0 1rem;
    margin-bottom: 1.5rem;
  }
  
  .main-content {
    padding: 1.5rem;
  }
  
  .app-header {
    padding: 1rem;
    flex-wrap: wrap;
    gap: 1rem;
  }
  
  .brand {
    flex: 1;
    min-width: 200px;
  }
  
  .brand h1 {
    font-size: 1.5rem;
  }
  
  .header-controls {
    gap: 0.75rem;
    flex-wrap: wrap;
  }
  
  .network-toggle {
    order: 1;
  }
  
  .network-indicator {
    order: 2;
  }
  
  .nft-gallery {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
  }
  
  .mode-selector {
    padding: 1.25rem;
    margin-bottom: 1.5rem;
  }
  
  .mode-toggle {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .mode-btn {
    width: 100%;
    padding: 0.75rem;
  }
  
  .tabs {
    flex-direction: column;
    gap: 0.25rem;
  }
  
  .tab {
    text-align: center;
    padding: 0.75rem;
  }
  
  .search-filter-bar {
    flex-direction: column;
    gap: 1rem;
  }
  
  .search-box {
    width: 100%;
  }
  
  .filter-options {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .view-toggle {
    justify-content: center;
  }
  
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }
  
  .creator-actions {
    flex-direction: column;
    gap: 0.75rem;
  }
  
  .modal {
    margin: 1rem;
    max-width: calc(100vw - 2rem);
  }
}

/* Mobile (320px - 480px) */
@media (max-width: 480px) {
  .app-header {
    padding: 0.75rem;
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
  }
  
  .brand {
    text-align: center;
  }
  
  .brand h1 {
    font-size: 1.25rem;
  }
  
  .brand-tagline {
    font-size: 0.75rem;
  }
  
  .header-controls {
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  
  .network-toggle {
    flex: 1;
    min-width: 120px;
  }
  
  .network-btn {
    padding: 0.5rem 0.75rem;
    font-size: 0.7rem;
  }
  
  .main-layout {
    flex-direction: column;
    height: auto;
  }
  
  .sidebar {
    width: 100%;
    height: auto;
    border-right: none;
    border-bottom: 1px solid #e5e7eb;
    padding: 0.75rem 0;
  }
  
  .sidebar-section {
    padding: 0 0.75rem;
    margin-bottom: 1rem;
  }
  
  .sidebar-section h3 {
    font-size: 0.8rem;
    margin-bottom: 0.75rem;
  }
  
  .sidebar-link {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
  }
  
  .sidebar-link .icon {
    font-size: 1rem;
    width: 1.25rem;
    margin-right: 0.5rem;
  }
  
  .main-content {
    padding: 1rem;
  }
  
  .nft-gallery {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.75rem;
  }
  
  .nft-gallery.list-view {
    grid-template-columns: 1fr;
  }
  
  .mode-selector {
    padding: 1rem;
    margin-bottom: 1rem;
  }
  
  .mode-toggle {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .mode-btn {
    width: 100%;
    padding: 0.75rem;
    font-size: 0.875rem;
  }
  
  .tabs {
    flex-direction: column;
    gap: 0.25rem;
  }
  
  .tab {
    text-align: center;
    padding: 0.75rem;
    font-size: 0.875rem;
  }
  
  .tab-header {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
  }
  
  .tab-header h2 {
    font-size: 1.25rem;
    text-align: center;
  }
  
  .search-filter-bar {
    flex-direction: column;
    gap: 0.75rem;
  }
  
  .search-box {
    width: 100%;
  }
  
  .search-box input {
    font-size: 16px; /* Prevents zoom on iOS */
  }
  
  .filter-options {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .view-toggle {
    justify-content: center;
  }
  
  .view-btn {
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
  
  .stat-card {
    padding: 1rem;
  }
  
  .creator-actions {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .btn {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
  }
  
  .btn-sm {
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
  }
  
  .modal {
    margin: 0.5rem;
    max-width: calc(100vw - 1rem);
    max-height: calc(100vh - 1rem);
  }
  
  .modal-header {
    padding: 1rem;
  }
  
  .modal-header h3 {
    font-size: 1.125rem;
  }
  
  .modal form {
    padding: 1rem;
  }
  
  .wallet-card {
    padding: 1rem;
  }
  
  .wallet-address {
    font-size: 0.7rem;
    padding: 0.5rem;
  }
  
  .balance-amount {
    font-size: 1.125rem;
  }
  
  .pagination {
    flex-direction: column;
    gap: 0.75rem;
    align-items: center;
  }
  
  .results-summary {
    flex-direction: column;
    gap: 0.75rem;
    text-align: center;
  }
}

/* Extra Small Mobile (320px and below) */
@media (max-width: 320px) {
  .nft-gallery {
    grid-template-columns: 1fr;
  }
  
  .brand h1 {
    font-size: 1.125rem;
  }
  
  .modal {
    margin: 0.25rem;
    max-width: calc(100vw - 0.5rem);
  }
  
  .sidebar-section {
    padding: 0 0.5rem;
  }
  
  .main-content {
    padding: 0.75rem;
  }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
  .btn, .sidebar-link, .tab, .nft-card {
    min-height: 44px; /* Minimum touch target size */
  }
  
  .btn-icon {
    min-width: 44px;
    min-height: 44px;
  }
  
  .network-btn {
    min-height: 40px;
  }
}

/* High DPI Displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .logo-image {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
  }
}

/* Landscape Orientation on Mobile */
@media (max-width: 767px) and (orientation: landscape) {
  .main-layout {
    flex-direction: row;
  }
  
  .sidebar {
    width: 200px;
    height: calc(100vh - 60px);
    border-right: 1px solid #e5e7eb;
    border-bottom: none;
  }
  
  .app-header {
    height: 60px;
    padding: 0.5rem 1rem;
  }
  
  .brand h1 {
    font-size: 1.125rem;
  }
  
  .header-controls {
    gap: 0.5rem;
  }
}

/* Print Styles */
@media print {
  .sidebar, .app-header, .modal-overlay {
    display: none !important;
  }
  
  .main-content {
    padding: 0;
    box-shadow: none;
  }
  
  .nft-gallery {
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
  }
}

/* Network and Status Indicators */
.network-toggle {
  display: flex;
  border-radius: 0.5rem;
  overflow: hidden;
  border: 1px solid #e5e7eb;
}

.network-btn {
  padding: 0.5rem 1rem;
  background-color: #f9fafb;
  border: none;
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 600;
}

.network-btn.active {
  background-color: var(--primary-color);
  color: white;
}

.network-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: #6b7280;
}

.network-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #d1d5db;
}

.network-dot.testnet {
  background-color: #fbbf24;
}

.network-dot.mainnet {
  background-color: var(--primary-color);
}

/* Status Messages */
.status {
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
  display: none;
}

.status.info {
  background-color: #eff6ff;
  color: #1e40af;
  border-left: 4px solid #3b82f6;
}

.status.success {
  background-color: #ecfdf5;
  color: #065f46;
  border-left: 4px solid #10b981;
}

.status.warning {
  background-color: #fffbeb;
  color: #92400e;
  border-left: 4px solid #f59e0b;
}

.status.error {
  background-color: #fef2f2;
  color: #991b1b;
  border-left: 4px solid #ef4444;
}

/* Wallet Components */
.wallet-card {
  background-color: white;
  border-radius: 0.75rem;
  padding: 1.25rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.wallet-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.wallet-header h4 {
  margin: 0;
  font-size: 0.875rem;
  color: #6b7280;
}

.wallet-address {
  font-family: monospace;
  background-color: #f3f4f6;
  padding: 0.625rem;
  border-radius: 0.375rem;
  font-size: 0.75rem;
  word-break: break-all;
  margin: 0 0 1rem 0;
}

.wallet-balance {
  margin-bottom: 1rem;
}

.wallet-balance h4 {
  margin: 0 0 0.375rem 0;
  font-size: 0.875rem;
  color: #6b7280;
}

.balance-amount {
  font-size: 1.25rem;
  font-weight: 700;
  color: #10b981;
  margin: 0;
}