/* Advanced Website Popup Styles */

#websitePopup {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
  overflow-y: auto;
  padding: 20px;
}

.website-popup-content {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  max-width: 900px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  animation: slideUp 0.3s ease;
  position: relative;
}

.website-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 28px;
  border-bottom: 1px solid var(--border);
  background: var(--panel-2);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  position: sticky;
  top: 0;
  z-index: 10;
}

.website-popup-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.website-popup-title h3 {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
}

.website-popup-title .status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
}

.status-badge.live {
  background: rgba(34, 197, 94, 0.15);
  color: var(--success);
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.status-badge.offline {
  background: rgba(239, 68, 68, 0.15);
  color: var(--error);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.status-badge .status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

#closeWebsitePopup {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--muted);
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

#closeWebsitePopup:hover {
  background: var(--panel);
  color: var(--text);
  border-color: var(--accent);
}

.website-popup-body {
  padding: 28px;
}

/* Tabs */
.website-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  border-bottom: 2px solid var(--border);
  overflow-x: auto;
}

.website-tab {
  background: none;
  border: none;
  color: var(--muted);
  padding: 12px 20px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s ease;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
}

.website-tab:hover {
  color: var(--text);
  background: var(--panel-2);
}

.website-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.website-tab svg {
  width: 16px;
  height: 16px;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

/* Overview Section */
.website-url-section {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 20px;
}

.website-url-section label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.website-url-display {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--input);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
}

.website-url-display input {
  flex: 1;
  background: none;
  border: none;
  color: var(--accent);
  font-family: 'Courier New', monospace;
  font-size: 14px;
  outline: none;
}

