/* ==========================================================================
   1. ROOT & THEME VARIABLES
========================================================================== */
:root {
  --bg-primary: #1a1d21;
  --bg-secondary: #22262b;
  --bg-tertiary: #2c313a;
  --text-primary: #e1e1e1;
  --text-secondary: #a0a7b3;
  --text-heading: #ffffff;
  --border-primary: #3a414c;
  --accent-primary: #e44d26;
  --accent-primary-hover: #f55a35;
  --transition-speed: 0.3s;
  --success-color: #27ae60;
  --warning-color: #f39c12;
  --error-color: #e74c3c;
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif;
}
body.light-mode {
  --bg-primary: #f5f7fa;
  --bg-secondary: #ffffff;
  --bg-tertiary: #e9ecef;
  --text-primary: #2c3e50;
  --text-secondary: #5a6878;
  --text-heading: #1c2632;
  --border-primary: #e1e5ea;
  --success-color: #218838;
  --warning-color: #e0a800;
  --error-color: #c82333;
}

/* ==========================================================================
   2. BASE & APP LAYOUT
========================================================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
body {
  font-family: var(--font-family);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-size: 15px;
  line-height: 1.6;
}
.app-container {
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 24px;
  height: 60px;
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-primary);
  flex-shrink: 0;
}
.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.header-logo {
  font-size: 1.5rem;
  color: var(--accent-primary);
}
.header-left h1 {
  font-size: 1.25rem;
  color: var(--text-heading);
  font-weight: 600;
}
.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}
.theme-toggle-btn {
  background: none;
  border: 1px solid var(--border-primary);
  color: var(--text-secondary);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}
.theme-toggle-btn:hover {
  color: var(--accent-primary);
  border-color: var(--accent-primary);
}
.theme-toggle-btn .fa-sun {
  display: none;
}
body.light-mode .theme-toggle-btn .fa-sun {
  display: inline-block;
}
body.light-mode .theme-toggle-btn .fa-moon {
  display: none;
}
.user-profile {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-color: var(--bg-tertiary);
  color: var(--text-heading);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
}

/* Main Layout (Sidebar + Content) */
.app-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  height: calc(100vh - 60px);
  overflow: hidden;
}

/* ==========================================================================
   3. SIDEBAR & FORM
========================================================================== */
.sidebar {
  background-color: var(--bg-secondary);
  border-right: 1px solid var(--border-primary);
  padding: 24px;
  overflow-y: auto;
}
.sidebar-section {
  margin-bottom: 24px;
}
.sidebar-section h3 {
  font-size: 0.8rem;
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 1px;
  margin-bottom: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.badge-pro {
  background-color: var(--accent-primary);
  color: #fff;
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 4px;
}
.filter-group {
  padding: 12px;
  border: 1px solid var(--border-primary);
  border-radius: 6px;
  margin-bottom: 10px;
  color: var(--text-secondary);
}

/* Sidebar Form */
.rank-form-sidebar .form-group {
  margin-bottom: 16px;
}
.rank-form-sidebar label {
  font-weight: 500;
  display: block;
  margin-bottom: 6px;
  font-size: 0.9rem;
}
.rank-form-sidebar input,
.rank-form-sidebar select {
  width: 100%;
  padding: 10px;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-primary);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 0.9rem;
  transition: all 0.2s ease;
}
.rank-form-sidebar input:focus,
.rank-form-sidebar select:focus {
  outline: none;
  border-color: var(--accent-primary);
}
.submit-btn {
  width: 100%;
  padding: 12px;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  background-color: var(--accent-primary);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.submit-btn:hover {
  background-color: var(--accent-primary-hover);
}
.submit-btn i {
  margin-right: 8px;
}

/* ==========================================================================
   4. MAIN CONTENT & RESULTS TABLE
========================================================================== */
.main-content {
  padding: 24px 32px;
  overflow-y: auto;
}
.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.results-header h2 {
  font-size: 1.2rem;
  font-weight: 600;
}
.action-btn {
  background: none;
  border: 1px solid var(--border-primary);
  color: var(--text-primary);
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.9rem;
  cursor: pointer;
}
.action-btn i {
  margin-right: 6px;
}

/* Table */
.table-container {
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  overflow: hidden;
}
.results-table {
  width: 100%;
  border-collapse: collapse;
}
.results-table th,
.results-table td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border-primary);
}
.results-table thead th {
  background-color: var(--bg-secondary);
  font-size: 0.8rem;
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
}
.results-table tbody tr:last-child td {
  border-bottom: none;
}
.results-table tbody tr:hover {
  background-color: var(--bg-tertiary);
}
.app-id-cell {
  font-family: monospace;
}
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 500;
}
.status-badge.success {
  background-color: rgba(39, 174, 96, 0.15);
  color: #2ecc71;
}
.status-badge.not-found {
  background-color: rgba(243, 156, 18, 0.15);
  color: #f39c12;
}
.status-badge.error {
  background-color: rgba(231, 76, 60, 0.15);
  color: #e74c3c;
}
.platform-icon-apple {
  color: var(--text-secondary);
}
.platform-icon-google {
  color: #00d3fe;
}

