/**
 * 🎨 Modern Plugin List Styles
 * Fully responsive design with enhanced UX
 */

/* ===== 🎯 CSS Variables ===== */
:root {
  --plugin-primary: #0073aa;
  --plugin-primary-hover: #005a87;
  --plugin-primary-light: #e6f3ff;
  
  --plugin-success: #00a32a;
  --plugin-success-light: #e6f7e6;
  --plugin-error: #d63638;
  --plugin-error-light: #ffeaea;
  --plugin-warning: #dba617;
  --plugin-warning-light: #fff8e1;
  
  --plugin-gray-50: #f9fafb;
  --plugin-gray-100: #f3f4f6;
  --plugin-gray-200: #e5e7eb;
  --plugin-gray-300: #d1d5db;
  --plugin-gray-400: #9ca3af;
  --plugin-gray-500: #6b7280;
  --plugin-gray-600: #4b5563;
  --plugin-gray-700: #374151;
  --plugin-gray-800: #1f2937;
  --plugin-gray-900: #111827;
  
  --plugin-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --plugin-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --plugin-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --plugin-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  
  --plugin-radius-sm: 0.375rem;
  --plugin-radius-md: 0.5rem;
  --plugin-radius-lg: 0.75rem;
  --plugin-radius-xl: 1rem;
  
  --plugin-transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --plugin-transition-slow: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== 🏗️ Main Container ===== */
.plugin-list-container {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--plugin-gray-50) 0%, var(--plugin-gray-100) 100%);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ===== 📋 Header Section ===== */
.plugin-list-header {
  background: white;
  border-bottom: 1px solid var(--plugin-gray-200);
  box-shadow: var(--plugin-shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
  
  .header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    
    @media (max-width: 1024px) {
      flex-direction: column;
      gap: 1rem;
      padding: 1rem;
    }
  }
  
  .brand-section {
    display: flex;
    align-items: center;
    gap: 1rem;
    
    .brand-logo {
      height: 40px;
      width: auto;
      cursor: pointer;
      transition: var(--plugin-transition);
      
      &:hover {
        transform: scale(1.05);
        opacity: 0.8;
      }
    }
    
    .support-icon {
      .support-logo {
        height: 32px;
        width: auto;
        cursor: pointer;
        transition: var(--plugin-transition);
        
        &:hover {
          transform: scale(1.1);
        }
      }
    }
  }
  
  .page-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    
    @media (max-width: 1024px) {
      justify-content: center;
    }
    
    .title-icon {
      color: var(--plugin-primary);
      font-size: 2rem;
    }
    
    h1 {
      margin: 0;
      font-size: 1.875rem;
      font-weight: 700;
      color: var(--plugin-gray-900);
      
      @media (max-width: 768px) {
        font-size: 1.5rem;
      }
    }
    
    .plugin-count {
      background: var(--plugin-primary-light);
      color: var(--plugin-primary);
      padding: 0.25rem 0.75rem;
      border-radius: var(--plugin-radius-lg);
      font-size: 0.875rem;
      font-weight: 600;
    }
  }
  
  .header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    
    @media (max-width: 1024px) {
      width: 100%;
      justify-content: center;
    }
    
    @media (max-width: 640px) {
      flex-direction: column;
      gap: 0.75rem;
    }
    
    .search-container {
      position: relative;
      
      .search-input {
        padding: 0.75rem 1rem;
        border: 1px solid var(--plugin-gray-300);
        border-radius: var(--plugin-radius-md);
        font-size: 0.875rem;
        width: 250px;
        transition: var(--plugin-transition);
        
        @media (max-width: 640px) {
          width: 200px;
        }
        
        &:focus {
          outline: none;
          border-color: var(--plugin-primary);
          box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1);
        }
        
        &::placeholder {
          color: var(--plugin-gray-400);
        }
      }
    }
    
    .sort-select {
      padding: 0.75rem 1rem;
      border: 1px solid var(--plugin-gray-300);
      border-radius: var(--plugin-radius-md);
      font-size: 0.875rem;
      background: white;
      cursor: pointer;
      transition: var(--plugin-transition);
      
      &:focus {
        outline: none;
        border-color: var(--plugin-primary);
        box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1);
      }
    }
  }
}