.copy-url-btn {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.copy-url-btn:hover {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}

/* Info Grid */
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.info-item {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
}

.info-item-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.info-item-value {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.info-item-value svg {
  width: 18px;
  height: 18px;
  color: var(--accent);
}

/* New Styles for Settings and History */

/* Action Buttons */
.website-popup-actions {
	  display: flex;
	  gap: 12px;
	  margin-top: 24px;
	  padding-top: 24px;
	  border-top: 1px solid var(--border);
	}
	
	.website-actions-group {
	  display: flex;
	  gap: 12px;
	  margin-top: 20px;
	  padding-top: 20px;
	  border-top: 1px solid var(--border);
	}
	
	.website-actions-group .btn {
	  flex: 1;
	  padding: 12px 20px;
	  font-weight: 600;
	  font-size: 14px;
	  display: flex;
	  align-items: center;
	  justify-content: center;
	  gap: 8px;
	  border-radius: var(--radius-sm);
	  cursor: pointer;
	  transition: all 0.2s ease;
	}
	
	.btn-danger {
	  background: var(--error);
	  color: var(--bg);
	  border: 1px solid var(--error);
	}
	
	.btn-danger:hover {
	  background: #c82333; /* Darker red */
	  border-color: #bd2130;
	}
	
	/* Settings Styles */
	.settings-section {
	  margin-bottom: 30px;
	  padding: 20px;
	  background: var(--panel-2);
	  border-radius: var(--radius-sm);
	  border: 1px solid var(--border);
	}
	
	.settings-section h4 {
	  margin-top: 0;
	  margin-bottom: 15px;
	  color: var(--text);
	  font-size: 18px;
	  border-bottom: 1px solid var(--border);
	  padding-bottom: 10px;
	}
	
	.setting-item-toggle {
	  display: flex;
	  justify-content: space-between;
	  align-items: center;
	  padding: 10px 0;
	  border-bottom: 1px dashed var(--border);
	}
	
	.setting-item-toggle:last-child {
	  border-bottom: none;
	}
	
	.setting-item-toggle label {
	  font-size: 15px;
	  color: var(--text);
	}
	
	.danger-note {
	  color: var(--muted);
	  font-size: 13px;
	  margin-top: 10px;
	}
	
	/* History Styles */
	.history-list {
	  list-style: none;
	  padding: 0;
	  margin: 0;
	}
	
	.history-item {
	  display: flex;
	  align-items: center;
	  padding: 12px 0;
	  border-bottom: 1px solid var(--border);
	}
	
	.history-item:last-child {
	  border-bottom: none;
	}
	
	.history-icon {
	  font-size: 18px;
	  margin-right: 15px;
	}
	
	.history-text {
	  flex-grow: 1;
	  font-size: 15px;
	  color: var(--text);
	}
	
	.history-time {
	  font-size: 13px;
	  color: var(--muted);
	  white-space: nowrap;
	}
	
	.history-note {
	  margin-top: 20px;
	  padding: 10px;
	  background: var(--panel-2);
	  border-left: 4px solid var(--accent);
	  color: var(--muted);
	  font-size: 14px;
	  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
	}

.website-popup-actions .btn {
  flex: 1;
  padding: 14px 24px;
  font-weight: 600;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-primary {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}

.btn-primary:hover {
  opacity: 0.9;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(var(--accent-rgb), 0.4);
}

.btn-secondary {
  background: var(--panel-2);
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: var(--panel);
  border-color: var(--accent);
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
}

.empty-state svg {
  width: 64px;
  height: 64px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state p {
  margin: 8px 0;
  font-size: 15px;
}

/* Responsive */
@media (max-width: 768px) {
  .website-popup-content {
    max-width: 100%;
    max-height: 95vh;
    margin: 0; /* إزالة أي هوامش قد تدفع النافذة خارج الشاشة */
    border-radius: 0; /* إزالة الحواف الدائرية لتغطية الشاشة بالكامل */
  }
  
  .website-popup-header,
  .website-popup-body {
    padding: 16px; /* تقليل الحشو لزيادة المساحة المتاحة */
  }
  
  .info-grid,
  .analytics-grid {
    grid-template-columns: 1fr;
  }

  /* تحسين عرض قائمة المتغيرات البيئية والأسرار */
  .env-item,
  .secret-item-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .env-item-actions {
    width: 100%;
    justify-content: space-around;
    margin-top: 8px;
  }

  .env-item-actions button {
    flex: 1;
  }

  .website-popup-title h3 {
    font-size: 18px; /* تصغير حجم العنوان */
  }

  .website-tabs {
    flex-wrap: wrap; /* السماح للألسنة بالانتقال إلى سطر جديد */
    justify-content: center;
    border-bottom: none; /* إزالة الخط السفلي */
  }

  .website-tab {
    flex-grow: 1;
    text-align: center;
    border-bottom: 2px solid transparent;
    margin-bottom: 4px;
  }

  .website-tab.active {
    border-bottom-color: var(--accent);
  }

  .website-url-display {
    flex-direction: column;
    align-items: stretch;
  }

  .copy-url-btn {
    width: 100%;
    margin-top: 8px;
  }
  
  .website-popup-actions {
    flex-direction: column;
  }
  
  .website-tabs {
    gap: 4px;
  }
  
  .website-tab {
    padding: 10px 14px;
    font-size: 14px;
  }
}

/* Scrollbar */
.website-popup-content::-webkit-scrollbar {
  width: 8px;
}

.website-popup-content::-webkit-scrollbar-track {
  background: var(--panel);
}

.website-popup-content::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

.website-popup-content::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}


/* تحسين إضافي للشاشات الصغيرة جدًا */
@media (max-width: 480px) {
  #websitePopup {
    padding: 0;
  }

  .website-popup-content {
    border-radius: 0;
    max-height: 100vh;
  }

  .website-popup-header {
    padding: 12px;
    border-radius: 0;
  }

  .website-popup-body {
    padding: 12px;
  }

  .website-popup-title h3 {
    font-size: 16px;
  }

  .website-popup-title {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .website-tab {
    padding: 8px 10px;
    font-size: 12px;
  }

  .website-tab svg {
    width: 14px;
    height: 14px;
  }

  .analytics-value {
    font-size: 24px;
  }

  .website-url-section,
  .env-item,
  .secret-item,
  .info-item,
  .analytics-card {
    padding: 12px;
  }

  .website-popup-actions .btn {
    padding: 12px 16px;
    font-size: 14px;
  }

  #closeWebsitePopup {
    padding: 6px;
  }
}