/* Empty State */
.empty-state {
  text-align: center;
  margin-top: 10vh;
}
.empty-icon {
  font-size: 4rem;
  color: var(--border-primary);
  margin-bottom: 24px;
}
.empty-state h2 {
  font-size: 1.5rem;
  color: var(--text-heading);
  margin-bottom: 8px;
}
.empty-state p {
  font-size: 1rem;
  color: var(--text-secondary);
  max-width: 400px;
  margin: 0 auto;
}

/* ==========================================================================
   5. AI RECOMMENDATIONS
========================================================================== */
.ai-recommendations {
  margin-top: 32px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: 8px;
}
.ai-recommendations h3 {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-primary);
  font-size: 1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}
.ai-recommendations h3 .fa-brain {
  color: var(--accent-primary);
}
.recommendation-content {
  padding: 20px;
  font-size: 0.95rem;
}
.recommendation-content ul {
  list-style-type: none;
  padding-left: 0;
}
.recommendation-content li {
  margin-bottom: 16px;
  line-height: 1.6;
}
.recommendation-content li strong {
  color: var(--text-heading);
  display: block;
  margin-bottom: 4px;
}

/* ==========================================================================
   6. TABS
========================================================================== */
.tabs {
  display: flex;
  gap: 8px;
  background-color: var(--bg-primary);
  padding: 4px;
  border-radius: 8px;
}
.tab-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}
.tab-btn.active {
  background-color: var(--bg-tertiary);
  color: var(--text-heading);
}

/* Tab Content Visibility */
.tab-content {
  display: none;
}
.tab-content.active {
  display: block;
}

/* Add this CSS to your style.css file */

.app-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.app-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid #e0e0e0;
}

.app-icon-placeholder {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: #f5f5f5;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #999;
  font-size: 18px;
  flex-shrink: 0;
}

.app-details {
  flex: 1;
}

.app-name {
  font-weight: 600;
  color: #333;
  margin-bottom: 2px;
}

.app-id {
  font-size: 11px;
  color: #666;
  opacity: 0.7;
}

/* Dark mode styles */
body:not(.light-mode) .app-icon {
  border-color: #444;
}

body:not(.light-mode) .app-icon-placeholder {
  background: #333;
  color: #666;
}

body:not(.light-mode) .app-name {
  color: #fff;
}

body:not(.light-mode) .app-id {
  color: #aaa;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .app-icon,
  .app-icon-placeholder {
    width: 32px;
    height: 32px;
  }

  .app-info {
    gap: 8px;
  }

  .app-name {
    font-size: 14px;
  }

  .app-id {
    font-size: 10px;
  }
}