/* ===== 🎯 Main Content Layout ===== */
.plugin-list-main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem;
  display: grid;
  grid-template-columns: 1fr 400px;
  gap: 2rem;
  
  @media (max-width: 1200px) {
    grid-template-columns: 1fr 350px;
    padding: 1.5rem;
  }
  
  @media (max-width: 1024px) {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    padding: 1rem;
  }
}

/* ===== 📝 Plugins Panel ===== */
.plugins-panel {
  background: white;
  border-radius: var(--plugin-radius-xl);
  box-shadow: var(--plugin-shadow-lg);
  overflow: hidden;
  
  .panel-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--plugin-gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, var(--plugin-gray-50) 0%, white 100%);
    
    @media (max-width: 640px) {
      flex-direction: column;
      gap: 1rem;
      padding: 1rem;
    }
    
    h2 {
      margin: 0;
      font-size: 1.5rem;
      font-weight: 700;
      color: var(--plugin-gray-900);
    }
    
    .panel-actions {
      display: flex;
      gap: 0.75rem;
      
      @media (max-width: 640px) {
        width: 100%;
        justify-content: center;
      }
    }
  }
  
  .add-plugin-btn,
  .save-all-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--plugin-radius-md);
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: var(--plugin-transition);
    position: relative;
    
    &:disabled {
      opacity: 0.5;
      cursor: not-allowed;
    }
    
    svg {
      font-size: 1.25rem;
    }
  }
  
  .add-plugin-btn {
    background: var(--plugin-primary);
    color: white;
    
    &:hover:not(:disabled) {
      background: var(--plugin-primary-hover);
      transform: translateY(-1px);
      box-shadow: var(--plugin-shadow-md);
    }
    
    .pro-badge {
      position: absolute;
      top: -8px;
      right: -8px;
      background: linear-gradient(135deg, #ff6900 0%, #fcb900 100%);
      color: white;
      font-size: 0.625rem;
      padding: 0.25rem 0.5rem;
      border-radius: var(--plugin-radius-sm);
      font-weight: 700;
      animation: pulse 2s infinite;
    }
  }
  
  .save-all-btn {
    background: var(--plugin-success);
    color: white;
    
    &:hover:not(:disabled) {
      background: #007a1f;
      transform: translateY(-1px);
      box-shadow: var(--plugin-shadow-md);
    }
  }
  
  .plugins-list {
    max-height: 600px;
    overflow-y: auto;
    padding: 1rem;
    
    &::-webkit-scrollbar {
      width: 6px;
    }
    
    &::-webkit-scrollbar-track {
      background: var(--plugin-gray-100);
      border-radius: 3px;
    }
    
    &::-webkit-scrollbar-thumb {
      background: var(--plugin-gray-400);
      border-radius: 3px;
      
      &:hover {
        background: var(--plugin-gray-500);
      }
    }
  }
  
  .empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--plugin-gray-500);
    
    .empty-icon {
      font-size: 4rem;
      color: var(--plugin-gray-300);
      margin-bottom: 1rem;
    }
    
    h3 {
      margin: 0 0 0.5rem 0;
      font-size: 1.25rem;
      color: var(--plugin-gray-700);
    }
    
    p {
      margin: 0 0 1.5rem 0;
      font-size: 0.875rem;
    }
    
    .add-first-plugin {
      display: inline-flex;
      align-items: center;
      gap: 0.5rem;
      padding: 0.75rem 1.5rem;
      background: var(--plugin-primary);
      color: white;
      border: none;
      border-radius: var(--plugin-radius-md);
      font-weight: 600;
      cursor: pointer;
      transition: var(--plugin-transition);
      
      &:hover {
        background: var(--plugin-primary-hover);
        transform: translateY(-1px);
      }
    }
  }
  
  .usage-stats {
    padding: 1rem 2rem;
    border-top: 1px solid var(--plugin-gray-200);
    background: var(--plugin-gray-50);
    display: flex;
    align-items: center;
    justify-content: space-between;
    
    @media (max-width: 640px) {
      flex-direction: column;
      gap: 0.75rem;
      padding: 1rem;
    }
    
    .stats-item {
      display: flex;
      align-items: center;
      gap: 0.5rem;
      
      .stats-label {
        font-weight: 600;
        color: var(--plugin-gray-700);
      }
      
      .stats-value {
        font-weight: 700;
        color: var(--plugin-primary);
      }
    }
    
    .upgrade-hint {
      display: flex;
      align-items: center;
      gap: 0.5rem;
      font-size: 0.875rem;
      color: var(--plugin-gray-600);
      
      .info-icon {
        font-size: 1rem;
        color: var(--plugin-warning);
      }
    }
  }
}

/* ===== 📖 Instructions Panel ===== */
.instructions-panel {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  
  .cron-section,
  .video-section {
    background: white;
    border-radius: var(--plugin-radius-xl);
    box-shadow: var(--plugin-shadow-lg);
    overflow: hidden;
  }
  
  .cron-section {
    padding: 1.5rem;
    
    h2 {
      margin: 0 0 0.5rem 0;
      font-size: 1.5rem;
      font-weight: 700;
      color: var(--plugin-gray-900);
    }
    
    .section-description {
      margin: 0 0 1.5rem 0;
      color: var(--plugin-gray-600);
      font-size: 0.875rem;
    }
    
    .cron-url-section {
      margin-bottom: 1.5rem;
      
      label {
        display: block;
        margin-bottom: 0.5rem;
        font-weight: 600;
        color: var(--plugin-gray-700);
        font-size: 0.875rem;
      }
      
      .url-container {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        
        .cron-url {
          flex: 1;
          padding: 0.75rem;
          background: var(--plugin-gray-900);
          color: #e6e6e6;
          border-radius: var(--plugin-radius-md);
          font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
          font-size: 0.75rem;
          word-break: break-all;
          line-height: 1.4;
        }
        
        .copy-btn {
          padding: 0.75rem;
          background: var(--plugin-primary);
          color: white;
          border: none;
          border-radius: var(--plugin-radius-md);
          cursor: pointer;
          transition: var(--plugin-transition);
          display: flex;
          align-items: center;
          
          &:hover {
            background: var(--plugin-primary-hover);
            transform: scale(1.05);
          }
          
          svg {
            font-size: 1.25rem;
          }
        }
      }
      
      .copy-success {
        margin-top: 0.5rem;
        
        span {
          color: var(--plugin-success);
          font-size: 0.875rem;
          font-weight: 600;
        }
      }
    }
    
    .cron-instructions {
      h3 {
        margin: 0 0 1rem 0;
        font-size: 1.125rem;
        font-weight: 600;
        color: var(--plugin-gray-900);
      }
      
      ol {
        margin: 0;
        padding-left: 1.5rem;
        
        li {
          margin-bottom: 0.75rem;
          line-height: 1.5;
          color: var(--plugin-gray-700);
          
          strong {
            color: var(--plugin-gray-900);
          }
          
          .external-link {
            display: inline-flex;
            align-items: center;
            gap: 0.25rem;
            color: var(--plugin-primary);
            text-decoration: none;
            font-weight: 600;
            margin-left: 0.5rem;
            
            &:hover {
              text-decoration: underline;
            }
            
            svg {
              font-size: 1rem;
            }
          }
        }
      }
    }
  }
  
  .video-section {
    padding: 1.5rem;
    
    h3 {
      display: flex;
      align-items: center;
      gap: 0.5rem;
      margin: 0 0 1rem 0;
      font-size: 1.125rem;
      font-weight: 600;
      color: var(--plugin-gray-900);
      
      .video-icon {
        color: var(--plugin-primary);
        font-size: 1.5rem;
      }
    }
    
    .video-wrapper {
      position: relative;
      padding-top: 56.25%; /* 16:9 aspect ratio */
      border-radius: var(--plugin-radius-lg);
      overflow: hidden;
      box-shadow: var(--plugin-shadow-md);
      
      .react-player {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
      }
    }
  }
}

/* ===== 🎬 Animations ===== */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

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

/* ===== 📱 Mobile Optimizations ===== */
@media (max-width: 640px) {
  .plugin-list-container {
    font-size: 0.875rem;
  }
  
  .plugin-list-main {
    padding: 0.75rem;
    gap: 1rem;
  }
  
  .plugins-panel .panel-header h2 {
    font-size: 1.25rem;
  }
  
  .instructions-panel .cron-section,
  .instructions-panel .video-section {
    padding: 1rem;
  }
}

/* ===== 🌙 Dark Mode Support ===== */
@media (prefers-color-scheme: dark) {
  :root {
    --plugin-gray-50: #1f2937;
    --plugin-gray-100: #374151;
    --plugin-gray-200: #4b5563;
    --plugin-gray-300: #6b7280;
    --plugin-gray-900: #f9fafb;
    --plugin-gray-800: #e5e7eb;
    --plugin-gray-700: #d1d5db;
  }
}